JDWordpress  v.2014-02-11
Wordpress Plugin for CakePHP
ZipComponent Class Reference

Provides basic zip file functionality to JDWordpress. More...

Inheritance diagram for ZipComponent:

Public Member Functions

 __construct (ComponentCollection $collection, $settings=array())
 Constructor. More...
 
 __get ($function)
 Implements a built-in zip function. More...
 
 addByContent ($localFile, $contents)
 Adds to an open zip file via contents. More...
 
 addDirectory ($directory, $as)
 Adds entire directory to an open zip file. More...
 
 addFile ($file, $localFile=null)
 Adds to a zip file. More...
 
 begin ($path= '', $overwrite=true)
 Starts a access to a zip file. More...
 
 close ()
 Closes a zip file. More...
 
 comment ($mixed= 'archive', $comment)
 Adds a comment to open zip file. More...
 
 delete ($mixed)
 Deletes an entry in an open zip file. More...
 
 end ()
 Closes a zip file. More...
 
 extract ($location, $entries=null)
 Extracts from a zip file. More...
 
 find ($mixed, $options=0)
 Finds an entry in an open zip file. More...
 
 rename ($old, $new=null)
 Renames an entry in the zip file. More...
 
 stats ($mixed)
 Retrieves statistics from an open zip file. More...
 
 undo ($mixed= '*')
 Undo changes to an archive by index(int), name(string), or all ('all' | '*' | blank) More...
 
 unzip ($location, $entries=null)
 Extracts from a zip file. More...
 

Detailed Description

Provides basic zip file functionality to JDWordpress.

Constructor & Destructor Documentation

__construct ( ComponentCollection  $collection,
  $settings = array() 
)

Constructor.

Parameters
ComponentCollection$collectionInherited from super.
array$settingsInherited from super.

Member Function Documentation

__get (   $function)

Implements a built-in zip function.

Parameters
mixed$functionThe function to call.
Returns
mixed.
addFile (   $file,
  $localFile = null 
)

Adds to a zip file.

Parameters
mixed$filefile to be included (full path).
mixed$localFilename of file in zip, if different.
Returns
boolean
begin (   $path = '',
  $overwrite = true 
)

Starts a access to a zip file.

Parameters
mixed$pathLocal path for zip.
boolean$overwriteOverwrite existing file if present?
Returns
boolean
close ( )

Closes a zip file.

Returns
boolean
end ( )

Closes a zip file.

Synonym for close.

Returns
boolean
addByContent (   $localFile,
  $contents 
)

Adds to an open zip file via contents.

Usage:

`$this->Zip->addByContents('myTextFile.txt', 'Test text file');`

Parameters
mixed$localFileLocal path for zip.
mixed$contentsOverwrite existing file if present?
Returns
boolean
addDirectory (   $directory,
  $as 
)

Adds entire directory to an open zip file.

Parameters
mixed$directory
mixed$as
Returns
boolean
undo (   $mixed = '*')

Undo changes to an archive by index(int), name(string), or all ('all' | '*' | blank)

Usage:

$this->Zip->undo(1); $this->Zip->undo('myText.txt'); $this->Zip->undo('*'); $this->Zip->undo('myText.txt, myText1.txt'); $this->Zip->undo(array(1, 'myText.txt'));

Parameters
mixed$mixed
Returns
boolean
rename (   $old,
  $new = null 
)

Renames an entry in the zip file.

Parameters
mixed$old
mixed$new
Returns
boolean
find (   $mixed,
  $options = 0 
)

Finds an entry in an open zip file.

Parameters
mixed$mixed
mixed$optionsFL_NODIR, FL_NOCASE
Returns
mixed index, name, or false
delete (   $mixed)

Deletes an entry in an open zip file.

Parameters
mixed$mixeddelete by index(int), name(string), all ('all' | '*' | blank)
Returns
boolean
comment (   $mixed = 'archive',
  $comment 
)

Adds a comment to open zip file.

Parameters
mixed$mixedcomment by index(int), name(string), all ('all' | '*' | blank)
mixed$comment
Returns
boolean
stats (   $mixed)

Retrieves statistics from an open zip file.

Parameters
mixed$mixedindex(int) or name(string)
Returns
mixed stat
extract (   $location,
  $entries = null 
)

Extracts from a zip file.

Parameters
mixed$locationOutput location
mixed$entriesindex(int) or name(string)
Returns
mixed stat
unzip (   $location,
  $entries = null 
)

Extracts from a zip file.

Parameters
mixed$locationOutput location
mixed$entriesindex(int) or name(string)

The documentation for this class was generated from the following file: