]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_5_3'.
authorSVN Migration <svn@php.net>
Wed, 26 Sep 2007 15:44:16 +0000 (15:44 +0000)
committerSVN Migration <svn@php.net>
Wed, 26 Sep 2007 15:44:16 +0000 (15:44 +0000)
18 files changed:
ext/enchant/CREDITS [new file with mode: 0644]
ext/enchant/config.m4 [new file with mode: 0755]
ext/enchant/docs/examples/example1.php [new file with mode: 0644]
ext/enchant/tests/broker_describe.phpt [new file with mode: 0644]
ext/enchant/tests/broker_free.phpt [new file with mode: 0644]
ext/enchant/tests/broker_init.phpt [new file with mode: 0644]
ext/enchant/tests/broker_request_dict.phpt [new file with mode: 0644]
ext/enchant/tests/hindi_correct.txt [new file with mode: 0644]
ext/enchant/tests/hindi_incorrect.txt [new file with mode: 0644]
ext/fileinfo/EXPERIMENTAL [new file with mode: 0644]
ext/fileinfo/config.w32 [new file with mode: 0644]
ext/fileinfo/fileinfo.php [new file with mode: 0644]
ext/fileinfo/package.xml [new file with mode: 0644]
ext/phar/build_precommand.php [new file with mode: 0755]
ext/phar/phar/directorygraphiterator.inc [new file with mode: 0755]
ext/phar/phar/directorytreeiterator.inc [new file with mode: 0755]
ext/phar/phar/invertedregexiterator.inc [new file with mode: 0755]
ext/phar/phar/phar.inc [new file with mode: 0755]

