当前位置: 首页>>代码示例>>PHP>>正文


PHP Archive::zipDir方法代码示例

本文整理汇总了PHP中Archive::zipDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Archive::zipDir方法的具体用法?PHP Archive::zipDir怎么用?PHP Archive::zipDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Archive的用法示例。


在下文中一共展示了Archive::zipDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init($obj)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "init");
     //----------------------------------------------------------
     if (!is_null($obj)) {
         if (isset($obj['zip'])) {
             $getFile = GetTable::go("files", array("id" => $obj['zip']));
             //------------------------------------------------------
             if (!$getFile['bool']) {
                 return $getFile;
             }
             if (sizeof($getFile['result']) > 0) {
                 //--------------------------------------------------
                 $projectName = $obj['project_name'];
                 $hash = $getFile['result'][0]['hash'];
                 $dir_relative = GlobalMas::$filesPath_relative . $hash . "/";
                 $dir = GlobalMas::$filesPath_absolute . $hash . "/";
                 $zip_path = $dir . $getFile['result'][0]['name'];
                 $savePath = dirname($zip_path) . "/compile/" . $projectName . "/";
                 //-----------------------------------------------------
                 Archive::extract($zip_path, $this->extractTo = dirname($zip_path) . "/" . FileFolder::getFileName($zip_path));
                 //-----------------------------------------------------
                 //if (isset($obj['take_file_name']) && $obj['take_file_name'] == "true") $projectName = FileFolder::getFileName($zip_path);
                 //-----------------------------------------------------
                 $url = GenFun::get_full_url(dirname($zip_path) . "/" . rawurlencode(FileFolder::getFileName($zip_path)) . "/");
                 //-----------------------------------------------------
                 $bool = $this->htmlExist_CHK($this->extractTo);
             }
         } else {
             if (isset($obj['url']) || is_string($obj)) {
                 $url = isset($obj['url']) ? $obj['url'] : $obj;
                 $bool = $this->htmlExist_CHK($url_local = GenFun::get_local_url($url));
                 //------------------------------------------------------
                 $output = CurlUtil::go(array("url" => $url));
                 $projectName = $this->getTitle($output);
                 //------------------------------------------------------
                 if (is_null($projectName)) {
                     $projectName = date("YmdHis");
                     $hash = alphaID(strtotime($projectName));
                     $projectName = "untitled_" . $projectName;
                 }
                 //------------------------------------------------------
                 $savePath_relative = $hash . "/" . "compile/" . $projectName . "/";
                 $savePath = GlobalMas::$filesPath_absolute . $savePath_relative;
                 /*if (isset($obj['take_file_name']) && $obj['take_file_name'] == "true")*/
                 $useTitle = true;
             } else {
                 $chk = array();
                 $chk['bool'] = false;
                 $chk['error'] = true;
                 $chk['message'] = $this->notifications_CFG(["message" => "Url could not be obtained!!!"]);
                 die(json_encode($chk));
             }
         }
         //---------------------------------------------------------
         $compiler = $this->compile_CFG($url, $projectName, $savePath);
         //---------------------------------------------------------
         if (!is_null($compiler->error)) {
             return $compiler->error;
         }
         //---------------------------------------------------------
         //$chk['bool'] = true;
         //	$chk['compiler'] = $compiler;
         $notifications = $compiler->compilerGlobal->notifications;
         //---------------------------------------------------------
         /*if (sizeof($notifications) > 0) {
         		   $chk = $this->deleteFile($getFile['result'][0]['id'], true);
         			$chk['message'] = $this->notifications_CFG($notifications);
         			$chk['bool'] = false;
         			$chk['error'] = true;
         			return $chk;
         		}*/
         //---------------------------------------------------------
         $new_zip_path = Archive::zipDir($compiler->compilePath);
         //---------------------------------------------------------
         $prop = array();
         $prop['hash'] = "{hash}";
         $prop['url'] = $url;
         $prop['name'] = $projectName;
         $prop['dir'] = $savePath_relative;
         $prop["filesize"] = FileFolder::getFileSize($new_zip_path);
         if (isset($obj['zip'])) {
             $prop['files_id'] = $obj['zip'];
         }
         //---------------------------------------------------------
         $chk = InsertINTO::go("compiles", $prop);
         //---------------------------------------------------------
         $chk['download_link'] = GenFun::get_full_url(Import::$uber_src_path . "server/werm/services/Download.php") . "?url=" . GenFun::get_full_url($new_zip_path);
         $chk["filesize"] = $prop["filesize"];
         $chk["url"] = $url;
         //---------------------------------------------------------
         //$chk['project_location'] = GenFun::get_full_url($compiler->compilePath);
     }
     return $chk;
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:98,代码来源:CompileUpload.php

