summaryrefslogtreecommitdiffstats
path: root/system/libraries/Zip.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Zip.php')
-rw-r--r--system/libraries/Zip.php37
1 files changed, 23 insertions, 14 deletions
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 434229471..cee5d8d76 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -2,11 +2,11 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.2.4 or newer
+ * An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014, British Columbia Institute of Technology
+ * Copyright (c) 2014 - 2015, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
- * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/)
+ * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @since Version 1.0.0
@@ -59,35 +59,35 @@ class CI_Zip {
*
* @var string
*/
- public $zipdata = '';
+ public $zipdata = '';
/**
* Zip data for a directory in string form
*
* @var string
*/
- public $directory = '';
+ public $directory = '';
/**
* Number of files/folder in zip file
*
* @var int
*/
- public $entries = 0;
+ public $entries = 0;
/**
* Number of files in zip
*
* @var int
*/
- public $file_num = 0;
+ public $file_num = 0;
/**
* relative offset of local header
*
* @var int
*/
- public $offset = 0;
+ public $offset = 0;
/**
* Reference to time at init
@@ -97,6 +97,15 @@ class CI_Zip {
public $now;
/**
+ * The level of compression
+ *
+ * Ranges from 0 to 9, with 9 being the highest level.
+ *
+ * @var int
+ */
+ public $compression_level = 2;
+
+ /**
* Initialize zip compression class
*
* @return void
@@ -248,7 +257,7 @@ class CI_Zip {
$uncompressed_size = strlen($data);
$crc32 = crc32($data);
- $gzdata = substr(gzcompress($data), 2, -4);
+ $gzdata = substr(gzcompress($data, $this->compression_level), 2, -4);
$compressed_size = strlen($gzdata);
$this->zipdata .=
@@ -464,11 +473,11 @@ class CI_Zip {
*/
public function clear_data()
{
- $this->zipdata = '';
- $this->directory = '';
- $this->entries = 0;
- $this->file_num = 0;
- $this->offset = 0;
+ $this->zipdata = '';
+ $this->directory = '';
+ $this->entries = 0;
+ $this->file_num = 0;
+ $this->offset = 0;
return $this;
}