diff --git a/ext/enchant/CREDITS b/ext/enchant/CREDITS
new file mode 100644 (file)
index 0000000..481febb
--- /dev/null
@@ -0,0 +1,2 @@
+enchant
+Pierre-Alain Joye, Ilia Alshanetsky
diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4
new file mode 100755 (executable)
index 0000000..b59cd8f
--- /dev/null
@@ -0,0 +1,36 @@
+dnl
+dnl $Id$
+dnl
+
+PHP_ARG_WITH(enchant,for ENCHANT support,
+[  --with-enchant[=DIR]     Include enchant support.
+                          GNU Aspell version 1.1.3 or higher required.])
+
+if test "$PHP_ENCHANT" != "no"; then
+       PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
+       if test "$PHP_ENCHANT" != "yes"; then
+           ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
+       else
+           ENCHANT_SEARCH_DIRS="/usr/local /usr"
+       fi
+       for i in $ENCHANT_SEARCH_DIRS; do
+               if test -f $i/include/enchant/enchant.h; then
+                       ENCHANT_DIR=$i
+                       ENCHANT_INCDIR=$i/include/enchant
+               elif test -f $i/include/enchant.h; then
+                       ENCHANT_DIR=$i
+                       ENCHANT_INCDIR=$i/include
+               fi
+       done
+
+       if test -z "$ENCHANT_DIR"; then
+               AC_MSG_ERROR(Cannot find enchant)
+       fi
+
+       ENCHANT_LIBDIR=$ENCHANT_DIR/lib
+
+       AC_DEFINE(HAVE_ENCHANT,1,[ ])
+       PHP_SUBST(ENCHANT_SHARED_LIBADD)
+       PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
+       PHP_ADD_INCLUDE($ENCHANT_INCDIR)
+fi
diff --git a/ext/enchant/docs/examples/example1.php b/ext/enchant/docs/examples/example1.php
new file mode 100644 (file)
index 0000000..9d503f7
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+$tag = 'en_US';
+$r = enchant_broker_init();
+$bprovides = enchant_broker_describe($r);
+echo "Current broker provides the following backend(s):\n";
+print_r($bprovides);
+
+
+if (enchant_broker_dict_exists($r,$tag)) {
+       $d = enchant_broker_request_dict($r, $tag);
+       $dprovides = enchant_dict_describe($d);
+       echo "dictionary $tag provides:\n";
+       $spellerrors = enchant_dict_check($d, "soong");
+       print_r($dprovides);
+       echo "found $spellerrors spell errors\n";
+       if ($spellerrors) {
+               $suggs = enchant_dict_suggest($d, "soong");
+               echo "Suggestions for 'soong':";
+               print_r($suggs);
+       }
+       enchant_broker_free_dict($d);
+} else {
+}
+enchant_broker_free($r);
+?>
diff --git a/ext/enchant/tests/broker_describe.phpt b/ext/enchant/tests/broker_describe.phpt
new file mode 100644 (file)
index 0000000..4c03f6f
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+enchant_broker_describe() function
+--SKIPIF--
+<?php 
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+
+if(!$broker) exit("failed, broker_init failure\n");
+
+$provides = enchant_broker_describe($broker);
+
+if (is_array($provides)) {
+       foreach ($provides as $backend) {
+               if (!(isset($backend['name']) && isset($backend['desc']) && isset($backend['file']))) {
+                       exit("failed\n");
+               }
+       }
+       exit("OK\n");
+} else {
+       echo "failed";
+}
+?>
+--EXPECTF--
+OK
diff --git a/ext/enchant/tests/broker_free.phpt b/ext/enchant/tests/broker_free.phpt
new file mode 100644 (file)
index 0000000..d00c22a
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+enchant_broker_free() function
+--SKIPIF--
+<?php 
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+if (is_resource($broker)) {
+       echo "OK\n";
+       enchant_broker_free($broker);
+}  else {
+       exit("init failed\n");
+}
+echo "OK\n";
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/enchant/tests/broker_init.phpt b/ext/enchant/tests/broker_init.phpt
new file mode 100644 (file)
index 0000000..359a653
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+enchant_broker_init() function
+--SKIPIF--
+<?php 
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+echo is_resource($broker) ? "OK" : "Failure";
+echo "\n";
+?>
+--EXPECT--
+OK
diff --git a/ext/enchant/tests/broker_request_dict.phpt b/ext/enchant/tests/broker_request_dict.phpt
new file mode 100644 (file)
index 0000000..5744da6
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+enchant_broker_request_dict() function
+--SKIPIF--
+<?php 
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+if (!is_resource($broker)) {
+       exit("init failed\n");
+}
+
+$dicts = enchant_broker_list_dicts($broker);
+if (is_array($dicts)) {
+       if (count($dicts)) {
+               $dict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
+               if (is_resource($dict)) {
+                       echo "OK\n";
+               } else {
+                       echo "fail to request " . $dicts[0]['lang_tag'];
+               }
+       }
+} else {
+       exit("list dicts failed\n");
+}
+echo "OK\n";
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/enchant/tests/hindi_correct.txt b/ext/enchant/tests/hindi_correct.txt
new file mode 100644 (file)
index 0000000..cced6b8
--- /dev/null
@@ -0,0 +1 @@
+इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खीचें व छोड़ें
diff --git a/ext/enchant/tests/hindi_incorrect.txt b/ext/enchant/tests/hindi_incorrect.txt
new file mode 100644 (file)
index 0000000..1f7353c
--- /dev/null
@@ -0,0 +1 @@
+इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खच व छड
diff --git a/ext/fileinfo/EXPERIMENTAL b/ext/fileinfo/EXPERIMENTAL
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
new file mode 100644 (file)
index 0000000..08d09e6
--- /dev/null
@@ -0,0 +1,13 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("fileinfo", "fileinfo support", "no");
+
+if (PHP_FILEINFO != 'no' && 
+               CHECK_HEADER_ADD_INCLUDE('magic.h', 'CFLAGS_FILEINFO') &&
+               CHECK_LIB(PHP_DEBUG != 'no'?'libmagic-staticd.lib':'libmagic-static.lib', 
+                       'fileinfo', PHP_FILEINFO)) {
+       EXTENSION('fileinfo', 'fileinfo.c');
+       AC_DEFINE('USE_MAGIC_STATIC', '', '');
+}
+
diff --git a/ext/fileinfo/fileinfo.php b/ext/fileinfo/fileinfo.php
new file mode 100644 (file)
index 0000000..1ee9efb
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+if(!extension_loaded('fileinfo')) {
+       dl('fileinfo.' . PHP_SHLIB_SUFFIX);
+}
+if(!extension_loaded('fileinfo')) {
+       die("fileinfo extension is not avaliable, please compile it.\n");
+}
+
+// normal operation
+$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
+$files = glob("*");
+foreach ($files as $file) {
+       echo finfo_file($res, $file) . "\n";
+}
+finfo_close($res);
+
+// OO mode
+/*
+ * FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
+ * FILEINFO_SYMLINK - follow symlinks
+ * FILEINFO_DEVICES - look at the contents of blocks or character special devices
+ * FILEINFO_COMPRESS - decompress compressed files
+ */
+$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
+$files = glob("*");
+foreach ($files as $file) {
+        echo $fi->buffer(file_get_contents($file)) . "\n";
+}
+?>
diff --git a/ext/fileinfo/package.xml b/ext/fileinfo/package.xml
new file mode 100644 (file)
index 0000000..a274e47
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE package SYSTEM "../pear/package.dtd">
+<package>
+ <name>Fileinfo</name>
+ <summary>libmagic bindings</summary>
+ <maintainers>
+  <maintainer>
+   <user>iliaa</user>
+   <name>Ilia Alshanetsky</name>
+   <email>ilia@php.net</email>
+   <role>lead</role>
+  </maintainer>
+ </maintainers>
+ <description>
+This extension allows retrieval of information regarding vast majority of file. 
+This information may include dimensions, quality, length etc...
+
+Additionally it can also be used to retrieve the mime type for a particular 
+file and for text files proper language encoding.
+ </description>
+ <license>PHP</license>
+ <release>
+  <state>stable</state>
+  <version>1.0.4</version>
+  <date>2006-11-07</date>
+  <notes>
+       1) Fixed detection of magic files
+       2) Fixed build problems with older version of libmagic
+  </notes>
+  <filelist>
+   <file role="src" name="config.m4"/>
+   <file role="src" name="fileinfo.c"/>
+   <file role="src" name="php_fileinfo.h"/>
+   <file role="doc" name="CREDITS"/>
+   <file role="doc" name="EXPERIMENTAL"/>
+   <file role="doc" name="fileinfo.php"/>
+  </filelist>
+  <deps>
+  </deps>
+ </release>
+</package>
+<!--
+vim:et:ts=1:sw=1
+-->
diff --git a/ext/phar/build_precommand.php b/ext/phar/build_precommand.php
new file mode 100755 (executable)
index 0000000..8904afd
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/php
+<?php echo '<'.'?php';?>
+
+/** @file phar.php
+ * @ingroup Phar
+ * @brief class Phar Pre Command
+ * @author  Marcus Boerger
+ * @date    2007 - 2007
+ *
+ * Phar Command
+ */
+foreach(array("SPL", "Reflection", "Phar") as $ext)
+{
+       if (!extension_loaded($ext))
+       {
+               echo "$argv[0] requires PHP extension $ext.\n";
+               exit(1);
+       }
+}
+
+<?php
+
+$classes = array(
+       'DirectoryTreeIterator',
+       'DirectoryGraphIterator',
+       'InvertedRegexIterator',
+       'CLICommand',
+       'PharCommand',
+       );
+
+foreach($classes as $name)
+{
+       echo "if (!class_exists('$name', 0))\n{\n";
+       $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
+       unset($f[0]);
+       $c = count($f);
+       while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
+       {
+               unset($f[$c--]);
+       }
+       if (substr($f[$c], -2) == "\r\n") {
+               $f[$c] = substr($f[$c], 0, -2);
+       }
+       if (substr($f[$c], -1) == "\n") {
+               $f[$c] = substr($f[$c], 0, -1);
+       }
+       if (substr($f[$c], -2) == '?>') {
+               $f[$c] = substr($f[$c], 0,-2);
+       }
+       while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
+       {
+               unset($f[$c--]);
+       }
+       echo join('', $f);
+       echo "\n}\n\n";
+}
+
+echo 'new PharCommand($argc, $argv);'."\n";
+
+?>
diff --git a/ext/phar/phar/directorygraphiterator.inc b/ext/phar/phar/directorygraphiterator.inc
new file mode 100755 (executable)
index 0000000..5808e3b
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+/** @file directorygraphiterator.inc
+ * @ingroup Examples
+ * @brief class DirectoryGraphIterator
+ * @author  Marcus Boerger
+ * @date    2003 - 2005
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** @ingroup Examples
+ * @brief   A tree iterator that only shows directories.
+ * @author  Marcus Boerger
+ * @version 1.1
+ */
+class DirectoryGraphIterator extends DirectoryTreeIterator
+{
+       function __construct($path)
+       {
+               RecursiveIteratorIterator::__construct(
+                       new RecursiveCachingIterator(
+                               new ParentIterator(
+                                       new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
+                                       )
+                               ), 
+                               CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
+                       ), 
+                       parent::SELF_FIRST
+               );
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/ext/phar/phar/directorytreeiterator.inc b/ext/phar/phar/directorytreeiterator.inc
new file mode 100755 (executable)
index 0000000..8e65d0d
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+
+/** @file directorytreeiterator.inc
+ * @ingroup Examples
+ * @brief class DirectoryTreeIterator
+ * @author  Marcus Boerger
+ * @date    2003 - 2005
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** @ingroup Examples
+ * @brief   DirectoryIterator to generate ASCII graphic directory trees
+ * @author  Marcus Boerger
+ * @version 1.1
+ */
+class DirectoryTreeIterator extends RecursiveIteratorIterator
+{
+       /** Construct from a path.
+        * @param $path directory to iterate
+        */
+       function __construct($path)
+       {
+               parent::__construct(
+                       new RecursiveCachingIterator(
+                               new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
+                               ), 
+                               CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
+                       ), 
+                       parent::SELF_FIRST
+               );
+       }
+
+       /** @return the current element prefixed with ASCII graphics
+        */     
+       function current()
+       {
+               $tree = '';
+               for ($l=0; $l < $this->getDepth(); $l++) {
+                       $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : '  ';
+               }
+               return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-') 
+                      . $this->getSubIterator($l)->__toString();
+       }
+
+       /** Aggregates the inner iterator
+        */     
+       function __call($func, $params)
+       {
+               return call_user_func_array(array($this->getSubIterator(), $func), $params);
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/ext/phar/phar/invertedregexiterator.inc b/ext/phar/phar/invertedregexiterator.inc
new file mode 100755 (executable)
index 0000000..7eea533
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/** @file invertedregexiterator.inc
+ * @ingroup Phar
+ * @brief class InvertedRegexIterator
+ * @author  Marcus Boerger
+ * @date    2007 - 2007
+ *
+ * Inverted RegexIterator
+ */
+
+/** @ingroup Phar
+ * @brief   Inverted RegexIterator
+ * @author  Marcus Boerger
+ * @version 1.0
+ */
+class InvertedRegexIterator extends RegexIterator
+{
+       /** @return !RegexIterator::accept()
+        */     
+       function accept()
+       {
+               return !RegexIterator::accept();
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/ext/phar/phar/phar.inc b/ext/phar/phar/phar.inc
new file mode 100755 (executable)
index 0000000..a7c6f6d
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * @file phar.inc
+ * @ingroup Phar
+ * @brief class Phar
+ * @author  Marcus Boerger
+ * @date    2007 - 2007
+ *
+ * Phar Command
+ */
+// {{{ class Phar extends PHP_Archive
+/**
+ * Phar class
+ * 
+ * @ingroup Phar
+ * @brief   Phar implementation
+ * @author  Marcus Boerger
+ * @version 1.0
+ */
+class Phar extends PHP_Archive implements RecursiveIterator
+{
+       function getSignature()
+       {
+               return false;
+       }
+
+       function getAlias()
+       {
+               return false;
+       }
+
+       function rewind()
+       {
+       }
+
+       function valid()
+       {
+               return false;
+       }
+
+       function current()
+       {
+       }
+
+       function key()
+       {
+       }
+
+       function next()
+       {
+       }
+
+       function hasChildren()
+       {
+               return false;
+       }
+
+       function getChildren()
+       {
+       }
+
+       function hasMetadata()
+       {
+       }
+
+       function getMetadata()
+       {
+       }
+
+       function getStub()
+       {
+       }
+
+       function setStub()
+       {
+       }
+}
+
+?>
\ No newline at end of file