Skip to content

Commit 0e5d551

Browse files
author
SVN Migration
committed
This commit was manufactured by cvs2svn to create branch 'PHP_5_3'.
1 parent f871988 commit 0e5d551

18 files changed

+501
-0
lines changed

ext/enchant/CREDITS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enchant
2+
Pierre-Alain Joye, Ilia Alshanetsky

ext/enchant/config.m4

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
dnl
2+
dnl $Id$
3+
dnl
4+
5+
PHP_ARG_WITH(enchant,for ENCHANT support,
6+
[ --with-enchant[=DIR] Include enchant support.
7+
GNU Aspell version 1.1.3 or higher required.])
8+
9+
if test "$PHP_ENCHANT" != "no"; then
10+
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
11+
if test "$PHP_ENCHANT" != "yes"; then
12+
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
13+
else
14+
ENCHANT_SEARCH_DIRS="/usr/local /usr"
15+
fi
16+
for i in $ENCHANT_SEARCH_DIRS; do
17+
if test -f $i/include/enchant/enchant.h; then
18+
ENCHANT_DIR=$i
19+
ENCHANT_INCDIR=$i/include/enchant
20+
elif test -f $i/include/enchant.h; then
21+
ENCHANT_DIR=$i
22+
ENCHANT_INCDIR=$i/include
23+
fi
24+
done
25+
26+
if test -z "$ENCHANT_DIR"; then
27+
AC_MSG_ERROR(Cannot find enchant)
28+
fi
29+
30+
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
31+
32+
AC_DEFINE(HAVE_ENCHANT,1,[ ])
33+
PHP_SUBST(ENCHANT_SHARED_LIBADD)
34+
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
35+
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
36+
fi
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
$tag = 'en_US';
3+
$r = enchant_broker_init();
4+
$bprovides = enchant_broker_describe($r);
5+
echo "Current broker provides the following backend(s):\n";
6+
print_r($bprovides);
7+
8+
9+
if (enchant_broker_dict_exists($r,$tag)) {
10+
$d = enchant_broker_request_dict($r, $tag);
11+
$dprovides = enchant_dict_describe($d);
12+
echo "dictionary $tag provides:\n";
13+
$spellerrors = enchant_dict_check($d, "soong");
14+
print_r($dprovides);
15+
echo "found $spellerrors spell errors\n";
16+
if ($spellerrors) {
17+
$suggs = enchant_dict_suggest($d, "soong");
18+
echo "Suggestions for 'soong':";
19+
print_r($suggs);
20+
}
21+
enchant_broker_free_dict($d);
22+
} else {
23+
}
24+
enchant_broker_free($r);
25+
?>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
enchant_broker_describe() function
3+
--SKIPIF--
4+
<?php
5+
if(!extension_loaded('enchant')) die('skip, enchant not loader');
6+
7+
?>
8+
--FILE--
9+
<?php
10+
$broker = enchant_broker_init();
11+
12+
if(!$broker) exit("failed, broker_init failure\n");
13+
14+
$provides = enchant_broker_describe($broker);
15+
16+
if (is_array($provides)) {
17+
foreach ($provides as $backend) {
18+
if (!(isset($backend['name']) && isset($backend['desc']) && isset($backend['file']))) {
19+
exit("failed\n");
20+
}
21+
}
22+
exit("OK\n");
23+
} else {
24+
echo "failed";
25+
}
26+
?>
27+
--EXPECTF--
28+
OK

ext/enchant/tests/broker_free.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
enchant_broker_free() function
3+
--SKIPIF--
4+
<?php
5+
if(!extension_loaded('enchant')) die('skip, enchant not loader');
6+
7+
?>
8+
--FILE--
9+
<?php
10+
$broker = enchant_broker_init();
11+
if (is_resource($broker)) {
12+
echo "OK\n";
13+
enchant_broker_free($broker);
14+
} else {
15+
exit("init failed\n");
16+
}
17+
echo "OK\n";
18+
?>
19+
--EXPECT--
20+
OK
21+
OK

ext/enchant/tests/broker_init.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
enchant_broker_init() function
3+
--SKIPIF--
4+
<?php
5+
if(!extension_loaded('enchant')) die('skip, enchant not loader');
6+
7+
?>
8+
--FILE--
9+
<?php
10+
$broker = enchant_broker_init();
11+
echo is_resource($broker) ? "OK" : "Failure";
12+
echo "\n";
13+
?>
14+
--EXPECT--
15+
OK
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
enchant_broker_request_dict() function
3+
--SKIPIF--
4+
<?php
5+
if(!extension_loaded('enchant')) die('skip, enchant not loader');
6+
?>
7+
--FILE--
8+
<?php
9+
$broker = enchant_broker_init();
10+
if (!is_resource($broker)) {
11+
exit("init failed\n");
12+
}
13+
14+
$dicts = enchant_broker_list_dicts($broker);
15+
if (is_array($dicts)) {
16+
if (count($dicts)) {
17+
$dict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
18+
if (is_resource($dict)) {
19+
echo "OK\n";
20+
} else {
21+
echo "fail to request " . $dicts[0]['lang_tag'];
22+
}
23+
}
24+
} else {
25+
exit("list dicts failed\n");
26+
}
27+
echo "OK\n";
28+
?>
29+
--EXPECT--
30+
OK
31+
OK

ext/enchant/tests/hindi_correct.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खीचें व छोड़ें

ext/enchant/tests/hindi_incorrect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खच व छड

ext/fileinfo/EXPERIMENTAL

Whitespace-only changes.

