View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Filter_Compress
{zone-data}

{zone-data:proposer-list}
[~thomas]
{zone-data}

{zone-data:liaison}
[~matthew]
{zone-data}

{zone-data:revision}
1.0 - 16 January 2009: Initial Draft
{zone-data}

{zone-data:overview}
Zend_Filter_Compress is an filter extension for Zend_File_Transfer and allows to compress and decompress files.
{zone-data}

{zone-data:references}
* [Zend_File_Transfer|http://framework.zend.com/wiki/display/ZFPROP/Zend_File_Transfer+-+Thomas+Weidner]
* [PHP's compression extensions|http://php.net/manual/en/refs.compression.php]
{zone-data}

{zone-data:requirements}
* This component *will* compress files
* This component *will* decompress files
* This component *will* support Adapters for the handling of different compression formats
* This component *will not* support stream compression/decompression
* This component *will* only support files
{zone-data}

{zone-data:dependencies}
* Zend_Exception
* Zend_Filter
{zone-data}

{zone-data:operation}
The Zend_Filter_Compress extension allows to compress and decompress files by using the filter interface. With this component Zend_File_Transfer and also Zend_Form_Element_File are able to allow compression/decompression of files at upload and download progress.The component is instantiated with a mind-link that ...
It is built upon adapters and can easily be extended. Each adapter supports one PHP extension or compression format.
All known php extensions for compression formats will be supported.
{zone-data}

{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal finished
* Milestone 2: \[DONE\] Proposal accepted
* Milestone 3: \[DONE\] Integration
* Milestone 4: \[DONE\] Unittests
* Milestone 5: \[DONE\] Documentation
* Milestone 6: \[DONE\] Move to core
{zone-data}

{zone-data:class-list}
* Zend_Filter_Compress
* Zend_Filter_Compress_Interface
* Zend_Filter_Compress_Bzip2
* Zend_Filter_Compress_Lzf
* Zend_Filter_Compress_Rar
* Zend_Filter_Compress_Zip
* Zend_Filter_Compress_Zlib
* Zend_Filter_Decompress
{zone-data}

{zone-data:use-cases}
||UC-01||
Manual compression
{code}
$filter = new Zend_Filter_Compress('zip');
$newname = $filter->filter('/path/to/file.exe');
{code}

||UC-02||
Manual decompression
{code}
$filter = new Zend_Filter_Decompress('zip');
$newname = $filter->filter('/path/to/file.exe');
{code}

||UC-03||
Compression and store it under a new filename
{code}
$filter = new Zend_Filter_Decompress(array('format' => 'zip', 'filename' => '/path/newfilename.zip'));
$newname = $filter->filter('/path/to/file.exe');
{code}

||UC-04||
Using Zend_File_Transfer with compression
{code}
$file = new Zend_File_Transfer_Adapter_Http();
$file->addFilter('Compress', 'Zip');
{code}

||UC-05||
Using Zend_Form_Element_File with compression
{code}
$element = new Zend_Form_Element_File('myelement');
$element->addFilter('Compress', 'Zip');
{code}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Filter_Compress_Interface
{
public compress($filename);

public decompress($filename);
}

class Zend_Filter_Compress_Zip implements Zend_Filter_Compress_Interface
{
/**
* Compresses a file with ZIP compression
* @return string
*/
public compress($filename)
{}

/**
* Decompresses a file using ZIP compression
* @return string
*/
public decompress($filename)
{}
}

class Zend_Filter_Compress extends Zend_Filter
{
public filter($value)
{}
}

class Zend_Filter_Decompress extends Zend_Filter
{
public filter($value)
{}
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>