PHP_Archive
[ class tree: PHP_Archive ] [ index: PHP_Archive ] [ all elements ]

Class: PHP_Archive

Source Location: /PHP_Archive-0.11.4/Archive.php

Class Overview


PHP_Archive Class (implements .phar)


Author(s):

Version:

  • $Id: Archive.php,v 1.52 2007/09/01 20:28:14 cellog Exp $

Copyright:

  • Copyright David Shafik and Synaptic Media 2004. All rights reserved.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 27]
PHP_Archive Class (implements .phar)

PHAR files a singular archive from which an entire application can run. To use it, simply package it using {@see PHP_Archive_Creator} and use phar:// URIs to your includes. i.e. require_once 'phar://config.php' will include config.php from the root of the PHAR file.

Gz code borrowed from the excellent File_Archive package by Vincent Lascaux.



[ Top ]


Class Variables

$currentFilename =  null

[line 48]

Current file name in the phar
  • Access: protected

Type:   string


[ Top ]

$currentStat =  null

[line 58]

Current file statistics (size, creation date, etc.)
  • Access: protected

Type:   string


[ Top ]

$defaultmimes = array(
            'aif' => 'audio/x-aiff',
            'aiff' => 'audio/x-aiff',
            'arc' => 'application/octet-stream',
            'arj' => 'application/octet-stream',
            'art' => 'image/x-jg',
            'asf' => 'video/x-ms-asf',
            'asx' => 'video/x-ms-asf',
            'avi' => 'video/avi',
            'bin' => 'application/octet-stream',
            'bm' => 'image/bmp',
            'bmp' => 'image/bmp',
            'bz2' => 'application/x-bzip2',
            'css' => 'text/css',
            'doc' => 'application/msword',
            'dot' => 'application/msword',
            'dv' => 'video/x-dv',
            'dvi' => 'application/x-dvi',
            'eps' => 'application/postscript',
            'exe' => 'application/octet-stream',
            'gif' => 'image/gif',
            'gz' => 'application/x-gzip',
            'gzip' => 'application/x-gzip',
            'htm' => 'text/html',
            'html' => 'text/html',
            'ico' => 'image/x-icon',
            'jpe' => 'image/jpeg',
            'jpg' => 'image/jpeg',
            'jpeg' => 'image/jpeg',
            'js' => 'application/x-javascript',
            'log' => 'text/plain',
            'mid' => 'audio/x-midi',
            'mov' => 'video/quicktime',
            'mp2' => 'audio/mpeg',
            'mp3' => 'audio/mpeg3',
            'mpg' => 'audio/mpeg',
            'pdf' => 'aplication/pdf',
            'png' => 'image/png',
            'rtf' => 'application/rtf',
            'tif' => 'image/tiff',
            'tiff' => 'image/tiff',
            'txt' => 'text/plain',
            'xml' => 'text/xml',
        )

[line 126]

Default MIME types used for the web front controller
  • Access: public

Type:   array


[ Top ]

$defaultphp = array(
        'php' => true
        )

[line 171]

  • Access: public

Type:   mixed


[ Top ]

$defaultphps = array(
        'phps' => true
        )

[line 175]

  • Access: public

Type:   mixed


[ Top ]

$deny = array('/.+\.inc$/')

[line 179]

  • Access: public

Type:   mixed


[ Top ]

$fp =  null

[line 62]

  • Var: Pointer to open .phar
  • Access: protected

Type:   resource|null


[ Top ]

$internalFileLength =  null

[line 53]

Length of current file in the phar
  • Access: protected

Type:   string


[ Top ]

$position =  0

[line 66]

  • Var: Current Position of the pointer
  • Access: protected

Type:   int


[ Top ]



Method Detail

APIVersion   [line 1047]

string APIVersion( )

API version of this class
  • Access: public

[ Top ]

dir_closedir   [line 1027]

void dir_closedir( )

Close a directory handle opened with opendir() - PHP streams API
  • Access: public

[ Top ]

dir_opendir   [line 952]

void dir_opendir( string $path)

Open a directory in the .phar for reading - PHP streams API
  • Access: public

Parameters:

string   $path     directory name

[ Top ]

dir_readdir   [line 1013]

void dir_readdir( )

Read the next directory entry - PHP streams API
  • Access: public

[ Top ]

dir_rewinddir   [line 1037]

void dir_rewinddir( )

Rewind to the first directory entry - PHP streams API
  • Access: public

