inline_delimiter(operator(\)) operator(||) operator(!)constant(UNLOCK)operator(\)) predefined(die)operator(()operator(\))operator(;) comment(// Load the parent archive class) predefined(require_once)operator(()constant(ROOT_PATH)operator(.)stringoperator(\))operator(;) comment(/** * Zip class * * @author Manni * @copyright Copyright (c\) 2006, Manni * @version 1.0 * @link http://www.pkware.com/business_and_developers/developer/popups/appnote.txt * @link http://mannithedark.is-a-geek.net/ * @since 1.0 * @package fnord.bb * @subpackage archive */) reserved(class) class(Zip) reserved(extends) constant(Archive) operator({) comment(/** * Outputs the zip file * * This function creates the zip file with the dirs and files given. * If the optional parameter $file is given, the zip file is will be * saved at that location. Otherwise the function returns the zip file's content. * * @access public * * @link http://www.pkware.com/business_and_developers/developer/popups/appnote.txt * @param string $filename The path where the zip file will be saved * * @return bool|string Returns either true if the fil is sucessfully created or the content of the zip file */) reserved(function) function(out)operator(()local_variable($filename) operator(=) pre_constant(false)operator(\)) operator({) comment(// Empty output) local_variable($file_data) operator(=) predefined(array)operator(()operator(\))operator(;) comment(// Data of the file part) local_variable($cd_data) operator(=) predefined(array)operator(()operator(\))operator(;) comment(// Data of the central directory) comment(// Sort dirs and files by path length) predefined(uksort)operator(()local_variable($this)operator(->)ident(dirs)operator(,) stringoperator(\))operator(;) predefined(uksort)operator(()local_variable($this)operator(->)ident(files)operator(,) stringoperator(\))operator(;) comment(// Handle dirs) reserved(foreach)operator(()local_variable($this)operator(->)ident(dirs) reserved(as) local_variable($dir)operator(\)) operator({) local_variable($dir) operator(.=) stringoperator(;) comment(// File part) comment(// Reset dir data) local_variable($dir_data) operator(=) stringoperator(;) comment(// Local file header) local_variable($dir_data) operator(.=) stringoperator(;) comment(// Local file header signature) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(10)operator(\))operator(;) comment(// Version needed to extract) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// General purpose bit flag) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Compression method) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file time) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file date) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// crc-32) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Compressed size) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Uncompressed size) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($dir)operator(\))operator(\))operator(;) comment(// File name length) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Extra field length) local_variable($dir_data) operator(.=) local_variable($dir)operator(;) comment(// File name) local_variable($dir_data) operator(.=) stringoperator(;) comment(// Extra field (is empty\)) comment(// File data) local_variable($dir_data) operator(.=) stringoperator(;) comment(// Dirs have no file data) comment(// Data descriptor) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// crc-32) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Compressed size) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Uncompressed size) comment(// Save current offset) local_variable($offset) operator(=) predefined(strlen)operator(()predefined(implode)operator(()stringoperator(,) local_variable($file_data)operator(\))operator(\))operator(;) comment(// Append dir data to the file part) local_variable($file_data)operator([)operator(]) operator(=) local_variable($dir_data)operator(;) comment(// Central directory) comment(// Reset dir data) local_variable($dir_data) operator(=) stringoperator(;) comment(// File header) local_variable($dir_data) operator(.=) stringoperator(;) comment(// Local file header signature) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Version made by) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(10)operator(\))operator(;) comment(// Version needed to extract) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// General purpose bit flag) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Compression method) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file time) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file date) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// crc-32) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Compressed size) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Uncompressed size) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($dir)operator(\))operator(\))operator(;) comment(// File name length) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Extra field length) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// File comment length) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Disk number start) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Internal file attributes) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) integer(16)operator(\))operator(;) comment(// External file attributes) local_variable($dir_data) operator(.=) predefined(pack)operator(()stringoperator(,) local_variable($offset)operator(\))operator(;) comment(// Relative offset of local header) local_variable($dir_data) operator(.=) local_variable($dir)operator(;) comment(// File name) local_variable($dir_data) operator(.=) stringoperator(;) comment(// Extra field (is empty\)) local_variable($dir_data) operator(.=) stringoperator(;) comment(// File comment (is empty\)) comment(/* // Data descriptor $dir_data .= pack("V", 0\); // crc-32 $dir_data .= pack("V", 0\); // Compressed size $dir_data .= pack("V", 0\); // Uncompressed size */) comment(// Append dir data to the central directory data) local_variable($cd_data)operator([)operator(]) operator(=) local_variable($dir_data)operator(;) operator(}) comment(// Handle files) reserved(foreach)operator(()local_variable($this)operator(->)ident(files) reserved(as) local_variable($name) operator(=>) local_variable($file)operator(\)) operator({) comment(// Get values) local_variable($content) operator(=) local_variable($file)operator([)integer(0)operator(])operator(;) comment(// File part) comment(// Reset file data) local_variable($fd) operator(=) stringoperator(;) comment(// Detect possible compressions) comment(// Use deflate) reserved(if)operator(()predefined(function_exists)operator(()stringoperator(\))operator(\)) operator({) local_variable($method) operator(=) integer(8)operator(;) comment(// Compress file content) local_variable($compressed_data) operator(=) predefined(gzdeflate)operator(()local_variable($content)operator(\))operator(;) comment(// Use bzip2) operator(}) reserved(elseif)operator(()predefined(function_exists)operator(()stringoperator(\))operator(\)) operator({) local_variable($method) operator(=) integer(12)operator(;) comment(// Compress file content) local_variable($compressed_data) operator(=) predefined(bzcompress)operator(()local_variable($content)operator(\))operator(;) comment(// No compression) operator(}) reserved(else) operator({) local_variable($method) operator(=) integer(0)operator(;) comment(// Do not compress the content :P) local_variable($compressed_data) operator(=) local_variable($content)operator(;) operator(}) comment(// Local file header) local_variable($fd) operator(.=) stringoperator(;) comment(// Local file header signature) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(20)operator(\))operator(;) comment(// Version needed to extract) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// General purpose bit flag) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) local_variable($method)operator(\))operator(;) comment(// Compression method) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file time) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file date) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(crc32)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// crc-32) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($compressed_data)operator(\))operator(\))operator(;) comment(// Compressed size) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// Uncompressed size) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($name)operator(\))operator(\))operator(;) comment(// File name length) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Extra field length) local_variable($fd) operator(.=) local_variable($name)operator(;) comment(// File name) local_variable($fd) operator(.=) stringoperator(;) comment(// Extra field (is empty\)) comment(// File data) local_variable($fd) operator(.=) local_variable($compressed_data)operator(;) comment(// Data descriptor) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(crc32)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// crc-32) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($compressed_data)operator(\))operator(\))operator(;) comment(// Compressed size) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// Uncompressed size) comment(// Save current offset) local_variable($offset) operator(=) predefined(strlen)operator(()predefined(implode)operator(()stringoperator(,) local_variable($file_data)operator(\))operator(\))operator(;) comment(// Append file data to the file part) local_variable($file_data)operator([)operator(]) operator(=) local_variable($fd)operator(;) comment(// Central directory) comment(// Reset file data) local_variable($fd) operator(=) stringoperator(;) comment(// File header) local_variable($fd) operator(.=) stringoperator(;) comment(// Local file header signature) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Version made by) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(20)operator(\))operator(;) comment(// Version needed to extract) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// General purpose bit flag) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) local_variable($method)operator(\))operator(;) comment(// Compression method) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file time) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Last mod file date) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(crc32)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// crc-32) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($compressed_data)operator(\))operator(\))operator(;) comment(// Compressed size) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($content)operator(\))operator(\))operator(;) comment(// Uncompressed size) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($name)operator(\))operator(\))operator(;) comment(// File name length) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Extra field length) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// File comment length) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Disk number start) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Internal file attributes) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(32)operator(\))operator(;) comment(// External file attributes) local_variable($fd) operator(.=) predefined(pack)operator(()stringoperator(,) local_variable($offset)operator(\))operator(;) comment(// Relative offset of local header) local_variable($fd) operator(.=) local_variable($name)operator(;) comment(// File name) local_variable($fd) operator(.=) stringoperator(;) comment(// Extra field (is empty\)) local_variable($fd) operator(.=) stringoperator(;) comment(// File comment (is empty\)) comment(/* // Data descriptor $fd .= pack("V", crc32($content\)\); // crc-32 $fd .= pack("V", strlen($compressed_data\)\); // Compressed size $fd .= pack("V", strlen($content\)\); // Uncompressed size */) comment(// Append file data to the central directory data) local_variable($cd_data)operator([)operator(]) operator(=) local_variable($fd)operator(;) operator(}) comment(// Digital signature) local_variable($digital_signature) operator(=) stringoperator(;) local_variable($digital_signature) operator(.=) stringoperator(;) comment(// Header signature) local_variable($digital_signature) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Size of data) local_variable($digital_signature) operator(.=) stringoperator(;) comment(// Signature data (is empty\)) local_variable($tmp_file_data) operator(=) predefined(implode)operator(()stringoperator(,) local_variable($file_data)operator(\))operator(;) comment(// File data) local_variable($tmp_cd_data) operator(=) predefined(implode)operator(()stringoperator(,) local_variable($cd_data)operator(\))operator(.) comment(// Central directory) local_variable($digital_signature)operator(;) comment(// Digital signature) comment(// End of central directory) local_variable($eof_cd) operator(=) stringoperator(;) local_variable($eof_cd) operator(.=) stringoperator(;) comment(// End of central dir signature) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Number of this disk) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// Number of the disk with the start of the central directory) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(count)operator(()local_variable($cd_data)operator(\))operator(\))operator(;) comment(// Total number of entries in the central directory on this disk) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(count)operator(()local_variable($cd_data)operator(\))operator(\))operator(;) comment(// Total number of entries in the central directory) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($tmp_cd_data)operator(\))operator(\))operator(;) comment(// Size of the central directory) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) predefined(strlen)operator(()local_variable($tmp_file_data)operator(\))operator(\))operator(;) comment(// Offset of start of central directory with respect to the starting disk number) local_variable($eof_cd) operator(.=) predefined(pack)operator(()stringoperator(,) integer(0)operator(\))operator(;) comment(// .ZIP file comment length) local_variable($eof_cd) operator(.=) stringoperator(;) comment(// .ZIP file comment (is empty\)) comment(// Content of the zip file) local_variable($data) operator(=) local_variable($tmp_file_data)operator(.) comment(// $extra_data_record.) local_variable($tmp_cd_data)operator(.) local_variable($eof_cd)operator(;) comment(// Return content?) reserved(if)operator(()operator(!)local_variable($filename)operator(\)) reserved(return) local_variable($data)operator(;) comment(// Write to file) reserved(return) predefined(file_put_contents)operator(()local_variable($filename)operator(,) local_variable($data)operator(\))operator(;) operator(}) comment(/** * Load a zip file * * This function loads the files and dirs from a zip file from the harddrive. * * @access public * * @param string $file The path to the zip file * @param bool $reset Reset the files and dirs before adding the zip file's content? * * @return bool Returns true if the file was loaded sucessfully */) reserved(function) function(load_file)operator(()local_variable($file)operator(,) local_variable($reset) operator(=) pre_constant(true)operator(\)) operator({) comment(// Check whether the file exists) reserved(if)operator(()operator(!)predefined(file_exists)operator(()local_variable($file)operator(\))operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Load the files content) local_variable($content) operator(=) exception(@)predefined(file_get_contents)operator(()local_variable($file)operator(\))operator(;) comment(// Return false if the file cannot be opened) reserved(if)operator(()operator(!)local_variable($content)operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Read the zip) reserved(return) local_variable($this)operator(->)ident(load_string)operator(()local_variable($content)operator(,) local_variable($reset)operator(\))operator(;) operator(}) comment(/** * Load a zip string * * This function loads the files and dirs from a string * * @access public * * @param string $string The string the zip is generated from * @param bool $reset Reset the files and dirs before adding the zip file's content? * * @return bool Returns true if the string was loaded sucessfully */) reserved(function) function(load_string)operator(()local_variable($string)operator(,) local_variable($reset) operator(=) pre_constant(true)operator(\)) operator({) comment(// Reset the zip?) reserved(if)operator(()local_variable($reset)operator(\)) operator({) local_variable($this)operator(->)ident(dirs) operator(=) predefined(array)operator(()operator(\))operator(;) local_variable($this)operator(->)ident(files) operator(=) predefined(array)operator(()operator(\))operator(;) operator(}) comment(// Get the starting position of the end of central directory record) local_variable($start) operator(=) predefined(strpos)operator(()local_variable($string)operator(,) stringoperator(\))operator(;) comment(// Error) reserved(if)operator(()local_variable($start) operator(===) pre_constant(false)operator(\)) predefined(die)operator(()stringoperator(\))operator(;) comment(// Get the ecdr) local_variable($eof_cd) operator(=) predefined(substr)operator(()local_variable($string)operator(,) local_variable($start)operator(+)integer(4)operator(,) integer(18)operator(\))operator(;) comment(// Unpack the ecdr infos) local_variable($eof_cd) operator(=) predefined(unpack)operator(()stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(,) local_variable($eof_cd)operator(\))operator(;) comment(// Do not allow multi disc zips) reserved(if)operator(()local_variable($eof_cd)operator([)stringoperator(]) operator(!=) integer(0)operator(\)) predefined(die)operator(()stringoperator(\))operator(;) comment(// Save the interesting values) local_variable($cd_entries) operator(=) local_variable($eof_cd)operator([)stringoperator(])operator(;) local_variable($cd_size) operator(=) local_variable($eof_cd)operator([)stringoperator(])operator(;) local_variable($cd_offset) operator(=) local_variable($eof_cd)operator([)stringoperator(])operator(;) comment(// Get the central directory record) local_variable($cdr) operator(=) predefined(substr)operator(()local_variable($string)operator(,) local_variable($cd_offset)operator(,) local_variable($cd_size)operator(\))operator(;) comment(// Reset the position and the list of the entries) local_variable($pos) operator(=) integer(0)operator(;) local_variable($entries) operator(=) predefined(array)operator(()operator(\))operator(;) comment(// Handle cdr) reserved(while)operator(()local_variable($pos) operator(<) predefined(strlen)operator(()local_variable($cdr)operator(\))operator(\)) operator({) comment(// Check header signature) comment(// Digital signature) reserved(if)operator(()predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos)operator(,) integer(4)operator(\)) operator(==) stringoperator(\)) operator({) comment(// Get digital signature size) local_variable($tmp_info) operator(=) predefined(unpack)operator(()stringoperator(,) predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos) operator(+) integer(4)operator(,) integer(2)operator(\))operator(\))operator(;) comment(// Read out the digital signature) local_variable($digital_sig) operator(=) predefined(substr)operator(()local_variable($header)operator(,) local_variable($pos) operator(+) integer(6)operator(,) local_variable($tmp_info)operator([)stringoperator(])operator(\))operator(;) reserved(break)operator(;) operator(}) comment(// Get file header) local_variable($header) operator(=) predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos)operator(,) integer(46)operator(\))operator(;) comment(// Unpack the header information) local_variable($header_info) operator(=) exception(@)predefined(unpack)operator(()stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(,) local_variable($header)operator(\))operator(;) comment(// Valid header?) reserved(if)operator(()local_variable($header_info)operator([)stringoperator(]) operator(!=) integer(33639248)operator(\)) reserved(return) pre_constant(false)operator(;) comment(// New position) local_variable($pos) operator(+=) integer(46)operator(;) comment(// Read out the file name) local_variable($header_info)operator([)stringoperator(]) operator(=) predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos)operator(,) local_variable($header_info)operator([)stringoperator(])operator(\))operator(;) comment(// New position) local_variable($pos) operator(+=) local_variable($header_info)operator([)stringoperator(])operator(;) comment(// Read out the extra stuff) local_variable($header_info)operator([)stringoperator(]) operator(=) predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos)operator(,) local_variable($header_info)operator([)stringoperator(])operator(\))operator(;) comment(// New position) local_variable($pos) operator(+=) local_variable($header_info)operator([)stringoperator(])operator(;) comment(// Read out the comment) local_variable($header_info)operator([)stringoperator(]) operator(=) predefined(substr)operator(()local_variable($cdr)operator(,) local_variable($pos)operator(,) local_variable($header_info)operator([)stringoperator(])operator(\))operator(;) comment(// New position) local_variable($pos) operator(+=) local_variable($header_info)operator([)stringoperator(])operator(;) comment(// Append this file/dir to the entry list) local_variable($entries)operator([)operator(]) operator(=) local_variable($header_info)operator(;) operator(}) comment(// Check whether all entries where read sucessfully) reserved(if)operator(()predefined(count)operator(()local_variable($entries)operator(\)) operator(!=) local_variable($cd_entries)operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Handle files/dirs) reserved(foreach)operator(()local_variable($entries) reserved(as) local_variable($entry)operator(\)) operator({) comment(// Is a dir?) reserved(if)operator(()local_variable($entry)operator([)stringoperator(]) operator(&) integer(16)operator(\)) operator({) local_variable($this)operator(->)ident(add_dir)operator(()local_variable($entry)operator([)stringoperator(])operator(\))operator(;) reserved(continue)operator(;) operator(}) comment(// Get local file header) local_variable($header) operator(=) predefined(substr)operator(()local_variable($string)operator(,) local_variable($entry)operator([)stringoperator(])operator(,) integer(30)operator(\))operator(;) comment(// Unpack the header information) local_variable($header_info) operator(=) exception(@)predefined(unpack)operator(()stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(.) stringoperator(,) local_variable($header)operator(\))operator(;) comment(// Valid header?) reserved(if)operator(()local_variable($header_info)operator([)stringoperator(]) operator(!=) integer(67324752)operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Get content start position) local_variable($start) operator(=) local_variable($entry)operator([)stringoperator(]) operator(+) integer(30) operator(+) local_variable($header_info)operator([)stringoperator(]) operator(+) local_variable($header_info)operator([)stringoperator(])operator(;) comment(// Get the compressed data) local_variable($data) operator(=) predefined(substr)operator(()local_variable($string)operator(,) local_variable($start)operator(,) local_variable($header_info)operator([)stringoperator(])operator(\))operator(;) comment(// Detect compression type) reserved(switch)operator(()local_variable($header_info)operator([)stringoperator(])operator(\)) operator({) comment(// No compression) reserved(case) integer(0)operator(:) comment(// Ne decompression needed) local_variable($content) operator(=) local_variable($data)operator(;) reserved(break)operator(;) comment(// Gzip) reserved(case) integer(8)operator(:) reserved(if)operator(()operator(!)predefined(function_exists)operator(()stringoperator(\))operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Uncompress data) local_variable($content) operator(=) predefined(gzinflate)operator(()local_variable($data)operator(\))operator(;) reserved(break)operator(;) comment(// Bzip2) reserved(case) integer(12)operator(:) reserved(if)operator(()operator(!)predefined(function_exists)operator(()stringoperator(\))operator(\)) reserved(return) pre_constant(false)operator(;) comment(// Decompress data) local_variable($content) operator(=) predefined(bzdecompress)operator(()local_variable($data)operator(\))operator(;) reserved(break)operator(;) comment(// Compression not supported -> error) reserved(default)operator(:) reserved(return) pre_constant(false)operator(;) operator(}) comment(// Try to add file) reserved(if)operator(()operator(!)local_variable($this)operator(->)ident(add_file)operator(()local_variable($entry)operator([)stringoperator(])operator(,) local_variable($content)operator(\))operator(\)) reserved(return) pre_constant(false)operator(;) operator(}) reserved(return) pre_constant(true)operator(;) operator(}) operator(}) reserved(function) operator(&)function(byref)operator(()operator(\)) operator({) local_variable($x) operator(=) predefined(array)operator(()operator(\))operator(;) reserved(return) local_variable($x)operator(;) operator(}) inline_delimiter(?>)