Переделка для composer autoload

This commit is contained in:
origami11 2017-02-09 14:57:40 +03:00
parent ad69746347
commit b5641db607
100 changed files with 14 additions and 325 deletions

34
src/zipfile.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/**
* Расширение класса ZipArchive с возможность архивирования директории
*/
class ZipFile extends ZipArchive
{
private function addDirDo($location, $name)
{
assert(is_string($location) && is_string($name));
$name .= '/';
$location .= '/';
// Read all Files in Dir
$dir = opendir($location);
while (($file = readdir($dir)) !== false)
{
if ($file === '.' || $file === '..') continue;
// Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
$call = (is_dir($file)) ? 'addDir' : 'addFile';
call_user_func(array($this, $call), $location . $file, $name . $file);
}
}
public function addDir($location, $name)
{
assert(is_string($location) && is_string($name));
$this->addEmptyDir($name);
$this->addDirDo($location, $name);
}
}