示例#1
0
 public function testZipHasRightReturn()
 {
     $this->assertFalse($this->stub->zip("notAFolder", __DIR__ . "/notAzip"));
     $this->assertTrue($this->stub->zip(__DIR__, __DIR__ . "/test.zip"));
     $this->assertFileExists(__DIR__ . "/test.zip");
     @unlink(__DIR__ . "/test.zip");
 }
 /**
  * Output the content to the standard output
  * 
  * @return void
  */
 static function output($options = array())
 {
     if (self::$_aio) {
         $path = CAppUI::getTmpPath("embed-" . md5(uniqid("", true)));
         if (self::$_aio === "savefile") {
             $str = self::allInOne($path);
             file_put_contents("{$path}/index.html", $str);
             $zip_path = "{$path}.zip";
             CMbPath::zip($path, $zip_path);
             header("Content-Type: application/zip");
             header("Content-Disposition: attachment; filename=\"" . basename($zip_path) . "\";");
             header("Content-Transfer-Encoding: binary");
             header("Content-Length: " . filesize($zip_path));
             readfile($zip_path);
             unlink($zip_path);
             CMbPath::remove($path);
             CApp::rip();
         } else {
             self::allInOne(null, $options);
         }
     } else {
         // Flush zero-ifies ob_get_length
         self::$flushed_output_length += ob_get_length();
         ob_end_flush();
     }
 }