Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
41
core/zipfile.php
Normal file
41
core/zipfile.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue