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

Class: PHP_Archive

Source Location: /PHP_Archive-0.12.0/Archive.php

Class Overview


PHP_Archive Class (implements .phar)


Author(s):

Version:

  • $Id$

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 51]

Current file name in the phar
  • Access: protected

Type:   string


[ Top ]

$currentStat =  null

[line 66]

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 134]

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

Type:   array


[ Top ]

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

[line 179]

  • Access: public

Type:   mixed


[ Top ]

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

[line 183]

  • Access: public

Type:   mixed


[ Top ]

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

[line 187]

  • Access: public

Type:   mixed


[ Top ]

$fp =  null

[line 70]

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

Type:   resource|null


[ Top ]

$internalFileLength =  null

[line 56]

Length of current file in the phar
  • Access: protected

Type:   string


[ Top ]

$isDir =  false

[line 61]

true if the current file is an empty directory
  • Access: protected

Type:   string


[ Top ]

$position =  0

[line 74]

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

Type:   int


[ Top ]



Method Detail

APIVersion   [line 1079]

string APIVersion( )

API version of this class
  • Access: public

[ Top ]

dir_closedir   [line 1059]

void dir_closedir( )

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

[ Top ]

dir_opendir   [line 981]

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 1045]

void dir_readdir( )

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

[ Top ]

dir_rewinddir   [line 1069]

void dir_rewinddir( )

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

[ Top ]

extractFile   [line 662]

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 1112]

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 1092]

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 1133]

list getSupportedSignatures( )

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

[ Top ]

initializeStream   [line 752]

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 219]

void introspect( $archive, $dir)

  • Access: public

Parameters:

   $archive   — 
   $dir   — 

[ Top ]

loadPhar   [line 361]

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 391]

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 709]

false|array parseUrl( string $file)

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

Parameters:

string   $file   — 

[ Top ]

selectFile   [line 586]

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 800]

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 846]

void stream_read( int $count)

Read the data - PHP streams API
  • Access: public

Parameters:

int   $count   — 

[ Top ]

stream_seek   [line 868]

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 910]

void stream_stat( )

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

PHP streams API


[ Top ]

stream_tell   [line 899]

void stream_tell( )

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

[ Top ]

url_stat   [line 970]

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 189]

void viewSource( $archive, $file)

  • Access: public

Parameters:

   $archive   — 
   $file   — 

[ Top ]

webFrontController   [line 271]

void webFrontController( $initfile)

  • Access: public

Parameters:

   $initfile   — 

[ Top ]

_stream_stat   [line 920]

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, 06 Jul 2015 08:00:03 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.