[ Top ]

extractFile   [line 633]

array|string extractFile( string $path)

Seek to a file within the master archive, and extract its contents
  • Return: an array containing an error message string is returned upon error, otherwise the file contents are returned
  • Access: public

Parameters:

string   $path     

[ Top ]

getFileMetadata   [line 1080]

null|mixed getFileMetadata( string $phar, string $file)

Retrieve File-specific metadata for a Phar archive file
  • Return: The value that was serialized for the Phar archive's metadata
  • Throws: Exception
  • Access: public

Parameters:

string   $phar     full path to Phar archive, or alias
string   $file     relative path to file within Phar archive

[ Top ]

getPharMetadata   [line 1060]

null|mixed getPharMetadata( string $phar)

Retrieve Phar-specific metadata for a Phar archive
  • Return: The value that was serialized for the Phar archive's metadata
  • Throws: Exception
  • Access: public

Parameters:

string   $phar     full path to Phar archive, or alias

[ Top ]

getsupportedsignatures   [line 1101]

list getsupportedsignatures( )

  • Return: of supported signature algorithmns.
  • Access: public

[ Top ]

initializeStream   [line 723]

string initializeStream( string $file)

Locate the .phar archive in the include_path and detect the file to open within the archive.

Possible parameters are phar://pharname.phar/filename_within_phar.ext

  • Return: the filename within the .phar to retrieve
  • Access: public

Parameters:

string   $file     a file within the archive

[ Top ]

introspect   [line 211]

void introspect( $archive, $dir)

  • Access: public

Parameters:

   $archive     
   $dir     

[ Top ]

loadPhar   [line 353]

void loadPhar( string $file, [string $alias = NULL])

Allows loading an external Phar archive without include()ing it
  • Throws: Exception
  • Access: public

Parameters:

string   $file     phar package to load
string   $alias     alias to use

[ Top ]

mapPhar   [line 383]

void mapPhar( [string $alias = NULL], [int $dataoffset = NULL])

Map a full real file path to an alias used to refer to the .phar

This function can only be called from the initialization of the .phar itself. Any attempt to call from outside the .phar or to re-alias the .phar will fail as a security measure.

  • Access: public

Parameters:

string   $alias     
int   $dataoffset     the value of __COMPILER_HALT_OFFSET__

[ Top ]

parseUrl   [line 680]

false|array parseUrl( string $file)

Parse urls like phar:///fullpath/to/my.phar/file.txt
  • Access: protected

Parameters:

string   $file     

[ Top ]

selectFile   [line 578]

void selectFile( string $path, [ $allowdirs = true])

Seek in the master archive to a matching file or directory
  • Access: protected

Parameters:

string   $path     
   $allowdirs     

[ Top ]

stream_open   [line 771]

void stream_open( string $file)

Open the requested file - PHP streams API
  • Access: public

Parameters:

string   $file     String provided by the Stream wrapper

[ Top ]

stream_read   [line 817]

void stream_read( int $count)

Read the data - PHP streams API
  • Access: public

Parameters:

int   $count     

[ Top ]

stream_seek   [line 839]

void stream_seek( int $pos, SEEK_SET|SEEK_CUR|SEEK_END $whence)

For seeking the stream - PHP streams API
  • Access: public

Parameters:

int   $pos     
SEEK_SET|SEEK_CUR|SEEK_END   $whence     

[ Top ]

stream_stat   [line 881]

void stream_stat( )

The result of an fstat call, returns mod time from creation, and file size -

PHP streams API


[ Top ]

stream_tell   [line 870]

void stream_tell( )

The current position in the stream - PHP streams API
  • Access: public

[ Top ]

url_stat   [line 941]

void url_stat( string $url, int $flags)

Stat a closed file or directory - PHP streams API
  • Access: public

Parameters:

string   $url     
int   $flags     

[ Top ]

viewSource   [line 181]

void viewSource( $archive, $file)

  • Access: public

Parameters:

   $archive     
   $file     

[ Top ]

webFrontController   [line 263]

void webFrontController( $initfile)

  • Access: public

Parameters:

   $initfile     

[ Top ]

_stream_stat   [line 891]

void _stream_stat( [string $file = null])

Retrieve statistics on a file or directory within the .phar

Parameters:

string   $file     file/directory to stat

[ Top ]


Documentation generated on Mon, 19 May 2008 11:30:09 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.