ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Shared_ZipStreamWrapper Class Reference
+ Collaboration diagram for PHPExcel_Shared_ZipStreamWrapper:

Public Member Functions

 stream_open ($path, $mode, $options, &$opened_path)
 Open stream.
 stream_stat ()
 Stat stream.
 stream_read ($count)
 Read stream.
 stream_tell ()
 Tell stream.
 stream_eof ()
 EOF stream.
 stream_seek ($offset, $whence)
 Seek stream.

Static Public Member Functions

static register ()
 Register wrapper.

Private Attributes

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

Detailed Description

Definition at line 40 of file ZipStreamWrapper.php.

Member Function Documentation

static PHPExcel_Shared_ZipStreamWrapper::register ( )
static

Register wrapper.

Definition at line 72 of file ZipStreamWrapper.php.

{
@stream_wrapper_unregister("zip");
@stream_wrapper_register("zip", __CLASS__);
}
PHPExcel_Shared_ZipStreamWrapper::stream_eof ( )

EOF stream.

Definition at line 142 of file ZipStreamWrapper.php.

{
return $this->_position >= strlen($this->_data);
}
PHPExcel_Shared_ZipStreamWrapper::stream_open (   $path,
  $mode,
  $options,
$opened_path 
)

Open stream.

Definition at line 80 of file ZipStreamWrapper.php.

{
// Check for mode
if ($mode{0} != 'r') {
throw new Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
}
// Parse URL
$url = @parse_url($path);
// Fix URL
if (!is_array($url)) {
$url['host'] = substr($path, strlen('zip://'));
$url['path'] = '';
}
if (strpos($url['host'], '#') !== false) {
if (!isset($url['fragment'])) {
$url['fragment'] = substr($url['host'], strpos($url['host'], '#') + 1) . $url['path'];
$url['host'] = substr($url['host'], 0, strpos($url['host'], '#'));
unset($url['path']);
}
} else {
$url['host'] = $url['host'] . $url['path'];
unset($url['path']);
}
// Open archive
$this->_archive = new ZipArchive();
$this->_archive->open($url['host']);
$this->_fileNameInArchive = $url['fragment'];
$this->_position = 0;
$this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
return true;
}
PHPExcel_Shared_ZipStreamWrapper::stream_read (   $count)

Read stream.

Definition at line 126 of file ZipStreamWrapper.php.

References $ret.

{
$ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret);
return $ret;
}
PHPExcel_Shared_ZipStreamWrapper::stream_seek (   $offset,
  $whence 
)

Seek stream.

Definition at line 149 of file ZipStreamWrapper.php.

{
switch ($whence) {
case SEEK_SET:
if ($offset < strlen($this->_data) && $offset >= 0) {
$this->_position = $offset;
return true;
} else {
return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
$this->_position += $offset;
return true;
} else {
return false;
}
break;
case SEEK_END:
if (strlen($this->_data) + $offset >= 0) {
$this->_position = strlen($this->_data) + $offset;
return true;
} else {
return false;
}
break;
default:
return false;
}
}
PHPExcel_Shared_ZipStreamWrapper::stream_stat ( )

Stat stream.

Definition at line 119 of file ZipStreamWrapper.php.

{
return $this->_archive->statName( $this->_fileNameInArchive );
}
PHPExcel_Shared_ZipStreamWrapper::stream_tell ( )

Tell stream.

Definition at line 135 of file ZipStreamWrapper.php.

References $_position.

{
}

Field Documentation

PHPExcel_Shared_ZipStreamWrapper::$_archive
private

Definition at line 46 of file ZipStreamWrapper.php.

PHPExcel_Shared_ZipStreamWrapper::$_data = ''
private

Definition at line 67 of file ZipStreamWrapper.php.

PHPExcel_Shared_ZipStreamWrapper::$_fileNameInArchive = ''
private

Definition at line 53 of file ZipStreamWrapper.php.

PHPExcel_Shared_ZipStreamWrapper::$_position = 0
private

Definition at line 60 of file ZipStreamWrapper.php.

Referenced by stream_tell().


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