function make($src, $name = "Archive.tgz", $returnFile = true) { $ext = '.' . pathinfo($name, PATHINFO_EXTENSION); foreach ($this->WathArchive as $key => $val) { if (stripos($ext, $key) !== false) { $comp = $val; } } if ($comp == 'zip') { $zip = new zip(); if ($returnFile) { $result = $zip->makeZip($src, $dest); } else { $tmpZip = './' . md5(serialize($src)) . '.zip'; $result = $zip->makeZip($src, $tmpZip); $result = file_get_contents($tmpZip); unlink($tmpZip); } return $result; } elseif (strlen($comp) > 1) { if (count($src) > 1 || is_dir($src[0]) || $comp == 'tar') { $tar = new tar(); $src = $tar->makeTar($src); } if ($comp == 'bz') { $bzip2 = new bzip2(); $src = $bzip2->makeBzip2($src); } elseif ($comp == 'gz') { $gzip = new gzip(); $src = $gzip->makeGzip($src); } if ($returnFile) { file_put_contents($dest, $src); return $dest; } return $src; } else { return 'Specifie a valid format at the end of ' . $name . ' filename ! '; } }