41 lines
No EOL
1 KiB
PHP
41 lines
No EOL
1 KiB
PHP
<?php
|
|
|
|
/*.
|
|
require_module 'standard';
|
|
require_module 'zip';
|
|
.*/
|
|
|
|
/**
|
|
* Ðàñøèðåíèå êëàññà ZipArchive ñ âîçìîæíîñòü àðõèâèðîâàíèÿ äèðåêòîðèè
|
|
*/
|
|
class ZipFile extends ZipArchive
|
|
{
|
|
private function addDirDo(/*. string.*/ $location, /*. string .*/ $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(/*. string.*/ $location, /*. string .*/ $name)
|
|
{
|
|
assert(is_string($location) && is_string($name));
|
|
|
|
$this->addEmptyDir($name);
|
|
$this->addDirDo($location, $name);
|
|
}
|
|
}
|
|
|
|
?>
|