Skip to content

Commit ea0f407

Browse files
author
Sterling Hughes
committed
@ Renamed the ZZiplib extension to the Zip extension, function
@ names have also changed accordingly, functionality, has stayed @ constant. (Sterling)
1 parent 3ceeb1f commit ea0f407

6 files changed

Lines changed: 450 additions & 0 deletions

File tree

‎ext/zip/CREDITS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Zip
2+
Sterling Hughes

‎ext/zip/Makefile.in‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# $Id$
2+
3+
LTLIBRARY_NAME = libzip.la
4+
LTLIBRARY_SOURCES = zip.c
5+
LTLIBRARY_SHARED_NAME = zip.la
6+
LTLIBRARY_SHARED_LIBADD = $(ZIP_SHARED_LIBADD)
7+
8+
include $(top_srcdir)/build/dynlib.mk

‎ext/zip/config.m4‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
dnl $Id$
2+
dnl config.m4 for extension zziplib
3+
4+
PHP_ARG_WITH(zip,whether to include zziplib support,
5+
[ --with-zip[=DIR] Include zip support (requires zziplib >= 0.10.6).
6+
DIR is the zziplib install directory,
7+
default is /usr/local.])
8+
9+
10+
if test "$PHP_ZIP" != "no"; then
11+
PHP_EXTENSION(zip, $ext_shared)
12+
for i in $PHP_ZIP /usr/local /usr ; do
13+
if test -f $i/include/zzlib/zziplib.h; then
14+
ZZIPLIB_DIR=$i
15+
ZZIPLIB_INCDIR=$i/include/zzlib
16+
elif test -f $i/include/zziplib.h; then
17+
ZZIPLIB_DIR=$i
18+
ZZIPLIB_INCDIR=$i/include
19+
fi
20+
done
21+
22+
if test -z "$ZZIPLIB_DIR"; then
23+
AC_MSG_ERROR(Cannot find libzzip)
24+
fi
25+
26+
ZZIPLIB_LIBDIR=$ZZIPLIB_DIR/lib
27+
28+
PHP_TEMP_LDFLAGS(-L$ZZIPLIB_LIBDIR,[
29+
AC_CHECK_LIB(zzip, zzip_open, [AC_DEFINE(HAVE_ZZIPLIB,1,[ ])],
30+
[AC_MSG_ERROR(zziplib module requires zzlib >= 0.10.6.)])
31+
])
32+
33+
PHP_SUBST(ZIP_SHARED_LIBADD)
34+
PHP_ADD_LIBRARY_WITH_PATH(zzip, $ZZIPLIB_LIBDIR, ZIP_SHARED_LIBADD)
35+
36+
PHP_ADD_INCLUDE($ZZIPLIB_INCDIR)
37+
38+
PHP_FOPENCOOKIE
39+
fi

‎ext/zip/php_zip.h‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| PHP version 4.0 |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 1997-2001 The PHP Group |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 2.02 of the PHP license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available at through the world-wide-web at |
10+
| http://www.php.net/license/2_02.txt. |
11+
| If you did not receive a copy of the PHP license and are unable to |
12+
| obtain it through the world-wide-web, please send a note to |
13+
| license@php.net so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
| Authors: Sterling Hughes <sterling@php.net> |
16+
+----------------------------------------------------------------------+
17+
*/
18+
19+
#ifndef PHP_ZIP_H
20+
#define PHP_ZIP_H
21+
22+
#if HAVE_ZZIPLIB
23+
24+
#include <zziplib.h>
25+
26+
extern zend_module_entry zip_module_entry;
27+
#define phpext_zip_ptr &zip_module_entry
28+
29+
#ifdef PHP_WIN32
30+
#define PHP_ZZIPLIB_API __declspec(dllexport)
31+
#else
32+
#define PHP_ZZIPLIB_API
33+
#endif
34+
35+
PHP_MINIT_FUNCTION(zip);
36+
PHP_MINFO_FUNCTION(zip);
37+
38+
PHP_FUNCTION(zip_opendir);
39+
PHP_FUNCTION(zip_readdir);
40+
PHP_FUNCTION(zip_closedir);
41+
PHP_FUNCTION(zip_entry_name);
42+
PHP_FUNCTION(zip_entry_compressedsize);
43+
PHP_FUNCTION(zip_entry_filesize);
44+
PHP_FUNCTION(zip_entry_compressionmethod);
45+
PHP_FUNCTION(zip_open);
46+
PHP_FUNCTION(zip_read);
47+
PHP_FUNCTION(zip_close);
48+
49+
typedef struct {
50+
ZZIP_FILE *fp;
51+
ZZIP_DIRENT dirent;
52+
} php_zzip_dirent;
53+
54+
#else
55+
#define phpext_zziplib_ptr NULL
56+
#endif
57+
58+
#endif /* PHP_ZZIPLIB_H */
59+
60+
61+
/*
62+
* Local variables:
63+
* tab-width: 4
64+
* c-basic-offset: 4
65+
* End:
66+
*/

‎ext/zip/tests/001.phpt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Check for zziplib presence
3+
--SKIPIF--
4+
<?php if (!extension_loaded("zip")) print "skip"; ?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
echo "zip extension is available";
10+
/*
11+
you can add regression tests for your extension here
12+
13+
the output of your test code has to be equal to the
14+
text in the --EXPECT-- section below for the tests
15+
to pass, differences between the output and the
16+
expected text are interpreted as failure
17+
18+
see php4/tests/README for further information on
19+
writing regression tests
20+
*/
21+
?>
22+
--EXPECT--
23+
zip extension is available

0 commit comments

Comments
 (0)