ext/fileinfo/config.w32

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// $Id$
2+
// vim:ft=javascript
3+
4+
ARG_WITH("fileinfo", "fileinfo support", "no");
5+
6+
if (PHP_FILEINFO != 'no' &&
7+
CHECK_HEADER_ADD_INCLUDE('magic.h', 'CFLAGS_FILEINFO') &&
8+
CHECK_LIB(PHP_DEBUG != 'no'?'libmagic-staticd.lib':'libmagic-static.lib',
9+
'fileinfo', PHP_FILEINFO)) {
10+
EXTENSION('fileinfo', 'fileinfo.c');
11+
AC_DEFINE('USE_MAGIC_STATIC', '', '');
12+
}
13+

ext/fileinfo/fileinfo.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
if(!extension_loaded('fileinfo')) {
3+
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
4+
}
5+
if(!extension_loaded('fileinfo')) {
6+
die("fileinfo extension is not avaliable, please compile it.\n");
7+
}
8+
9+
// normal operation
10+
$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
11+
$files = glob("*");
12+
foreach ($files as $file) {
13+
echo finfo_file($res, $file) . "\n";
14+
}
15+
finfo_close($res);
16+
17+
// OO mode
18+
/*
19+
* FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
20+
* FILEINFO_SYMLINK - follow symlinks
21+
* FILEINFO_DEVICES - look at the contents of blocks or character special devices
22+
* FILEINFO_COMPRESS - decompress compressed files
23+
*/
24+
$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
25+
$files = glob("*");
26+
foreach ($files as $file) {
27+
echo $fi->buffer(file_get_contents($file)) . "\n";
28+
}
29+
?>

ext/fileinfo/package.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE package SYSTEM "../pear/package.dtd">
3+
<package>
4+
<name>Fileinfo</name>
5+
<summary>libmagic bindings</summary>
6+
<maintainers>
7+
<maintainer>
8+
<user>iliaa</user>
9+
<name>Ilia Alshanetsky</name>
10+
<email>[email protected]</email>
11+
<role>lead</role>
12+
</maintainer>
13+
</maintainers>
14+
<description>
15+
This extension allows retrieval of information regarding vast majority of file.
16+
This information may include dimensions, quality, length etc...
17+
18+
Additionally it can also be used to retrieve the mime type for a particular
19+
file and for text files proper language encoding.
20+
</description>
21+
<license>PHP</license>
22+
<release>
23+
<state>stable</state>
24+
<version>1.0.4</version>
25+
<date>2006-11-07</date>
26+
<notes>
27+
1) Fixed detection of magic files
28+
2) Fixed build problems with older version of libmagic
29+
</notes>
30+
<filelist>
31+
<file role="src" name="config.m4"/>
32+
<file role="src" name="fileinfo.c"/>
33+
<file role="src" name="php_fileinfo.h"/>
34+
<file role="doc" name="CREDITS"/>
35+
<file role="doc" name="EXPERIMENTAL"/>
36+
<file role="doc" name="fileinfo.php"/>
37+
</filelist>
38+
<deps>
39+
</deps>
40+
</release>
41+
</package>
42+
<!--
43+
vim:et:ts=1:sw=1
44+
-->

ext/phar/build_precommand.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/php
2+
<?php echo '<'.'?php';?>
3+
4+
/** @file phar.php
5+
* @ingroup Phar
6+
* @brief class Phar Pre Command
7+
* @author Marcus Boerger
8+
* @date 2007 - 2007
9+
*
10+
* Phar Command
11+
*/
12+
foreach(array("SPL", "Reflection", "Phar") as $ext)
13+
{
14+
if (!extension_loaded($ext))
15+
{
16+
echo "$argv[0] requires PHP extension $ext.\n";
17+
exit(1);
18+
}
19+
}
20+
21+
<?php
22+
23+
$classes = array(
24+
'DirectoryTreeIterator',
25+
'DirectoryGraphIterator',
26+
'InvertedRegexIterator',
27+
'CLICommand',
28+
'PharCommand',
29+
);
30+
31+
foreach($classes as $name)
32+
{
33+
echo "if (!class_exists('$name', 0))\n{\n";
34+
$f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
35+
unset($f[0]);
36+
$c = count($f);
37+
while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
38+
{
39+
unset($f[$c--]);
40+
}
41+
if (substr($f[$c], -2) == "\r\n") {
42+
$f[$c] = substr($f[$c], 0, -2);
43+
}
44+
if (substr($f[$c], -1) == "\n") {
45+
$f[$c] = substr($f[$c], 0, -1);
46+
}
47+
if (substr($f[$c], -2) == '?>') {
48+
$f[$c] = substr($f[$c], 0,-2);
49+
}
50+
while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
51+
{
52+
unset($f[$c--]);
53+
}
54+
echo join('', $f);
55+
echo "\n}\n\n";
56+
}
57+
58+
echo 'new PharCommand($argc, $argv);'."\n";
59+
60+
?>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/** @file directorygraphiterator.inc
4+
* @ingroup Examples
5+
* @brief class DirectoryGraphIterator
6+
* @author Marcus Boerger
7+
* @date 2003 - 2005
8+
*
9+
* SPL - Standard PHP Library
10+
*/
11+
12+
/** @ingroup Examples
13+
* @brief A tree iterator that only shows directories.
14+
* @author Marcus Boerger
15+
* @version 1.1
16+
*/
17+
class DirectoryGraphIterator extends DirectoryTreeIterator
18+
{
19+
function __construct($path)
20+
{
21+
RecursiveIteratorIterator::__construct(
22+
new RecursiveCachingIterator(
23+
new ParentIterator(
24+
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
25+
)
26+
),
27+
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
28+
),
29+
parent::SELF_FIRST
30+
);
31+
}
32+
}
33+
34+
?>

0 commit comments

Comments
 (0)