This commit was manufactured by cvs2svn to create branch 'PHP_5_3'.

This commit is contained in:
SVN Migration 2007-09-26 15:44:16 +00:00
parent f871988b88
commit 0e5d551a56
18 changed files with 501 additions and 0 deletions

2
ext/enchant/CREDITS Normal file
View File

@ -0,0 +1,2 @@
enchant
Pierre-Alain Joye, Ilia Alshanetsky

36
ext/enchant/config.m4 Executable file
View File

@ -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

View File

@ -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);
?>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खीचें व छोड़ें

View File

@ -0,0 +1 @@
इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खच व छड

View File

13
ext/fileinfo/config.w32 Normal file
View File

@ -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', '', '');
}

29
ext/fileinfo/fileinfo.php Normal file
View File

@ -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";
}
?>

44
ext/fileinfo/package.xml Normal file
View File

@ -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
-->

60
ext/phar/build_precommand.php Executable file
View File

@ -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";
?>

View File

@ -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
);
}
}
?>

View File

@ -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);
}
}
?>

View File

@ -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();
}
}
?>

80
ext/phar/phar/phar.inc Executable file
View File

@ -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()
{
}
}
?>