示例2: __construct

 function __construct($obj)
 {
     //-----------------------------------------------------
     SetPublicProp::go($this, $obj);
     //-----------------------------------------------------
     $this->compilePath = $this->compilerGlobal->compilePath . $this->save_path;
     $this->compilerGlobal->compileType = $this->compileType;
     //-----------------------------------------------------
     if ($this->insideCURL) {
         $this->complete();
     } else {
         if (!$this->raw) {
             $prop = array("output" => $this->output, "minify" => $this->minify, "forceDownload" => $this->forceDownload, "compilerGlobal" => $this->compilerGlobal, "imagesProp" => $this->imagesProp, "compilePath" => $this->compilePath, "compileType" => $this->compileType);
             //---------------------------------------------
             $this->css = new Compile_CSS(ArrayUtil::array_replace_recursive($prop, $this->cssProp));
             $this->output_updated = $this->css->output_updated;
             //---------------------------------------------
             $prop['output'] = $this->output_updated;
             $this->js = new Compile_JS(ArrayUtil::array_replace_recursive($prop, $this->jsProp));
             $this->output_updated = $this->js->output_updated;
             //---------------------------------------------
             $prop['output'] = $this->output_updated;
             $this->tmpl = new Compile_TMPL(ArrayUtil::array_replace_recursive($prop, $this->tmplProp));
             $this->output_updated = $this->tmpl->output_updated;
             //-----------------------------------------------------
             $prop = array("src_content" => $this->output_updated, "forceDownload" => $this->forceDownload, "compilerGlobal" => $this->compilerGlobal, "compilePath" => $this->compilePath);
             $this->output_images = new Compile_Images($prop);
             $this->output_images->init($this->imagesProp);
             $this->output_updated = $this->output_images->src_content_updated;
             //---------------------------------------------
             $this->css->output_updated = $this->output_updated;
             $this->css->compile();
             $this->output_updated = $this->css->output_updated;
             //---------------------------------------------
             $this->js->output_updated = $this->output_updated;
             $this->js->compile();
             $this->output_updated = $this->js->output_updated;
             //---------------------------------------------
             $this->tmpl->output_updated = $this->output_updated;
             $this->tmpl->compile();
             $this->output_updated = $this->tmpl->output_updated;
             //---------------------------------------------
         }
         $this->copy_CFG();
     }
     //$this->compiler->getFiles($this->output, "");
     //-----------------------------------------------------
     $this->output_updated = Compiler::markUp_CHK($this->output_updated);
     //-----------------------------------------------------
     //if ($this->compileType == "inject") $this->output_updated = str_replace("<head>","<head>".PHP_EOL.$this->mergedCode.PHP_EOL, $this->output_updated);
     //-----------------------------------------------------
     /*if ($this->compileType != "inject")*/
     $this->output_updated = str_replace("<head>", "<head>" . PHP_EOL . $this->css->extLinks . PHP_EOL, $this->output_updated);
     //-----------------------------------------------------
     $this->output_updated = str_replace("<head>", "<head>" . PHP_EOL . $this->js->extLinks . PHP_EOL, $this->output_updated);
     //-----------------------------------------------------
     $this->clean_output();
     //-----------------------------------------------------
     $this->output_updated = str_replace("<head>", '<head><meta charset="utf-8">', $this->output_updated);
     //-----------------------------------------------------
     if (is_array($this->outputContent)) {
         FileFolder::file_put_contents($this->compilePath . $this->outputContent['saveas'], $this->output_updated);
     }
     //-----------------------------------------------------
     $this->output_images->compile();
     //-----------------------------------------------------
     Archive::zipDir($this->compilePath);
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:68,代码来源:Compile.php


注:本文中的Archive::zipDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。