ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Shared_ZipStreamWrapper Class Reference
+ Collaboration diagram for PHPExcel_Shared_ZipStreamWrapper:

Public Member Functions

 stream_open ($path, $mode, $options, &$opened_path)
 Implements support for fopen(). More...
 
 statName ()
 Implements support for fstat(). More...
 
 url_stat ()
 Implements support for fstat(). More...
 
 stream_stat ()
 Implements support for fstat(). More...
 
 stream_read ($count)
 Implements support for fread(), fgets() etc. More...
 
 stream_tell ()
 Returns the position of the file pointer, i.e. More...
 
 stream_eof ()
 EOF stream. More...
 
 stream_seek ($offset, $whence)
 Seek stream. More...
 

Static Public Member Functions

static register ()
 Register wrapper. More...
 

Private Attributes

 $_archive
 
 $_fileNameInArchive = ''
 
 $_position = 0
 
 $_data = ''
 

Detailed Description

Definition at line 36 of file ZipStreamWrapper.php.

Member Function Documentation

◆ register()

static PHPExcel_Shared_ZipStreamWrapper::register ( )
static

Register wrapper.

Definition at line 68 of file ZipStreamWrapper.php.

68 {
69 @stream_wrapper_unregister("zip");
70 @stream_wrapper_register("zip", __CLASS__);
71 }

◆ statName()

PHPExcel_Shared_ZipStreamWrapper::statName ( )

Implements support for fstat().

Returns
boolean

Definition at line 108 of file ZipStreamWrapper.php.

References $_fileNameInArchive.

Referenced by url_stat().

+ Here is the caller graph for this function:

◆ stream_eof()

PHPExcel_Shared_ZipStreamWrapper::stream_eof ( )

EOF stream.

@return     bool

Definition at line 157 of file ZipStreamWrapper.php.

157 {
158 return $this->_position >= strlen($this->_data);
159 }

◆ stream_open()

PHPExcel_Shared_ZipStreamWrapper::stream_open (   $path,
  $mode,
  $options,
$opened_path 
)

Implements support for fopen().

Parameters
string$pathresource name including scheme, e.g.
string$modeonly "r" is supported
int$optionsmask of STREAM_REPORT_ERRORS and STREAM_USE_PATH
string&$openedPathabsolute path of the opened stream (out parameter)
Returns
bool true on success

Definition at line 82 of file ZipStreamWrapper.php.

82 {
83 // Check for mode
84 if ($mode{0} != 'r') {
85 throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
86 }
87
88 $pos = strrpos($path, '#');
89 $url['host'] = substr($path, 6, $pos - 6); // 6: strlen('zip://')
90 $url['fragment'] = substr($path, $pos + 1);
91
92 // Open archive
93 $this->_archive = new ZipArchive();
94 $this->_archive->open($url['host']);
95
96 $this->_fileNameInArchive = $url['fragment'];
97 $this->_position = 0;
98 $this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
99
100 return true;
101 }
$path
Definition: aliased.php:25
$url
Definition: shib_logout.php:72

References $path, and $url.

◆ stream_read()

PHPExcel_Shared_ZipStreamWrapper::stream_read (   $count)

Implements support for fread(), fgets() etc.

Parameters
int$countmaximum number of bytes to read
Returns
string

Definition at line 136 of file ZipStreamWrapper.php.

136 {
137 $ret = substr($this->_data, $this->_position, $count);
138 $this->_position += strlen($ret);
139 return $ret;
140 }
$ret
Definition: parser.php:6

References $ret.

◆ stream_seek()

PHPExcel_Shared_ZipStreamWrapper::stream_seek (   $offset,
  $whence 
)

Seek stream.

@param      int             $offset byte offset
@param      int             $whence SEEK_SET, SEEK_CUR or SEEK_END
@return     bool

Definition at line 168 of file ZipStreamWrapper.php.

168 {
169 switch ($whence) {
170 case SEEK_SET:
171 if ($offset < strlen($this->_data) && $offset >= 0) {
172 $this->_position = $offset;
173 return true;
174 } else {
175 return false;
176 }
177 break;
178
179 case SEEK_CUR:
180 if ($offset >= 0) {
181 $this->_position += $offset;
182 return true;
183 } else {
184 return false;
185 }
186 break;
187
188 case SEEK_END:
189 if (strlen($this->_data) + $offset >= 0) {
190 $this->_position = strlen($this->_data) + $offset;
191 return true;
192 } else {
193 return false;
194 }
195 break;
196
197 default:
198 return false;
199 }
200 }

◆ stream_stat()

PHPExcel_Shared_ZipStreamWrapper::stream_stat ( )

Implements support for fstat().

Returns
boolean

Definition at line 126 of file ZipStreamWrapper.php.

126 {
127 return $this->_archive->statName( $this->_fileNameInArchive );
128 }

◆ stream_tell()

PHPExcel_Shared_ZipStreamWrapper::stream_tell ( )

Returns the position of the file pointer, i.e.

its offset into the file stream. Implements support for ftell().

Returns
int

Definition at line 148 of file ZipStreamWrapper.php.

References $_position.

◆ url_stat()

PHPExcel_Shared_ZipStreamWrapper::url_stat ( )

Implements support for fstat().

Returns
boolean

Definition at line 117 of file ZipStreamWrapper.php.

117 {
118 return $this->statName( $this->_fileNameInArchive );
119 }
statName()
Implements support for fstat().

References statName().

+ Here is the call graph for this function:

Field Documentation

◆ $_archive

PHPExcel_Shared_ZipStreamWrapper::$_archive
private

Definition at line 42 of file ZipStreamWrapper.php.

◆ $_data

PHPExcel_Shared_ZipStreamWrapper::$_data = ''
private

Definition at line 63 of file ZipStreamWrapper.php.

◆ $_fileNameInArchive

PHPExcel_Shared_ZipStreamWrapper::$_fileNameInArchive = ''
private

Definition at line 49 of file ZipStreamWrapper.php.

Referenced by statName().

◆ $_position

PHPExcel_Shared_ZipStreamWrapper::$_position = 0
private

Definition at line 56 of file ZipStreamWrapper.php.

Referenced by stream_tell().


The documentation for this class was generated from the following file: