[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/archive/src/ -> Zip.php (summary)

Part of the Joomla Framework Archive Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 692 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Zip:: (14 methods):
  __construct()
  create()
  extract()
  isSupported()
  hasNativeSupport()
  checkZipData()
  extractCustom()
  extractNative()
  readZipInfo()
  getFileData()
  unix2DosTime()
  addToZipFile()
  createZipFile()
  isBelow()


Class: Zip  - X-Ref

ZIP format adapter for the Archive package

The ZIP compression code is partially based on code from:
Eric Mueller <[email protected]>
http://www.zend.com/codex.php?id=535&single=1

Deins125 <[email protected]>
http://www.zend.com/codex.php?id=470&single=1

The ZIP compression date code is partially based on code from
Peter Listiak <[email protected]>

This class is inspired from and draws heavily in code and concept from the Compress package of
The Horde Project <http://www.horde.org>

__construct($options = [])   X-Ref
Create a new Archive object.

param: array|\ArrayAccess  $options  An array of options or an object that implements \ArrayAccess

create($archive, $files)   X-Ref
Create a ZIP compressed file from an array of file data.

param: string  $archive  Path to save archive.
param: array   $files    Array of files to add to archive.
return: boolean  True if successful.

extract($archive, $destination)   X-Ref
Extract a ZIP compressed file to a given path

param: string  $archive      Path to ZIP archive to extract
param: string  $destination  Path to extract archive into
return: boolean  True if successful

isSupported()   X-Ref
Tests whether this adapter can unpack files on this computer.

return: boolean  True if supported

hasNativeSupport()   X-Ref
Method to determine if the server has native zip support for faster handling

return: boolean  True if php has native ZIP support

checkZipData($data)   X-Ref
Checks to see if the data is a valid ZIP file.

param: string  $data  ZIP archive data buffer.
return: boolean  True if valid, false if invalid.

extractCustom($archive, $destination)   X-Ref
Extract a ZIP compressed file to a given path using a php based algorithm that only requires zlib support

param: string  $archive      Path to ZIP archive to extract.
param: string  $destination  Path to extract archive into.
return: boolean  True if successful

extractNative($archive, $destination)   X-Ref
Extract a ZIP compressed file to a given path using native php api calls for speed

param: string  $archive      Path to ZIP archive to extract
param: string  $destination  Path to extract archive into
return: boolean  True on success

readZipInfo($data)   X-Ref
Get the list of files/data from a ZIP archive buffer.

<pre>
KEY: Position in zipfile
VALUES: 'attr'  --  File attributes
'crc'   --  CRC checksum
'csize' --  Compressed file size
'date'  --  File modification time
'name'  --  Filename
'method'--  Compression method
'size'  --  Original file size
'type'  --  File type
</pre>

param: string  $data  The ZIP archive buffer.
return: boolean True on success

getFileData(int $key)   X-Ref
Returns the file data for a file by offset in the ZIP archive

param: integer  $key  The position of the file in the archive.
return: string  Uncompressed file data buffer.

unix2DosTime($unixtime = null)   X-Ref
Converts a UNIX timestamp to a 4-byte DOS date and time format (date in high 2-bytes, time in low 2-bytes allowing magnitude comparison).

param: integer  $unixtime  The current UNIX timestamp.
return: integer  The current date in a 4-byte DOS format.

addToZipFile(array &$file, array &$contents, array &$ctrldir)   X-Ref
Adds a "file" to the ZIP archive.

param: array  $file      File data array to add
param: array  $contents  An array of existing zipped files.
param: array  $ctrldir   An array of central directory information.
return: void

createZipFile(array $contents, array $ctrlDir, string $path)   X-Ref
Creates the ZIP file.

Official ZIP file format: http://www.pkware.com/appnote.txt

param: array   $contents  An array of existing zipped files.
param: array   $ctrlDir   An array of central directory information.
param: string  $path      The path to store the archive.
return: boolean  True if successful

isBelow($destination, $path)   X-Ref
Check if a path is below a given destination path

param: string  $destination  The destination path
param: string  $path         The path to be checked
return: boolean



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer