modxcms/revolution — pull request #11354 by exside (2014-05-10 01:09:08+00:00)
Title: Refactored and improved xpdozip class

Small improvements of the xpdozip class:

1. just cosmetic, changed $filename to $file, as this variable actually holds the whole path to the file and not just the filename

2. Refactored the constructor that the class can be loaded via $modx->getService() like that:

```
$ziparchive = MODX_ASSETS_PATH . 'somezipfile.zip';
$targetdir = MODX_ASSETS_PATH . 'target/directory/';

$modx->getService('zip', 'compression.xPDOZip', XPDO_CORE_PATH, array('file' => $ziparchive));
// then it could extracted like that
$results = $modx->zip->unpack($targetdir); // the $results variable contains an array of unpacked folders an files (full paths)
$modx->zip->close();
```
the changes look a bit ugly, but as I don't want to break any current implementations, I had to do it like that...if somebody knows a better way, please tell =)

3. Made the unpack() method actually return what it seems to be supposed to return as of @return array An array of results for the operation. This wasn't the case as the ZipArchive method extractTo() returns a boolean and not an array of files/paths, so I added the logic to do that