コード例 #1
0
ファイル: Zip.php プロジェクト: Nnadozieomeonu/lacecart
 /**
  * Instantiate an archive adapter object
  *
  * @param  \Pop\Archive\Archive $archive
  * @return Zip
  */
 public function __construct(\Pop\Archive\Archive $archive)
 {
     if (strpos($archive->getFullpath(), '/.') !== false) {
         $this->workingDir = substr($archive->getFullpath(), 0, strpos($archive->getFullpath(), '/.'));
     } else {
         if (strpos($archive->getFullpath(), '\\.') !== false) {
             $this->workingDir = substr($archive->getFullpath(), 0, strpos($archive->getFullpath(), '\\.'));
         } else {
             $this->workingDir = getcwd();
         }
     }
     if (substr($archive->getFullpath(), 0, 1) != '/' && substr($archive->getFullpath(), 1, 1) != ':') {
         $this->path = $this->workingDir . DIRECTORY_SEPARATOR . $archive->getFullpath();
     } else {
         $this->path = realpath(dirname($archive->getFullpath())) . DIRECTORY_SEPARATOR . $archive->getBasename();
     }
     $this->archive = new \ZipArchive();
 }
コード例 #2
0
ファイル: Rar.php プロジェクト: Nnadozieomeonu/lacecart
 /**
  * Instantiate an archive adapter object
  *
  * @param  \Pop\Archive\Archive $archive
  * @param  string               $password
  * @throws Exception
  * @return Rar
  */
 public function __construct(\Pop\Archive\Archive $archive, $password = null)
 {
     $this->path = $archive->getFullpath();
     $this->password = $password;
     if (file_exists($this->path)) {
         $this->archive = \RarArchive::open($this->path, $this->password);
     } else {
         throw new Exception('Due to licensing restrictions, RAR files cannot be created and can only be extracted.');
     }
 }
コード例 #3
0
ファイル: Tar.php プロジェクト: akinyeleolubodun/PhireCMS2
 /**
  * Method to instantiate an archive adapter object
  *
  * @param  \Pop\Archive\Archive $archive
  * @return \Pop\Archive\Adapter\Tar
  */
 public function __construct(\Pop\Archive\Archive $archive)
 {
     if (stripos($archive->getExt(), 'bz') !== false) {
         $this->compression = 'bz';
     } else {
         if (stripos($archive->getExt(), 'gz') !== false) {
             $this->compression = 'gz';
         }
     }
     $this->path = $archive->getFullpath();
     $this->archive = new \Archive_Tar($this->path);
 }
コード例 #4
0
ファイル: Phar.php プロジェクト: akinyeleolubodun/PhireCMS2
 /**
  * Method to instantiate an archive adapter object
  *
  * @param  \Pop\Archive\Archive $archive
  * @return \Pop\Archive\Adapter\Phar
  */
 public function __construct(\Pop\Archive\Archive $archive)
 {
     $this->path = $archive->getFullpath();
     $this->archive = new \Phar($this->path);
 }