Moodle  2.2.1
http://www.collinsharper.com
file_archive Class Reference
Inheritance diagram for file_archive:

Public Member Functions

 open ($archivepathname, $mode=file_archive::CREATE, $encoding='utf-8')
 close ()
 get_stream ($index)
 get_info ($index)
 list_files ()
 count ()
 add_file_from_pathname ($localname, $pathname)
 add_file_from_string ($localname, $contents)
 add_directory ($localname)

Data Fields

const OPEN = 1
const CREATE = 2
const OVERWRITE = 4

Protected Member Functions

 mangle_pathname ($localname)
 unmangle_pathname ($localname)

Protected Attributes

 $encoding = 'utf-8'

Detailed Description

Definition at line 38 of file file_archive.php.


Member Function Documentation

add_directory ( localname) [abstract]

Add empty directory into archive

Parameters:
string$local
Returns:
bool success

Reimplemented in zip_archive.

Here is the caller graph for this function:

add_file_from_pathname ( localname,
pathname 
) [abstract]

Add file into archive

Parameters:
string$localnamename of file in archive
string$pathnamelocation of file
Returns:
bool success

Reimplemented in zip_archive.

Here is the caller graph for this function:

add_file_from_string ( localname,
contents 
) [abstract]

Add content of string into archive

Parameters:
string$localnamename of file in archive
string$contents
Returns:
bool success

Reimplemented in zip_archive.

close ( ) [abstract]

Close archive

Returns:
bool success

Reimplemented in zip_archive.

count ( ) [abstract]

Returns number of files in archive

Returns:
int number of files

Reimplemented in zip_archive.

get_info ( index) [abstract]

Returns file information

Parameters:
int$indexof file
Returns:
info object or false if error

Reimplemented in zip_archive.

get_stream ( index) [abstract]

Returns file stream for reading of content

Parameters:
int$indexof file
Returns:
stream or false if error

Reimplemented in zip_archive.

list_files ( ) [abstract]

Returns array of info about all files in archive

Returns:
array of file infos

Reimplemented in zip_archive.

mangle_pathname ( localname) [protected]

Tries to convert $localname into another encoding, please note that it may fail really badly.

Parameters:
string$localnamein utf-8 encoding
Returns:
string

Definition at line 122 of file file_archive.php.

Here is the call graph for this function:

Here is the caller graph for this function:

open ( archivepathname,
mode = file_archive::CREATE,
encoding = 'utf-8' 
) [abstract]

Open or create archive (depending on $mode)

Parameters:
string$archivepathname
int$modeOPEN, CREATE or OVERWRITE constant
string$encodingarchive local paths encoding
Returns:
bool success

Reimplemented in zip_archive.

unmangle_pathname ( localname) [protected]

Tries to convert $localname into utf-8 please note that it may fail really badly. The resulting file name is cleaned.

Parameters:
string$localnamein $this->encoding
Returns:
string in utf-8

Definition at line 167 of file file_archive.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$encoding = 'utf-8' [protected]

Encoding of file names - windows usually expects DOS single-byte charset

Definition at line 50 of file file_archive.php.

const CREATE = 2

Open archive if exists, create if does not.

Definition at line 44 of file file_archive.php.

const OPEN = 1

Open archive if exists, fail if does not exist.

Definition at line 41 of file file_archive.php.

const OVERWRITE = 4

Always create new archive

Definition at line 47 of file file_archive.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations