<?php
/* vim: set ts=4 sw=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Vincent Blavet <vincent@blavet.net> |
// +----------------------------------------------------------------------+
//
// $Id: Zip.php 3076 2006-12-18 08:52:12Z fabien $
// ----- Constants
define( 'ARCHIVE_ZIP_READ_BLOCK_SIZE', 2048 );
// ----- File list separator
define( 'ARCHIVE_ZIP_SEPARATOR', ',' );
// ----- Optional static temporary directory
// By default temporary files are generated in the script current
// path.
// If defined :
// - MUST BE terminated by a '/'.
// - MUST be a valid, already created directory
// Samples :
// define( 'ARCHIVE_ZIP_TEMPORARY_DIR', '/temp/' );
// define( 'ARCHIVE_ZIP_TEMPORARY_DIR', 'C:/Temp/' );
define( 'ARCHIVE_ZIP_TEMPORARY_DIR', '' );
// ----- Error codes
define( 'ARCHIVE_ZIP_ERR_NO_ERROR', 0 );
define( 'ARCHIVE_ZIP_ERR_WRITE_OPEN_FAIL', -1 );
define( 'ARCHIVE_ZIP_ERR_READ_OPEN_FAIL', -2 );
define( 'ARCHIVE_ZIP_ERR_INVALID_PARAMETER', -3 );
define( 'ARCHIVE_ZIP_ERR_MISSING_FILE', -4 );
define( 'ARCHIVE_ZIP_ERR_FILENAME_TOO_LONG', -5 );
define( 'ARCHIVE_ZIP_ERR_INVALID_ZIP', -6 );
define( 'ARCHIVE_ZIP_ERR_BAD_EXTRACTED_FILE', -7 );
define( 'ARCHIVE_ZIP_ERR_DIR_CREATE_FAIL', -8 );
define( 'ARCHIVE_ZIP_ERR_BAD_EXTENSION', -9 );
define( 'ARCHIVE_ZIP_ERR_BAD_FORMAT', -10 );
define( 'ARCHIVE_ZIP_ERR_DELETE_FILE_FAIL', -11 );
define( 'ARCHIVE_ZIP_ERR_RENAME_FILE_FAIL', -12 );
define( 'ARCHIVE_ZIP_ERR_BAD_CHECKSUM', -13 );
define( 'ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
define( 'ARCHIVE_ZIP_ERR_MISSING_OPTION_VALUE', -15 );
define( 'ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE', -16 );
// ----- Warning codes
define( 'ARCHIVE_ZIP_WARN_NO_WARNING', 0 );
define( 'ARCHIVE_ZIP_WARN_FILE_EXIST', 1 );
// ----- Methods parameters
define( 'ARCHIVE_ZIP_PARAM_PATH', 'path' );
define( 'ARCHIVE_ZIP_PARAM_ADD_PATH', 'add_path' );
define( 'ARCHIVE_ZIP_PARAM_REMOVE_PATH', 'remove_path' );
define( 'ARCHIVE_ZIP_PARAM_REMOVE_ALL_PATH', 'remove_all_path' );
define( 'ARCHIVE_ZIP_PARAM_SET_CHMOD', 'set_chmod' );
define( 'ARCHIVE_ZIP_PARAM_EXTRACT_AS_STRING', 'extract_as_string' );
define( 'ARCHIVE_ZIP_PARAM_NO_COMPRESSION', 'no_compression' );
define( 'ARCHIVE_ZIP_PARAM_BY_NAME', 'by_name' );
define( 'ARCHIVE_ZIP_PARAM_BY_INDEX', 'by_index' );
define( 'ARCHIVE_ZIP_PARAM_BY_EREG', 'by_ereg' );
define( 'ARCHIVE_ZIP_PARAM_BY_PREG', 'by_preg' );
define( 'ARCHIVE_ZIP_PARAM_PRE_EXTRACT', 'callback_pre_extract' );
define( 'ARCHIVE_ZIP_PARAM_POST_EXTRACT', 'callback_post_extract' );
define( 'ARCHIVE_ZIP_PARAM_PRE_ADD', 'callback_pre_add' );
define( 'ARCHIVE_ZIP_PARAM_POST_ADD', 'callback_post_add' );
/**
* Class for manipulating zip archive files
*
* A class which provided common methods to manipulate ZIP formatted
* archive files.
* It provides creation, extraction, deletion and add features.
*
* @author Vincent Blavet <vincent@blavet.net>
* @version $Revision: 1.3 $
* @package phing.lib
*/
class Archive_Zip
{
/**
* The filename of the zip archive.
*
* @var string Name of the Zip file
*/
var $_zipname='';
/**
* File descriptor of the opened Zip file.
*
* @var int Internal zip file descriptor
*/
var $_zip_fd=0;
/**
* @var int last error code
*/
var $_error_code=1;
/**
* @var string Last error description
*/
var $_error_string='';
// {{{ constructor
/**
* Archive_Zip Class constructor. This flavour of the constructor only
* declare a new Archive_Zip object, identifying it by the name of the
* zip file.
*
* @param string $p_zipname The name of the zip archive to create
* @access public
*/
function __construct($p_zipname)
{
if (!extension_loaded('zlib')) {
throw new Exception("The extension 'zlib' couldn't be found.\n".
"Please make sure your version of PHP was built ".
"with 'zlib' support.");
}
// ----- Set the attributes
$this->_zipname = $p_zipname;
$this->_zip_fd = 0;
}
// }}}
// {{{ create()
/**
* This method creates a Zip Archive with the filename set with
* the constructor.
* The files and directories indicated in $p_filelist
* are added in the archive.
* When a directory is in the list, the directory and its content is added
* in the archive.
* The methods takes a variable list of parameters in $p_params.
* The supported parameters for this method are :
* 'add_path' : Add a path to the archived files.
* 'remove_path' : Remove the specified 'root' path of the archived files.
* 'remove_all_path' : Remove all the path of the archived files.
* 'no_compression' : The archived files will not be compressed.
*
* @access public
* @param mixed $p_filelist The list of the files or folders to add.
* It can be a string with filenames separated
* by a comma, or an array of filenames.
* @param mixed $p_params An array of variable parameters and values.
* @return mixed An array of file description on success,
* an error code on error
*/
function create($p_filelist, $p_params=0)
{
$this->_errorReset();
// ----- Set default values
if ($p_params === 0) {
$p_params = array();
}
if ($this->_check_parameters($p_params,
array('no_compression' => false,
'add_path' => "",
'remove_path' => "",
'remove_all_path' => false)) != 1) {
return 0;
}
// ----- Look if the $p_filelist is really an array
$p_result_list = array();
if (is_array($p_filelist)) {
$v_result = $this->_create($p_filelist, $p_result_list, $p_params);
}
// ----- Look if the $p_filelist is a string
else if (is_string($p_filelist)) {
// ----- Create a list with the elements from the string
$v_list = explode(ARCHIVE_ZIP_SEPARATOR, $p_filelist);
$v_result = $this->_create($v_list, $p_result_list, $p_params);
}
// ----- Invalid variable
else {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
'Invalid variable type p_filelist');
$v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
}
if ($v_result != 1) {
return 0;
}
return $p_result_list;
}
// }}}
// {{{ add()
/**
* This method add files or directory in an existing Zip Archive.
* If the Zip Archive does not exist it is created.
* The files and directories to add are indicated in $p_filelist.
* When a directory is in the list, the directory and its cont
没有合适的资源?快使用搜索试试~ 我知道了~
symfony_sandbox.tgz
需积分: 0 7 下载量 86 浏览量
2009-08-22
11:10:37
上传
评论
收藏 1.56MB TGZ 举报
温馨提示
共1337个文件
php:749个
dat:251个
tpl:88个
symfony_sandbox.tgz symfony_sandbox.tgz symfony_sandbox.tgz symfony_sandbox.tgz
资源推荐
资源详情
资源评论
收起资源包目录
symfony_sandbox.tgz (1337个子文件)
propel-gen.bat 1KB
symfony.bat 1KB
symfony.bat 1KB
pear-propel-gen.bat 1KB
CHANGELOG 7KB
main.css 7KB
calendar-system.css 6KB
theme.css 6KB
main.css 3KB
screen.css 3KB
input_auto_complete_tag.css 442B
main.css 379B
main.css 379B
ie.css 58B
ko.dat 58KB
en.dat 56KB
it.dat 56KB
zh.dat 56KB
ja.dat 56KB
pt.dat 55KB
fi.dat 54KB
sv.dat 54KB
da.dat 51KB
uk.dat 50KB
bg.dat 48KB
zh_Hant.dat 48KB
el.dat 47KB
fr.dat 46KB
nl.dat 46KB
es.dat 45KB
ru.dat 43KB
nb.dat 43KB
is.dat 41KB
hu.dat 41KB
cs.dat 40KB
de.dat 40KB
tr.dat 39KB
ga.dat 38KB
pl.dat 36KB
sk.dat 35KB
mk.dat 31KB
hr.dat 28KB
mt.dat 27KB
fa.dat 22KB
th.dat 20KB
sr.dat 19KB
ta.dat 17KB
id.dat 17KB
hi.dat 17KB
ar.dat 17KB
he.dat 16KB
mime_types.dat 15KB
eo.dat 14KB
sr_Latn.dat 13KB
ca.dat 13KB
sl.dat 12KB
am.dat 12KB
lt.dat 11KB
lv.dat 11KB
vi.dat 11KB
ro.dat 11KB
et.dat 11KB
hy.dat 10KB
nn.dat 10KB
root.dat 10KB
ms.dat 10KB
kok.dat 9KB
mr.dat 8KB
ur.dat 8KB
bn.dat 7KB
sq.dat 7KB
fa_AF.dat 6KB
af.dat 6KB
fo.dat 6KB
ps.dat 5KB
eu.dat 5KB
so.dat 5KB
sw.dat 4KB
pt_PT.dat 3KB
gu.dat 2KB
kn.dat 2KB
te.dat 2KB
pa.dat 2KB
be.dat 2KB
kk.dat 2KB
ml.dat 2KB
ti_ER.dat 1KB
ti.dat 1KB
or.dat 1KB
kl.dat 1KB
gl.dat 1KB
om.dat 1KB
gv.dat 1KB
ar_SY.dat 1KB
kw.dat 1KB
ar_JO.dat 1KB
cy.dat 1KB
ar_LB.dat 1003B
de_BE.dat 913B
hy_AM_REVISED.dat 837B
共 1337 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
xgbjmxn
- 粉丝: 34
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功