Синхронизировал частично с CMS2

This commit is contained in:
origami11 2017-02-09 17:14:11 +03:00
parent 6b412f5d6f
commit f2938b1353
30 changed files with 1447 additions and 1099 deletions

View file

@ -5,21 +5,28 @@
*/
class ZipFile extends ZipArchive
{
private $ignore = array('.', '..');
public function addIgnore($name)
{
$this->ignore [] = $name;
}
private function addDirDo($location, $name)
{
assert(is_string($location) && is_string($name));
$name .= '/';
$location .= '/';
$file = null;
// Read all Files in Dir
$dir = opendir($location);
while (($file = readdir($dir)) !== false)
{
if ($file === '.' || $file === '..') continue;
if (in_array($file, $this->ignore)) continue;
// Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
$call = (is_dir($file)) ? 'addDir' : 'addFile';
$call = (is_dir($location . $file)) ? 'addDir' : 'addFile';
call_user_func(array($this, $call), $location . $file, $name . $file);
}
}