Initial Commit
This commit is contained in:
475
database/php/docs/Archive_Tar/docs/Archive_Tar.txt
Normal file
475
database/php/docs/Archive_Tar/docs/Archive_Tar.txt
Normal file
@@ -0,0 +1,475 @@
|
||||
Documentation for class Archive_Tar
|
||||
===================================
|
||||
Last update : 2001-08-15
|
||||
|
||||
|
||||
|
||||
Overview :
|
||||
----------
|
||||
|
||||
The Archive_Tar class helps in creating and managing GNU TAR format
|
||||
files compressed by GNU ZIP or not.
|
||||
The class offers basic functions like creating an archive, adding
|
||||
files in the archive, extracting files from the archive and listing
|
||||
the archive content.
|
||||
It also provide advanced functions that allow the adding and
|
||||
extraction of files with path manipulation.
|
||||
|
||||
|
||||
Sample :
|
||||
--------
|
||||
|
||||
// ----- Creating the object (uncompressed archive)
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->setErrorHandling(PEAR_ERROR_PRINT);
|
||||
|
||||
// ----- Creating the archive
|
||||
$v_list[0]="file.txt";
|
||||
$v_list[1]="data/";
|
||||
$v_list[2]="file.log";
|
||||
$tar_object->create($v_list);
|
||||
|
||||
// ----- Adding files
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/";
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->add($v_list);
|
||||
|
||||
// ----- Adding more files
|
||||
$tar_object->add("release/newfile.log release/readme.txt");
|
||||
|
||||
// ----- Listing the content
|
||||
if (($v_list = $tar_object->listContent()) != 0)
|
||||
for ($i=0; $i<sizeof($v_list); $i++)
|
||||
{
|
||||
echo "Filename :'".$v_list[$i][filename]."'<br>";
|
||||
echo " .size :'".$v_list[$i][size]."'<br>";
|
||||
echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
|
||||
echo " .mode :'".$v_list[$i][mode]."'<br>";
|
||||
echo " .uid :'".$v_list[$i][uid]."'<br>";
|
||||
echo " .gid :'".$v_list[$i][gid]."'<br>";
|
||||
echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
|
||||
}
|
||||
|
||||
// ----- Extracting the archive in directory "install"
|
||||
$tar_object->extract("install");
|
||||
|
||||
|
||||
Public arguments :
|
||||
------------------
|
||||
|
||||
None
|
||||
|
||||
|
||||
Public Methods :
|
||||
----------------
|
||||
|
||||
Method : Archive_Tar($p_tarname, $compress = null)
|
||||
Description :
|
||||
Archive_Tar Class constructor. This flavour of the constructor only
|
||||
declare a new Archive_Tar object, identifying it by the name of the
|
||||
tar file.
|
||||
If the compress argument is set the tar will be read or created as a
|
||||
gzip or bz2 compressed TAR file.
|
||||
Arguments :
|
||||
$p_tarname : A valid filename for the tar archive file.
|
||||
$p_compress : can be null, 'gz' or 'bz2'. For
|
||||
compatibility reason it can also be true. This
|
||||
parameter indicates if gzip or bz2 compression
|
||||
is required.
|
||||
Return value :
|
||||
The Archive_Tar object.
|
||||
Sample :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object_compressed = new Archive_Tar("tarname.tgz", true);
|
||||
How it works :
|
||||
Initialize the object.
|
||||
|
||||
Method : create($p_filelist)
|
||||
Description :
|
||||
This method creates the archive file and add the files / directories
|
||||
that are listed in $p_filelist.
|
||||
If the file already exists and is writable, it is replaced by the
|
||||
new tar. It is a create and not an add. If the file exists and is
|
||||
read-only or is a directory it is not replaced. The method return
|
||||
false and a PEAR error text.
|
||||
The $p_filelist parameter can be an array of string, each string
|
||||
representing a filename or a directory name with their path if
|
||||
needed. It can also be a single string with names separated by a
|
||||
single blank.
|
||||
See also createModify() method for more details.
|
||||
Arguments :
|
||||
$p_filelist : An array of filenames and directory names, or a single
|
||||
string with names separated by a single blank space.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample 1 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
|
||||
$v_list[0]="file.txt";
|
||||
$v_list[1]="data/"; (Optional '/' at the end)
|
||||
$v_list[2]="file.log";
|
||||
$tar_object->create($v_list);
|
||||
Sample 2 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
|
||||
$tar_object->create("file.txt data/ file.log");
|
||||
How it works :
|
||||
Just calling the createModify() method with the right parameters.
|
||||
|
||||
Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
|
||||
Description :
|
||||
This method creates the archive file and add the files / directories
|
||||
that are listed in $p_filelist.
|
||||
If the file already exists and is writable, it is replaced by the
|
||||
new tar. It is a create and not an add. If the file exists and is
|
||||
read-only or is a directory it is not replaced. The method return
|
||||
false and a PEAR error text.
|
||||
The $p_filelist parameter can be an array of string, each string
|
||||
representing a filename or a directory name with their path if
|
||||
needed. It can also be a single string with names separated by a
|
||||
single blank.
|
||||
The path indicated in $p_remove_dir will be removed from the
|
||||
memorized path of each file / directory listed when this path
|
||||
exists. By default nothing is removed (empty path "")
|
||||
The path indicated in $p_add_dir will be added at the beginning of
|
||||
the memorized path of each file / directory listed. However it can
|
||||
be set to empty "". The adding of a path is done after the removing
|
||||
of path.
|
||||
The path add/remove ability enables the user to prepare an archive
|
||||
for extraction in a different path than the origin files are.
|
||||
See also addModify() method for file adding properties.
|
||||
Arguments :
|
||||
$p_filelist : An array of filenames and directory names, or a single
|
||||
string with names separated by a single blank space.
|
||||
$p_add_dir : A string which contains a path to be added to the
|
||||
memorized path of each element in the list.
|
||||
$p_remove_dir : A string which contains a path to be removed from
|
||||
the memorized path of each element in the list, when
|
||||
relevant.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample 1 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
|
||||
$v_list[0]="file.txt";
|
||||
$v_list[1]="data/"; (Optional '/' at the end)
|
||||
$v_list[2]="file.log";
|
||||
$tar_object->createModify($v_list, "install");
|
||||
// files are stored in the archive as :
|
||||
// install/file.txt
|
||||
// install/data
|
||||
// install/data/file1.txt
|
||||
// install/data/... all the files and sub-dirs of data/
|
||||
// install/file.log
|
||||
Sample 2 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/"; (Optional '/' at the end)
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->createModify($v_list, "install", "dev");
|
||||
// files are stored in the archive as :
|
||||
// install/file.txt
|
||||
// install/data
|
||||
// install/data/file1.txt
|
||||
// install/data/... all the files and sub-dirs of data/
|
||||
// install/log/file.log
|
||||
How it works :
|
||||
Open the file in write mode (erasing the existing one if one),
|
||||
call the _addList() method for adding the files in an empty archive,
|
||||
add the tar footer (512 bytes block), close the tar file.
|
||||
|
||||
|
||||
Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
|
||||
Description :
|
||||
This method add the files / directories listed in $p_filelist at the
|
||||
end of the existing archive. If the archive does not yet exists it
|
||||
is created.
|
||||
The $p_filelist parameter can be an array of string, each string
|
||||
representing a filename or a directory name with their path if
|
||||
needed. It can also be a single string with names separated by a
|
||||
single blank.
|
||||
The path indicated in $p_remove_dir will be removed from the
|
||||
memorized path of each file / directory listed when this path
|
||||
exists. By default nothing is removed (empty path "")
|
||||
The path indicated in $p_add_dir will be added at the beginning of
|
||||
the memorized path of each file / directory listed. However it can
|
||||
be set to empty "". The adding of a path is done after the removing
|
||||
of path.
|
||||
The path add/remove ability enables the user to prepare an archive
|
||||
for extraction in a different path than the origin files are.
|
||||
If a file/dir is already in the archive it will only be added at the
|
||||
end of the archive. There is no update of the existing archived
|
||||
file/dir. However while extracting the archive, the last file will
|
||||
replace the first one. This results in a none optimization of the
|
||||
archive size.
|
||||
If a file/dir does not exist the file/dir is ignored. However an
|
||||
error text is send to PEAR error.
|
||||
If a file/dir is not readable the file/dir is ignored. However an
|
||||
error text is send to PEAR error.
|
||||
If the resulting filename/dirname (after the add/remove option or
|
||||
not) string is greater than 99 char, the file/dir is
|
||||
ignored. However an error text is send to PEAR error.
|
||||
Arguments :
|
||||
$p_filelist : An array of filenames and directory names, or a single
|
||||
string with names separated by a single blank space.
|
||||
$p_add_dir : A string which contains a path to be added to the
|
||||
memorized path of each element in the list.
|
||||
$p_remove_dir : A string which contains a path to be removed from
|
||||
the memorized path of each element in the list, when
|
||||
relevant.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample 1 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
[...]
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/"; (Optional '/' at the end)
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->addModify($v_list, "install");
|
||||
// files are stored in the archive as :
|
||||
// install/file.txt
|
||||
// install/data
|
||||
// install/data/file1.txt
|
||||
// install/data/... all the files and sub-dirs of data/
|
||||
// install/file.log
|
||||
Sample 2 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
[...]
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/"; (Optional '/' at the end)
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->addModify($v_list, "install", "dev");
|
||||
// files are stored in the archive as :
|
||||
// install/file.txt
|
||||
// install/data
|
||||
// install/data/file1.txt
|
||||
// install/data/... all the files and sub-dirs of data/
|
||||
// install/log/file.log
|
||||
How it works :
|
||||
If the archive does not exists it create it and add the files.
|
||||
If the archive does exists and is not compressed, it open it, jump
|
||||
before the last empty 512 bytes block (tar footer) and add the files
|
||||
at this point.
|
||||
If the archive does exists and is compressed, a temporary copy file
|
||||
is created. This temporary file is then 'gzip' read block by block
|
||||
until the last empty block. The new files are then added in the
|
||||
compressed file.
|
||||
The adding of files is done by going through the file/dir list,
|
||||
adding files per files, in a recursive way through the
|
||||
directory. Each time a path need to be added/removed it is done
|
||||
before writing the file header in the archive.
|
||||
|
||||
Method : add($p_filelist)
|
||||
Description :
|
||||
This method add the files / directories listed in $p_filelist at the
|
||||
end of the existing archive. If the archive does not yet exists it
|
||||
is created.
|
||||
The $p_filelist parameter can be an array of string, each string
|
||||
representing a filename or a directory name with their path if
|
||||
needed. It can also be a single string with names separated by a
|
||||
single blank.
|
||||
See addModify() method for details and limitations.
|
||||
Arguments :
|
||||
$p_filelist : An array of filenames and directory names, or a single
|
||||
string with names separated by a single blank space.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample 1 :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
[...]
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/"; (Optional '/' at the end)
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->add($v_list);
|
||||
Sample 2 :
|
||||
$tar_object = new Archive_Tar("tarname.tgz", true);
|
||||
[...]
|
||||
$v_list[0]="dev/file.txt";
|
||||
$v_list[1]="dev/data/"; (Optional '/' at the end)
|
||||
$v_list[2]="log/file.log";
|
||||
$tar_object->add($v_list);
|
||||
How it works :
|
||||
Simply call the addModify() method with the right parameters.
|
||||
|
||||
Method : addString($p_filename, $p_string, $p_datetime, $p_params)
|
||||
Description :
|
||||
This method add a single string as a file at the
|
||||
end of the existing archive. If the archive does not yet exists it
|
||||
is created.
|
||||
Arguments :
|
||||
$p_filename : A string which contains the full filename path
|
||||
that will be associated with the string.
|
||||
$p_string : The content of the file added in the archive.
|
||||
$p_datetime : (Optional) Timestamp of the file (default = now)
|
||||
$p_params : (Optional) Various file metadata:
|
||||
stamp - As above, timestamp of the file
|
||||
mode - UNIX-style permissions (default 0600)
|
||||
type - Is this a regular file or link (see TAR
|
||||
format spec for how to create a hard/symlink)
|
||||
uid - UNIX-style user ID (default 0 = root)
|
||||
gid - UNIX-style group ID (default 0 = root)
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample 1 :
|
||||
$v_archive = & new Archive_Tar($p_filename);
|
||||
$v_archive->setErrorHandling(PEAR_ERROR_PRINT);
|
||||
$v_result = $v_archive->addString('data/test.txt', 'This is the text of the string');
|
||||
$v_result = $v_archive->addString(
|
||||
'data/test.sh',
|
||||
"#!/bin/sh\necho 'Hello'",
|
||||
time(),
|
||||
array( "mode" => 0755, "uid" => 34 )
|
||||
);
|
||||
|
||||
|
||||
Method : extract($p_path = "")
|
||||
Description :
|
||||
This method extract all the content of the archive in the directory
|
||||
indicated by $p_path.If $p_path is optional, if not set the archive
|
||||
is extracted in the current directory.
|
||||
While extracting a file, if the directory path does not exists it is
|
||||
created.
|
||||
See extractModify() for details and limitations.
|
||||
Arguments :
|
||||
$p_path : Optional path where the files/dir need to by extracted.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->extract();
|
||||
How it works :
|
||||
Simply call the extractModify() method with appropriate parameters.
|
||||
|
||||
Method : extractModify($p_path, $p_remove_path)
|
||||
Description :
|
||||
This method extract all the content of the archive in the directory
|
||||
indicated by $p_path. When relevant the memorized path of the
|
||||
files/dir can be modified by removing the $p_remove_path path at the
|
||||
beginning of the file/dir path.
|
||||
While extracting a file, if the directory path does not exists it is
|
||||
created.
|
||||
While extracting a file, if the file already exists it is replaced
|
||||
without looking for last modification date.
|
||||
While extracting a file, if the file already exists and is write
|
||||
protected, the extraction is aborted.
|
||||
While extracting a file, if a directory with the same name already
|
||||
exists, the extraction is aborted.
|
||||
While extracting a directory, if a file with the same name already
|
||||
exists, the extraction is aborted.
|
||||
While extracting a file/directory if the destination directory exist
|
||||
and is write protected, or does not exist but can not be created,
|
||||
the extraction is aborted.
|
||||
If after extraction an extracted file does not show the correct
|
||||
stored file size, the extraction is aborted.
|
||||
When the extraction is aborted, a PEAR error text is set and false
|
||||
is returned. However the result can be a partial extraction that may
|
||||
need to be manually cleaned.
|
||||
Arguments :
|
||||
$p_path : The path of the directory where the files/dir need to by
|
||||
extracted.
|
||||
$p_remove_path : Part of the memorized path that can be removed if
|
||||
present at the beginning of the file/dir path.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample :
|
||||
// Imagine tarname.tar with files :
|
||||
// dev/data/file.txt
|
||||
// dev/data/log.txt
|
||||
// readme.txt
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->extractModify("install", "dev");
|
||||
// Files will be extracted there :
|
||||
// install/data/file.txt
|
||||
// install/data/log.txt
|
||||
// install/readme.txt
|
||||
How it works :
|
||||
Open the archive and call a more generic function that can extract
|
||||
only a part of the archive or all the archive.
|
||||
See extractList() method for more details.
|
||||
|
||||
Method : extractInString($p_filename)
|
||||
Description :
|
||||
This method extract from the archive one file identified by $p_filename.
|
||||
The return value is a string with the file content, or NULL on error.
|
||||
Arguments :
|
||||
$p_filename : The path of the file to extract in a string.
|
||||
Return value :
|
||||
a string with the file content or NULL.
|
||||
Sample :
|
||||
// Imagine tarname.tar with files :
|
||||
// dev/data/file.txt
|
||||
// dev/data/log.txt
|
||||
// dev/readme.txt
|
||||
$v_archive = & new Archive_Tar('tarname.tar');
|
||||
$v_archive->setErrorHandling(PEAR_ERROR_PRINT);
|
||||
$v_string = $v_archive->extractInString('dev/readme.txt');
|
||||
echo $v_string;
|
||||
|
||||
Method : listContent()
|
||||
Description :
|
||||
This method returns an array of arrays that describe each
|
||||
file/directory present in the archive.
|
||||
The array is not sorted, so it show the position of the file in the
|
||||
archive.
|
||||
The file informations are :
|
||||
$file[filename] : Name and path of the file/dir.
|
||||
$file[mode] : File permissions (result of fileperms())
|
||||
$file[uid] : user id
|
||||
$file[gid] : group id
|
||||
$file[size] : filesize
|
||||
$file[mtime] : Last modification time (result of filemtime())
|
||||
$file[typeflag] : "" for file, "5" for directory
|
||||
Arguments :
|
||||
Return value :
|
||||
An array of arrays or 0 on error.
|
||||
Sample :
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
if (($v_list = $tar_object->listContent()) != 0)
|
||||
for ($i=0; $i<sizeof($v_list); $i++)
|
||||
{
|
||||
echo "Filename :'".$v_list[$i][filename]."'<br>";
|
||||
echo " .size :'".$v_list[$i][size]."'<br>";
|
||||
echo " .mtime :'".$v_list[$i][mtime]."' (".
|
||||
date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
|
||||
echo " .mode :'".$v_list[$i][mode]."'<br>";
|
||||
echo " .uid :'".$v_list[$i][uid]."'<br>";
|
||||
echo " .gid :'".$v_list[$i][gid]."'<br>";
|
||||
echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
|
||||
}
|
||||
How it works :
|
||||
Call the same function as an extract however with a flag to only go
|
||||
through the archive without extracting the files.
|
||||
|
||||
Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
|
||||
Description :
|
||||
This method extract from the archive only the files indicated in the
|
||||
$p_filelist. These files are extracted in the current directory or
|
||||
in the directory indicated by the optional $p_path parameter.
|
||||
If indicated the $p_remove_path can be used in the same way as it is
|
||||
used in extractModify() method.
|
||||
Arguments :
|
||||
$p_filelist : An array of filenames and directory names, or a single
|
||||
string with names separated by a single blank space.
|
||||
$p_path : The path of the directory where the files/dir need to by
|
||||
extracted.
|
||||
$p_remove_path : Part of the memorized path that can be removed if
|
||||
present at the beginning of the file/dir path.
|
||||
Return value :
|
||||
true on success, false on error.
|
||||
Sample :
|
||||
// Imagine tarname.tar with files :
|
||||
// dev/data/file.txt
|
||||
// dev/data/log.txt
|
||||
// readme.txt
|
||||
$tar_object = new Archive_Tar("tarname.tar");
|
||||
$tar_object->extractList("dev/data/file.txt readme.txt", "install",
|
||||
"dev");
|
||||
// Files will be extracted there :
|
||||
// install/data/file.txt
|
||||
// install/readme.txt
|
||||
How it works :
|
||||
Go through the archive and extract only the files present in the
|
||||
list.
|
||||
|
||||
52
database/php/docs/PEAR/INSTALL
Normal file
52
database/php/docs/PEAR/INSTALL
Normal file
@@ -0,0 +1,52 @@
|
||||
PEAR - The PEAR Installer
|
||||
=========================
|
||||
Installing the PEAR Installer.
|
||||
|
||||
You should install PEAR on a local development machine first. Installing
|
||||
PEAR on a remote production machine should only be done after you are
|
||||
familiar with PEAR and have tested code using PEAR on your development
|
||||
machine.
|
||||
|
||||
There are two methods of installing PEAR
|
||||
- PEAR bundled in PHP
|
||||
- go-pear
|
||||
|
||||
We will first examine how to install PEAR that is bundled with PHP.
|
||||
|
||||
Microsoft Windows
|
||||
=================
|
||||
If you are running PHP 5.2.0 or newer, simply download and
|
||||
run the windows installer (.msi) and PEAR can be automatically
|
||||
installed.
|
||||
|
||||
Otherwise, for older PHP versions, download the .zip of windows,
|
||||
there is a script included with your PHP distribution that is called
|
||||
"go-pear". You must open a command box in order to run it. Click
|
||||
"start" then click "Run..." and type "cmd.exe" to open a command box.
|
||||
Use "cd" to change directory to the location of PHP where you unzipped it,
|
||||
and run the go-pear command.
|
||||
|
||||
Unix
|
||||
====
|
||||
When compiling PHP from source, you simply need to include the
|
||||
--with-pear directive on the "./configure" command. This is "on"
|
||||
by default in most PHP versions, but it doesn't hurt to list it
|
||||
explicitly. You should also consider enabling the zlib extension via
|
||||
--enable-zlib, so that the PEAR installer will be able to handle gzipped
|
||||
files (i.e. smaller package files for faster downloads). Later, when you
|
||||
run "make install" to install PHP itself, part of the process will be
|
||||
prompts that ask you where you want PEAR to be installed.
|
||||
|
||||
go-pear
|
||||
=======
|
||||
For users who cannot perform the above steps, or who wish to obtain the
|
||||
latest PEAR with a slightly higher risk of failure, use go-pear. go-pear
|
||||
is obtained by downloading http://pear.php.net/go-pear and saving it as go-pear.php.
|
||||
After downloading, simply run "php go-pear.php" or open it in a web browser
|
||||
(windows only) to download and install PEAR.
|
||||
|
||||
You can always ask general installation questions on pear-general@lists.php.net,
|
||||
a public mailing list devoted to support for PEAR packages and installation-
|
||||
related issues.
|
||||
|
||||
Happy PHPing, we hope PEAR will be a great tool for your development work!
|
||||
27
database/php/docs/PEAR/LICENSE
Normal file
27
database/php/docs/PEAR/LICENSE
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 1997-2009,
|
||||
Stig Bakken <ssb@php.net>,
|
||||
Gregory Beaver <cellog@php.net>,
|
||||
Helgi Þormar Þorbjörnsson <helgi@php.net>,
|
||||
Tomas V.V.Cox <cox@idecnet.com>,
|
||||
Martin Jansen <mj@php.net>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
88
database/php/docs/PEAR/README.rst
Normal file
88
database/php/docs/PEAR/README.rst
Normal file
@@ -0,0 +1,88 @@
|
||||
*************************
|
||||
PEAR - The PEAR Installer
|
||||
*************************
|
||||
.. image:: https://travis-ci.org/pear/pear-core.svg?branch=stable
|
||||
:target: https://travis-ci.org/pear/pear-core
|
||||
|
||||
=========================================
|
||||
What is the PEAR Installer? What is PEAR?
|
||||
=========================================
|
||||
PEAR is the PHP Extension and Application Repository, found at
|
||||
http://pear.php.net.
|
||||
|
||||
The **PEAR Installer** is this software, which contains executable
|
||||
files and PHP code that is used to **download and install** PEAR code
|
||||
from pear.php.net.
|
||||
|
||||
PEAR contains useful **software libraries and applications** such as
|
||||
MDB2 (database abstraction), HTML_QuickForm (HTML forms management),
|
||||
PhpDocumentor (auto-documentation generator), DB_DataObject
|
||||
(Data Access Abstraction), and many hundreds more.
|
||||
Browse all available packages at http://pear.php.net, the list is
|
||||
constantly growing and updating to reflect improvements in the PHP language.
|
||||
|
||||
.. warning::
|
||||
Do not run PEAR without installing it - if you downloaded this
|
||||
tarball manually, you MUST install it. Read the instructions in INSTALL
|
||||
prior to use.
|
||||
|
||||
|
||||
=============
|
||||
Documentation
|
||||
=============
|
||||
Documentation for PEAR can be found at http://pear.php.net/manual/.
|
||||
Installation documentation can be found in the INSTALL file included
|
||||
in this tarball.
|
||||
|
||||
|
||||
=====
|
||||
Tests
|
||||
=====
|
||||
Run the tests without installation as follows::
|
||||
|
||||
$ ./scripts/pear.sh run-tests -r tests
|
||||
|
||||
You should have the ``Text_Diff`` package installed to get nicer error output.
|
||||
|
||||
To run the tests with another PHP version, modify ``php_bin`` and set the
|
||||
``PHP_PEAR_PHP_BIN`` environment variable::
|
||||
|
||||
$ pear config-set php_bin /usr/local/bin/php7
|
||||
$ PHP_PEAR_PHP_BIN=/usr/local/bin/php7 ./scripts/pear.sh run-tests -r tests
|
||||
|
||||
Happy PHPing, we hope PEAR will be a great tool for your development work!
|
||||
|
||||
|
||||
Test dependencies
|
||||
=================
|
||||
* ``zlib``
|
||||
|
||||
|
||||
=========
|
||||
Releasing
|
||||
=========
|
||||
Create a PEAR package as well as phars for pear-less installation::
|
||||
|
||||
$ rm -f PEAR-*.tgz
|
||||
$ pear package package2.xml
|
||||
$ cd go-pear-tarballs
|
||||
$ rm -f PEAR-*
|
||||
$ cp ../PEAR-*.tgz .
|
||||
$ gunzip PEAR-*.tgz
|
||||
$ pear download -Z Archive_Tar Console_Getopt Structures_Graph XML_Util
|
||||
$ mkdir src && cd src
|
||||
$ for i in ../*.tar; do tar xvf $i; done
|
||||
$ mv *\/* .
|
||||
$ cd ../../
|
||||
$ php make-gopear-phar.php
|
||||
$ php make-installpear-nozlib-phar.php
|
||||
|
||||
(Or simply run ``build-release.sh``).
|
||||
|
||||
``go-pear.phar`` is contains the PEAR installer installer that asks questions
|
||||
where to install it.
|
||||
It is available from http://pear.php.net/go-pear.phar.
|
||||
|
||||
``install-pear-nozlib.phar`` installs PEAR automatically without asking
|
||||
anything.
|
||||
It is shipped with PHP itself.
|
||||
165
database/php/docs/Structures_Graph/LICENSE
Normal file
165
database/php/docs/Structures_Graph/LICENSE
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -0,0 +1,98 @@
|
||||
<refentry id="{@id package.database.structures_graph.tutorial}">
|
||||
<refnamediv>
|
||||
<refname><classname>Structures_Graph</classname> Tutorial</refname>
|
||||
<refpurpose>A first tour of graph datastructure manipulation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 id="{@id package.database.structures_graph.tutorial.intro}">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Structures_Graph is a package for creating and manipulating graph datastructures. A graph is a set of objects, called nodes, connected by arcs. When used as a datastructure, usually nodes contain data, and arcs represent relationships between nodes. When arcs have a direction, and can be travelled only one way, graphs are said to be directed. When arcs have no direction, and can always be travelled both ways, graphs are said to be non directed.
|
||||
</para>
|
||||
<para>
|
||||
Structures_Graph provides an object oriented API to create and directly query a graph, as well as a set of Manipulator classes to extract information from the graph.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 id="{@id package.database.structures_graph.tutorial.creation}">
|
||||
<title>Creating a Graph</title>
|
||||
<para>
|
||||
Creating a graph is done using the simple constructor:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
require_once 'Structures/Graph.php';
|
||||
|
||||
$directedGraph =& new Structures_Graph(true);
|
||||
$nonDirectedGraph =& new Structures_Graph(false);
|
||||
]]>
|
||||
</programlisting>
|
||||
and passing the constructor a flag telling it whether the graph should be directed. A directed graph will always be directed during its lifetime. It's a permanent characteristic.
|
||||
</para>
|
||||
<para>
|
||||
To fill out the graph, we'll need to create some nodes, and then call Graph::addNode.
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
require_once 'Structures/Graph/Node.php';
|
||||
|
||||
$nodeOne =& new Structures_Graph_Node();
|
||||
$nodeTwo =& new Structures_Graph_Node();
|
||||
$nodeThree =& new Structures_Graph_Node();
|
||||
|
||||
$directedGraph->addNode(&$nodeOne);
|
||||
$directedGraph->addNode(&$nodeTwo);
|
||||
$directedGraph->addNode(&$nodeThree);
|
||||
]]>
|
||||
</programlisting>
|
||||
and then setup the arcs:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
$nodeOne->connectTo($nodeTwo);
|
||||
$nodeOne->connectTo($nodeThree);
|
||||
]]>
|
||||
</programlisting>
|
||||
Note that arcs can only be created after the nodes have been inserted into the graph.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 id="{@id package.database.structures_graph.tutorial.nodesanddata}">
|
||||
<title>Associating Data</title>
|
||||
<para>
|
||||
Graphs are only useful as datastructures if they can hold data. Structure_Graph stores data in nodes. Each node contains a setter and a getter for its data.
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
$nodeOne->setData("Node One's Data is a String");
|
||||
$nodeTwo->setData(1976);
|
||||
$nodeThree->setData('Some other string');
|
||||
|
||||
print("NodeTwo's Data is an integer: " . $nodeTwo->getData());
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Structure_Graph nodes can also store metadata, alongside with the main data. Metadata differs from regular data just because it is stored under a key, making it possible to store more than one data reference per node. The metadata getter and setter need the key to perform the operation:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
$nodeOne->setMetadata('example key', "Node One's Sample Metadata");
|
||||
print("Metadata stored under key 'example key' in node one: " . $nodeOne->getMetadata('example key'));
|
||||
$nodeOne->unsetMetadata('example key');
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 id="{@id package.database.structures_graph.tutorial.querying}">
|
||||
<title>Querying a Graph</title>
|
||||
<para>
|
||||
Structures_Graph provides for basic querying of the graph:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
// Nodes are able to calculate their indegree and outdegree
|
||||
print("NodeOne's inDegree: " . $nodeOne->inDegree());
|
||||
print("NodeOne's outDegree: " . $nodeOne->outDegree());
|
||||
|
||||
// and naturally, nodes can report on their arcs
|
||||
$arcs = $nodeOne->getNeighbours();
|
||||
for ($i=0;$i<sizeof($arcs);$i++) {
|
||||
print("NodeOne has an arc to " . $arcs[$i]->getData());
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
299
database/php/docs/XML_Util/examples/example.php
Normal file
299
database/php/docs/XML_Util/examples/example.php
Normal file
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Examples (file #1)
|
||||
*
|
||||
* several examples for the methods of XML_Util
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2003-2008 Stephan Schmidt <schst@php.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category XML
|
||||
* @package XML_Util
|
||||
* @subpackage Examples
|
||||
* @author Stephan Schmidt <schst@php.net>
|
||||
* @copyright 2003-2008 Stephan Schmidt <schst@php.net>
|
||||
* @license http://opensource.org/licenses/bsd-license New BSD License
|
||||
* @version CVS: $Id$
|
||||
* @link http://pear.php.net/package/XML_Util
|
||||
*/
|
||||
|
||||
/**
|
||||
* set error level
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once 'XML/Util.php';
|
||||
|
||||
/**
|
||||
* replacing XML entities
|
||||
*/
|
||||
print 'replace XML entities:<br>';
|
||||
print XML_Util::replaceEntities('This string contains < & >.');
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* reversing XML entities
|
||||
*/
|
||||
print 'replace XML entities:<br>';
|
||||
print XML_Util::reverseEntities('This string contains < & >.');
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* building XML declaration
|
||||
*/
|
||||
print 'building XML declaration:<br>';
|
||||
print htmlspecialchars(XML_Util::getXMLDeclaration());
|
||||
print "\n<br><br>\n";
|
||||
|
||||
print 'building XML declaration with additional attributes:<br>';
|
||||
print htmlspecialchars(XML_Util::getXMLDeclaration('1.0', 'UTF-8', true));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* building document type declaration
|
||||
*/
|
||||
print 'building DocType declaration:<br>';
|
||||
print htmlspecialchars(XML_Util::getDocTypeDeclaration('package',
|
||||
'http://pear.php.net/dtd/package-1.0'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
print 'building DocType declaration with public ID (does not exist):<br>';
|
||||
print htmlspecialchars(XML_Util::getDocTypeDeclaration('package',
|
||||
array('uri' => 'http://pear.php.net/dtd/package-1.0',
|
||||
'id' => '-//PHP//PEAR/DTD PACKAGE 0.1')));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
print 'building DocType declaration with internal DTD:<br>';
|
||||
print '<pre>';
|
||||
print htmlspecialchars(XML_Util::getDocTypeDeclaration('package',
|
||||
'http://pear.php.net/dtd/package-1.0',
|
||||
'<!ELEMENT additionalInfo (#PCDATA)>'));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an attribute string
|
||||
*/
|
||||
$att = array(
|
||||
'foo' => 'bar',
|
||||
'argh' => 'tomato'
|
||||
);
|
||||
|
||||
print 'converting array to string:<br>';
|
||||
print XML_Util::attributesToString($att);
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* creating an attribute string with linebreaks
|
||||
*/
|
||||
$att = array(
|
||||
'foo' => 'bar',
|
||||
'argh' => 'tomato'
|
||||
);
|
||||
|
||||
print 'converting array to string (including line breaks):<br>';
|
||||
print '<pre>';
|
||||
print XML_Util::attributesToString($att, true, true);
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* splitting a qualified tag name
|
||||
*/
|
||||
print 'splitting qualified tag name:<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::splitQualifiedName('xslt:stylesheet'));
|
||||
print '</pre>';
|
||||
print "\n<br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* splitting a qualified tag name (no namespace)
|
||||
*/
|
||||
print 'splitting qualified tag name (no namespace):<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::splitQualifiedName('foo'));
|
||||
print '</pre>';
|
||||
print "\n<br>\n";
|
||||
|
||||
/**
|
||||
* splitting a qualified tag name (no namespace, but default namespace specified)
|
||||
*/
|
||||
print 'splitting qualified tag name '
|
||||
. '(no namespace, but default namespace specified):<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::splitQualifiedName('foo', 'bar'));
|
||||
print '</pre>';
|
||||
print "\n<br>\n";
|
||||
|
||||
/**
|
||||
* verifying XML names
|
||||
*/
|
||||
print 'verifying \'My private tag\':<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::isValidname('My Private Tag'));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
print 'verifying \'-MyTag\':<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::isValidname('-MyTag'));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag
|
||||
*/
|
||||
$tag = array(
|
||||
'namespace' => 'foo',
|
||||
'localPart' => 'bar',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
|
||||
'content' => 'I\'m inside the tag'
|
||||
);
|
||||
|
||||
print 'creating a tag with namespace and local part:<br>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'foo:bar',
|
||||
'namespaceUri' => 'http://foo.com',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
|
||||
'content' => 'I\'m inside the tag'
|
||||
);
|
||||
|
||||
print 'creating a tag with qualified name and namespaceUri:<br>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'bar',
|
||||
'namespaceUri' => 'http://foo.com',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable')
|
||||
);
|
||||
|
||||
print 'creating an empty tag without namespace but namespace Uri:<br>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag with more namespaces
|
||||
*/
|
||||
$tag = array(
|
||||
'namespace' => 'foo',
|
||||
'localPart' => 'bar',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
|
||||
'content' => 'I\'m inside the tag',
|
||||
'namespaces' => array(
|
||||
'bar' => 'http://bar.com',
|
||||
'pear' => 'http://pear.php.net',
|
||||
)
|
||||
);
|
||||
|
||||
print 'creating an XML tag with more namespaces:<br />';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag with a CData Section
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'foo',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
|
||||
'content' => 'I\'m inside the tag'
|
||||
);
|
||||
|
||||
print 'creating a tag with CData section:<br>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_CDATA_SECTION));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag with a CData Section
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'foo',
|
||||
'attributes' => array('key' => 'value', 'argh' => 't<>t<EFBFBD>'),
|
||||
'content' =>
|
||||
'Also XHTML-tags can be created '
|
||||
. 'and HTML entities can be replaced <20> <20> <20> <20> <>.'
|
||||
);
|
||||
|
||||
print 'creating a tag with HTML entities:<br>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_ENTITIES_HTML));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag with createTag
|
||||
*/
|
||||
print 'creating a tag with createTag:<br>';
|
||||
print htmlentities(XML_Util::createTag('myNs:myTag',
|
||||
array('foo' => 'bar'),
|
||||
'This is inside the tag',
|
||||
'http://www.w3c.org/myNs#'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* trying to create an XML tag with an array as content
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'bar',
|
||||
'content' => array('foo' => 'bar')
|
||||
);
|
||||
print 'trying to create an XML tag with an array as content:<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::createTagFromArray($tag));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* trying to create an XML tag without a name
|
||||
*/
|
||||
$tag = array(
|
||||
'attributes' => array('foo' => 'bar'),
|
||||
);
|
||||
print 'trying to create an XML tag without a name:<br>';
|
||||
print '<pre>';
|
||||
print_r(XML_Util::createTagFromArray($tag));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
?>
|
||||
145
database/php/docs/XML_Util/examples/example2.php
Normal file
145
database/php/docs/XML_Util/examples/example2.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Examples (file #2)
|
||||
*
|
||||
* several examples for the methods of XML_Util
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2003-2008 Stephan Schmidt <schst@php.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category XML
|
||||
* @package XML_Util
|
||||
* @subpackage Examples
|
||||
* @author Stephan Schmidt <schst@php.net>
|
||||
* @copyright 2003-2008 Stephan Schmidt <schst@php.net>
|
||||
* @license http://opensource.org/licenses/bsd-license New BSD License
|
||||
* @version CVS: $Id$
|
||||
* @link http://pear.php.net/package/XML_Util
|
||||
*/
|
||||
|
||||
/**
|
||||
* set error level
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once 'XML/Util.php';
|
||||
|
||||
/**
|
||||
* creating a start element
|
||||
*/
|
||||
print 'creating a start element:<br>';
|
||||
print htmlentities(XML_Util::createStartElement('myNs:myTag',
|
||||
array('foo' => 'bar'), 'http://www.w3c.org/myNs#'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* creating a start element
|
||||
*/
|
||||
print 'creating a start element:<br>';
|
||||
print htmlentities(XML_Util::createStartElement('myTag',
|
||||
array(), 'http://www.w3c.org/myNs#'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating a start element
|
||||
*/
|
||||
print 'creating a start element:<br>';
|
||||
print '<pre>';
|
||||
print htmlentities(XML_Util::createStartElement('myTag',
|
||||
array('foo' => 'bar', 'argh' => 'tomato'),
|
||||
'http://www.w3c.org/myNs#', true));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* creating an end element
|
||||
*/
|
||||
print 'creating an end element:<br>';
|
||||
print htmlentities(XML_Util::createEndElement('myNs:myTag'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating a CData section
|
||||
*/
|
||||
print 'creating a CData section:<br>';
|
||||
print htmlentities(XML_Util::createCDataSection('I am content.'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating a comment
|
||||
*/
|
||||
print 'creating a comment:<br>';
|
||||
print htmlentities(XML_Util::createComment('I am a comment.'));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* creating an XML tag with multiline mode
|
||||
*/
|
||||
$tag = array(
|
||||
'qname' => 'foo:bar',
|
||||
'namespaceUri' => 'http://foo.com',
|
||||
'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
|
||||
'content' => 'I\'m inside the tag & contain dangerous chars'
|
||||
);
|
||||
|
||||
print 'creating a tag with qualified name and namespaceUri:<br>';
|
||||
print '<pre>';
|
||||
print htmlentities(XML_Util::createTagFromArray($tag,
|
||||
XML_UTIL_REPLACE_ENTITIES, true));
|
||||
print '</pre>';
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* create an attribute string without replacing the entities
|
||||
*/
|
||||
$atts = array('series' => 'Starsky & Hutch', 'channel' => 'ABC');
|
||||
print 'creating a attribute string, '
|
||||
. 'entities in values already had been replaced:<br>';
|
||||
print htmlentities(XML_Util::attributesToString($atts,
|
||||
true, false, false, false, XML_UTIL_ENTITIES_NONE));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
/**
|
||||
* using the array-syntax for attributesToString()
|
||||
*/
|
||||
$atts = array('series' => 'Starsky & Hutch', 'channel' => 'ABC');
|
||||
print 'using the array-syntax for attributesToString()<br>';
|
||||
print htmlentities(XML_Util::attributesToString($atts,
|
||||
array('entities' => XML_UTIL_ENTITIES_NONE)));
|
||||
print "\n<br><br>\n";
|
||||
|
||||
|
||||
?>
|
||||
36
database/php/docs/examples/checkConstants.php
Normal file
36
database/php/docs/examples/checkConstants.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Test Constants that appeared in >= 4.3.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Davey Shafik <davey@php.net>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: checkConstants.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
function test_constants()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$file = __FILE__;
|
||||
|
||||
$r = $info->parseFile($file);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
53
database/php/docs/examples/checkExtensions.php
Normal file
53
database/php/docs/examples/checkExtensions.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Test Extensions that appeared both as standard or PECL
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: checkExtensions.php,v 1.3 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
xdebug_start_trace();
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
function test_extensions()
|
||||
{
|
||||
$image = imagecreate(320, 240);
|
||||
imageantialias($image, true);
|
||||
return $image;
|
||||
}
|
||||
|
||||
/*
|
||||
Cannot be parsed on CLI
|
||||
print_r(apache_get_modules());
|
||||
*/
|
||||
|
||||
if (!extension_loaded('sqlite')) {
|
||||
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
|
||||
dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
|
||||
}
|
||||
|
||||
xdebug_stop_trace();
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$file = __FILE__;
|
||||
$options = array('debug' => true);
|
||||
|
||||
$r = $info->parseFile($file, $options);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
118
database/php/docs/examples/checkPHP5.php
Normal file
118
database/php/docs/examples/checkPHP5.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Test tokens that appeared in PHP 5
|
||||
* T_ABSTRACT
|
||||
* T_CATCH
|
||||
* T_FINAL
|
||||
* T_INSTANCEOF
|
||||
* T_PRIVATE
|
||||
* T_PROTECTED
|
||||
* T_PUBLIC
|
||||
* T_THROW
|
||||
* T_TRY
|
||||
* T_CLONE
|
||||
* T_INTERFACE
|
||||
* T_IMPLEMENTS
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: checkPHP5.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
abstract class AbstractClass
|
||||
{
|
||||
abstract protected function getValue();
|
||||
}
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
interface ITemplate
|
||||
{
|
||||
public function setVariable($name, $var);
|
||||
public function getHtml($template);
|
||||
}
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class Template implements ITemplate
|
||||
{
|
||||
private $vars = array();
|
||||
|
||||
public function setVariable($name, $var)
|
||||
{
|
||||
$this->vars[$name] = $var;
|
||||
}
|
||||
|
||||
public function getHtml($template)
|
||||
{
|
||||
foreach ($this->vars as $name => $value) {
|
||||
$template = str_replace('{' . $name . '}', $value, $template);
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class BaseClass
|
||||
{
|
||||
public $objet1;
|
||||
public $objet2;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->object1 = clone($this->object1);
|
||||
}
|
||||
|
||||
private function foo()
|
||||
{
|
||||
}
|
||||
|
||||
protected function bar()
|
||||
{
|
||||
if ($this->object1 instanceof BaseClass) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$error = 'my error';
|
||||
throw new Exception($error);
|
||||
|
||||
} catch(Exception $__bar_exception) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
final public function moreTesting()
|
||||
{
|
||||
echo "BaseClass::moreTesting() called \n";
|
||||
}
|
||||
}
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$file = __FILE__;
|
||||
$options = array('debug' => true);
|
||||
|
||||
$r = $info->parseFile($file, $options);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
274
database/php/docs/examples/ci_frontend.php
Normal file
274
database/php/docs/examples/ci_frontend.php
Normal file
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* PEAR::CompatInfo Web frontend
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: ci_frontend.php,v 1.6 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PEAR/Registry.php';
|
||||
require_once 'HTML/QuickForm.php';
|
||||
require_once 'HTML/QuickForm/advmultiselect.php';
|
||||
|
||||
if (version_compare(phpversion(), '5.0.0', '<')) {
|
||||
include_once 'PHP/Compat.php';
|
||||
PHP_Compat::loadFunction('array_combine');
|
||||
}
|
||||
|
||||
session_start();
|
||||
$sess =& $_SESSION;
|
||||
|
||||
$config = new PEAR_Config();
|
||||
$pear_install_dir = $config->get('php_dir');
|
||||
$reg = new PEAR_Registry($pear_install_dir);
|
||||
|
||||
if (count($sess) == 0) {
|
||||
|
||||
// PEAR packages installed from each channel
|
||||
$allpackages = $reg->listAllPackages();
|
||||
foreach ($allpackages as $channel => $packages) {
|
||||
if ($packages) {
|
||||
sort($packages, SORT_ASC);
|
||||
foreach ($packages as $package) {
|
||||
$info = &$reg->getPackage($package, $channel);
|
||||
if (is_object($info)) {
|
||||
$name = $info->getPackage();
|
||||
$version = $info->getVersion();
|
||||
$release_state = $info->getState();
|
||||
} else {
|
||||
$name = $info['package'];
|
||||
$version = $info['version'];
|
||||
$release_state = $info['state'];
|
||||
}
|
||||
$sess['packages'][$channel][] = "$name $version ($release_state)";
|
||||
}
|
||||
} else {
|
||||
$sess['packages'][$channel] = array();
|
||||
}
|
||||
}
|
||||
|
||||
// channels
|
||||
$channels = array_keys($sess['packages']);
|
||||
array_unshift($channels, '');
|
||||
$sess['channels'] = array_combine($channels, $channels);
|
||||
|
||||
// packages
|
||||
$names[''] = array();
|
||||
foreach ($sess['packages'] as $c => $p) {
|
||||
if (count($p)) {
|
||||
$l = array();
|
||||
foreach ($p as $k) {
|
||||
list($n, $v, $s) = explode(' ', $k);
|
||||
$l[] = $n;
|
||||
}
|
||||
$names[$c] = array_combine($l, $p);
|
||||
} else {
|
||||
$names[$c] = array();
|
||||
}
|
||||
}
|
||||
$sess['pkgnames'] = $names;
|
||||
|
||||
// PHP internal functions
|
||||
$func = get_defined_functions();
|
||||
sort($func['internal']);
|
||||
$sess['phpfunctions'] = $func['internal'];
|
||||
}
|
||||
|
||||
// ignore functions
|
||||
$ignore_functions = array_combine($sess['phpfunctions'], $sess['phpfunctions']);
|
||||
|
||||
// web frontend
|
||||
$form = new HTML_QuickForm('cife');
|
||||
$form->removeAttribute('name'); // XHTML compliance
|
||||
|
||||
// header
|
||||
$form->addElement('header', 'cife_hdr', 'CompatInfo :: Web frontend');
|
||||
|
||||
// ignore functions
|
||||
$ams1 =& $form->addElement('advmultiselect', 'ignore_functions', null,
|
||||
$ignore_functions,
|
||||
array('size' => 5, 'style' => 'width:250px;', 'class' => 'pool'));
|
||||
$ams1->setLabel(array('PHP functions:', 'available', 'ignore'));
|
||||
|
||||
// packages installed
|
||||
$pkgInstalled =& $form->addElement('hierselect', 'package', null, array('class' => 'flat'), ' ');
|
||||
$pkgInstalled->setLabel('Packages installed:');
|
||||
$pkgInstalled->setOptions(array($sess['channels'], $sess['pkgnames']));
|
||||
$form->addElement('submit', 'filelist', 'File List');
|
||||
|
||||
// ignore files
|
||||
$safe = $form->getSubmitValues();
|
||||
|
||||
if (isset($safe['filelist'])) {
|
||||
$package = &$reg->getPackage($safe['package'][1], $safe['package'][0]);
|
||||
$files = array();
|
||||
|
||||
$filelist = $package->getFilelist();
|
||||
foreach ($filelist as $name => $atts) {
|
||||
if (isset($atts['role']) && $atts['role'] != 'php') {
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/\.php$/', $name)) {
|
||||
continue;
|
||||
}
|
||||
$files[] = $atts['installed_as'];
|
||||
}
|
||||
$sess['phpfiles'] = $files;
|
||||
$labels = str_replace($pear_install_dir . DIRECTORY_SEPARATOR, '', $files);
|
||||
$ignore_files = array_combine($files, $labels);
|
||||
|
||||
} else {
|
||||
$ignore_files = array();
|
||||
}
|
||||
|
||||
$ams2 =& $form->addElement('advmultiselect', 'ignore_files', null,
|
||||
$ignore_files,
|
||||
array('size' => 5, 'style' => 'width:300px;', 'class' => 'pool'));
|
||||
$ams2->setLabel(array('Package files (role=php):', 'available', 'ignore'));
|
||||
|
||||
// dump options
|
||||
$dump =& $form->addElement('checkbox', 'dump');
|
||||
$dump->setLabel('Dump:');
|
||||
$dump->setText('PHP min version only');
|
||||
|
||||
$dbg =& $form->addElement('checkbox', 'dbg');
|
||||
$dbg->setLabel('Debug:');
|
||||
$dbg->setText('Extra output');
|
||||
|
||||
// commands
|
||||
$form->addElement('submit', 'process', 'Process');
|
||||
$form->addElement('submit', 'abort', 'Abort');
|
||||
|
||||
// initial values
|
||||
$form->setDefaults(array(
|
||||
'ignore_functions' => array(),
|
||||
'ignore_files' => array(),
|
||||
'dump' => true
|
||||
));
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>PEAR::PHP_CompatInfo Web frontend </title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {
|
||||
background-color: #FFF;
|
||||
font-family: Verdana, Arial, helvetica;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.dump {
|
||||
background-color: #EEE;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table.pool {
|
||||
border: 0;
|
||||
background-color: #339900;
|
||||
width:450px;
|
||||
}
|
||||
table.pool th {
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
text-align: left;
|
||||
}
|
||||
table.pool select {
|
||||
color: white;
|
||||
background-color: #006600;
|
||||
}
|
||||
|
||||
.inputCommand {
|
||||
background-color: #d0d0d0;
|
||||
border: 1px solid #7B7B88;
|
||||
width: 7em;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
<?php
|
||||
echo $ams1->getElementJs();
|
||||
|
||||
echo $ams2->getElementJs();
|
||||
?>
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if ($form->validate()) {
|
||||
$safe = $form->getSubmitValues();
|
||||
|
||||
if (isset($safe['ignore_files'])) {
|
||||
$ignore_files = $safe['ignore_files'];
|
||||
} else {
|
||||
$ignore_files = array();
|
||||
}
|
||||
if (isset($safe['ignore_functions'])) {
|
||||
$ignore_functions = $safe['ignore_functions'];
|
||||
} else {
|
||||
$ignore_functions = array();
|
||||
}
|
||||
|
||||
if (!isset($sess['phpfiles']) && !isset($safe['abort'])) {
|
||||
echo '<p class="error">Please get file list before to process.</p>';
|
||||
} else {
|
||||
if (isset($safe['process'])) {
|
||||
|
||||
include_once 'PHP/CompatInfo.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$options = array(
|
||||
'debug' => (isset($safe['dbg'])),
|
||||
'ignore_files' => $ignore_files,
|
||||
'ignore_functions' => $ignore_functions
|
||||
);
|
||||
|
||||
$res = $info->parseArray($sess['phpfiles'], $options);
|
||||
|
||||
$php = $res['version'];
|
||||
|
||||
echo "<h1>CompatInfo for package {$safe['package'][1]}</h1>";
|
||||
echo "<h2>PHP $php min is required</h2>";
|
||||
|
||||
if (!isset($safe['dump'])) {
|
||||
echo '<pre class="dump">';
|
||||
var_dump($res);
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($safe['process']) || isset($safe['abort'])) {
|
||||
// cleansweep before quit
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
if (isset($safe['abort'])) {
|
||||
echo '<h1>Task was aborted !</h1>';
|
||||
}
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form->display();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
21
database/php/docs/examples/cliCustom.php
Normal file
21
database/php/docs/examples/cliCustom.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* How to cutomize CLI output version. Requires at least version 1.3.1
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: cliCustom.php,v 1.5 2008/07/22 21:09:37 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
* @deprecated since version 1.8.0b2
|
||||
*/
|
||||
require_once 'PHP/CompatInfo/Cli.php';
|
||||
|
||||
// split filename to 30 char. max and continuation char. is +
|
||||
$cli = new PHP_CompatInfo_Cli(30, '+');
|
||||
$cli->run();
|
||||
?>
|
||||
35
database/php/docs/examples/cliOutput.txt
Normal file
35
database/php/docs/examples/cliOutput.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
+----------------------+---------+------------+-----------+
|
||||
| File | Version | Extensions | Constants |
|
||||
+----------------------+---------+------------+-----------+
|
||||
| ..\..\CompatInfo.php | 4.3.0 | tokenizer | |
|
||||
| | | sockets | |
|
||||
+----------------------+---------+------------+-----------+
|
||||
|
||||
Debug:
|
||||
|
||||
+---------+-------------------+---------------+
|
||||
| Version | Function | Extension |
|
||||
+---------+-------------------+---------------+
|
||||
| 4.3.0 | file_get_contents | ext_standard |
|
||||
| 4.2.0 | token_get_all | ext_tokenizer |
|
||||
| 4.1.0 | version_compare | ext_standard |
|
||||
| 4.0.6 | array_map | ext_standard |
|
||||
| 4.0.3 | pathinfo | ext_standard |
|
||||
| 4.0.2 | read | ext_sockets |
|
||||
| 4.0.2 | close | ext_sockets |
|
||||
| 4.0.1 | array_unique | ext_standard |
|
||||
| 4.0.0 | array_merge | ext_standard |
|
||||
| 4.0.0 | strlen | zend |
|
||||
| 4.0.0 | substr | ext_standard |
|
||||
| 4.0.0 | is_dir | ext_standard |
|
||||
| 4.0.0 | is_readable | ext_standard |
|
||||
| 4.0.0 | in_array | ext_standard |
|
||||
| 4.0.0 | strtolower | ext_standard |
|
||||
| 4.0.0 | sizeof | ext_standard |
|
||||
| 4.0.0 | array_reverse | ext_standard |
|
||||
| 4.0.0 | ksort | ext_standard |
|
||||
| 4.0.0 | is_string | ext_standard |
|
||||
| 4.0.0 | dir | ext_standard |
|
||||
| 4.0.0 | is_file | ext_standard |
|
||||
| 4.0.0 | is_array | ext_standard |
|
||||
+---------+-------------------+---------------+
|
||||
33
database/php/docs/examples/ignorePHP5implements.php
Normal file
33
database/php/docs/examples/ignorePHP5implements.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Exclude all PHP5 functions when calculating the version needed.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: ignorePHP5implements.php,v 1.5 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$dir = 'C:\PEAR\Tools and utilities\PhpDocumentor-1.3.0';
|
||||
$options = array(
|
||||
'debug' => true,
|
||||
'ignore_functions' => PHP_CompatInfo::loadVersion('5.0.0'),
|
||||
'ignore_constants' => array('clone', 'public')
|
||||
);
|
||||
|
||||
$r = $info->parseFolder($dir, $options);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
34
database/php/docs/examples/parseArray.php
Normal file
34
database/php/docs/examples/parseArray.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for an array
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Davey Shafik <davey@php.net>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: parseArray.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
require_once 'PEAR.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$files = get_included_files();
|
||||
$options = array(
|
||||
'debug' => false,
|
||||
'ignore_files' => array($files[0]),
|
||||
'ignore_functions' => array('debug_backtrace')
|
||||
);
|
||||
|
||||
$r = $info->parseArray($files, $options);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
33
database/php/docs/examples/parseDir.php
Normal file
33
database/php/docs/examples/parseDir.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for an entire folder (recursive)
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Davey Shafik <davey@php.net>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: parseDir.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$folder = dirname(__FILE__);
|
||||
$options = array(
|
||||
'file_ext' => array('php3', 'php'),
|
||||
'ignore_files' => array(__FILE__)
|
||||
);
|
||||
|
||||
var_dump($options);
|
||||
$r = $info->parseFolder($folder, $options);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Show a progress bar when parsing a directory from CLI
|
||||
* Do not display any progress bar from other SAPI
|
||||
*
|
||||
* To run on Windows platform, do:
|
||||
* (path to PHP cli)\php.exe -f (this script)
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: parseDir_withCustomProgressBar.php,v 1.4 2008/07/24 21:18:08 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
if (php_sapi_name() == 'cli') {
|
||||
/*
|
||||
Display a progress bar like this one:
|
||||
|
||||
[))))) ] 8% - 45/563 files
|
||||
|
||||
*/
|
||||
$pbar = array('formatString' => '[%bar%] %percent% - %fraction% files',
|
||||
'barfill' => ')',
|
||||
'prefill' => ' ',
|
||||
'options' => array('percent_precision' => 0));
|
||||
|
||||
$driverType = 'text';
|
||||
$driverOptions = array('silent' => false, 'progress' => 'bar',
|
||||
'progressbar' => $pbar);
|
||||
|
||||
} else {
|
||||
$driverType = 'array';
|
||||
$driverOptions = array();
|
||||
}
|
||||
|
||||
$info = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
$dir = 'C:\php\pear\HTML_Progress2';
|
||||
$r = $info->parseDir($dir);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
27
database/php/docs/examples/parseFile.php
Normal file
27
database/php/docs/examples/parseFile.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a single file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Davey Shafik <davey@php.net>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: parseFile.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
$file = __FILE__;
|
||||
|
||||
$r = $info->parseFile($file);
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
26
database/php/docs/examples/parseString.php
Normal file
26
database/php/docs/examples/parseString.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a string
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Davey Shafik <davey@php.net>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: parseString.php,v 1.7 2008/07/22 21:13:14 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
$info = new PHP_CompatInfo();
|
||||
|
||||
$r = $info->parseString('<?php $file = file_get_contents(__FILE__); $tokens = token_get_all($file); ?>');
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
26
database/php/docs/examples/pci180_loadversion.php
Normal file
26
database/php/docs/examples/pci180_loadversion.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Get PHP functions and constants history from a range of version,
|
||||
* group by version number
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_loadversion.php,v 1.3 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0RC2 (2008-07-18)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
$r = $compatInfo->loadVersion('4.3.2', '4.4.0', true, true);
|
||||
var_export($r);
|
||||
?>
|
||||
56
database/php/docs/examples/pci180_parsearray_files.php
Normal file
56
database/php/docs/examples/pci180_parsearray_files.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a list of different source (directory, file)
|
||||
* which may have no link between them.
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsearray_files.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b3 (2008-06-07)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With all default options, its same as version 1.8.0b1 or less
|
||||
No need to specify driver type ('array') and options, in class constructor
|
||||
Results display made with PHP::var_export
|
||||
*/
|
||||
//$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
*/
|
||||
$driverType = 'array';
|
||||
|
||||
/*
|
||||
Display wait messages or a progress bar (PEAR::Console_ProgressBar)
|
||||
if available while parsing data source
|
||||
Default behavior is: silent = true (no wait system)
|
||||
Use (progress => text) if you don't want a progress bar but only text messages
|
||||
*/
|
||||
$driverOptions = array('silent' => false, 'progress' => 'bar');
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$source = array('C:\wamp\tmp\Log-1.10.0\Log', 'C:\wamp\tmp\File_Find-1.3.0\Find.php');
|
||||
$options = array();
|
||||
$r = $compatInfo->parseArray($source, $options);
|
||||
// You may also use the new unified method parseData(), parseArray() became an alias
|
||||
//$r = $compatInfo->parseData($source, $options);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
86
database/php/docs/examples/pci180_parsearray_strings.php
Normal file
86
database/php/docs/examples/pci180_parsearray_strings.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a list of chunk of code (strings)
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsearray_strings.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b3 (2008-06-07)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With all default options, its same as version 1.8.0b1 or less
|
||||
No need to specify driver type ('array') and options, in class constructor
|
||||
Results display made with PHP::var_export
|
||||
*/
|
||||
//$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
*/
|
||||
$driverType = 'array';
|
||||
|
||||
/*
|
||||
Display wait messages or a progress bar (PEAR::Console_ProgressBar)
|
||||
if available while parsing data source
|
||||
Default behavior is: silent = true (no wait system)
|
||||
*/
|
||||
$driverOptions = array('silent' => false, 'progress' => 'text');
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$str1 = '<?php
|
||||
$nl = "\n";
|
||||
echo "$nl Atom = " . DATE_ATOM;
|
||||
echo "$nl Cookie = " . DATE_COOKIE;
|
||||
echo "$nl Iso8601 = " . DATE_ISO8601;
|
||||
echo "$nl Rfc822 = " . DATE_RFC822;
|
||||
echo "$nl Rfc850 = " . DATE_RFC850;
|
||||
echo "$nl Rfc1036 = " . DATE_RFC1036;
|
||||
echo "$nl Rfc1123 = " . DATE_RFC1123;
|
||||
echo "$nl Rfc2822 = " . DATE_RFC2822;
|
||||
echo "$nl RSS = " . DATE_RSS;
|
||||
echo "$nl W3C = " . DATE_W3C;
|
||||
?>';
|
||||
|
||||
$str2 = '<?php
|
||||
class Request6056
|
||||
{
|
||||
function testMaxVersion()
|
||||
{
|
||||
// PHP 5 <= 5.0.4
|
||||
$res = php_check_syntax(\'bug6581.php\');
|
||||
|
||||
$array1 = array(\'blue\' => 1, \'red\' => 2, \'green\' => 3);
|
||||
$array2 = array(\'green\' => 5, \'blue\' => 6, \'yellow\' => 7);
|
||||
|
||||
// PHP 5 >= 5.1.0RC1
|
||||
$diff = array_diff_key($array1, $array2);
|
||||
}
|
||||
}
|
||||
?>';
|
||||
$source = array($str1, $str2);
|
||||
// CAUTION: if you forget this option, you will have no output except a FALSE result (see $r)
|
||||
$options = array('is_string' => true);
|
||||
|
||||
$r = $compatInfo->parseArray($source, $options);
|
||||
// You may also use the new unified method parseData(), parseArray() became an alias
|
||||
//$r = $compatInfo->parseData($source, $options);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
43
database/php/docs/examples/pci180_parsedata_toxml.php
Normal file
43
database/php/docs/examples/pci180_parsedata_toxml.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a chunk of code
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
* Especially the xml renderer
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsedata_toxml.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0RC2 (2008-07-18)
|
||||
* @ignore
|
||||
*/
|
||||
header('Content-type: text/xml');
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
|
||||
Here we choose to display result as XML stream,
|
||||
Even if PEAR::XML_Beautifier package is available (installed) we won't use it
|
||||
*/
|
||||
$driverType = 'xml';
|
||||
|
||||
/*
|
||||
Won't use PEAR::XML_Beautifier
|
||||
(reason bug #5450 http://pear.php.net/bugs/bug.php?id=5450, that strip XML declaration)
|
||||
*/
|
||||
$driverOptions = array('use-beautifier' => 'no');
|
||||
|
||||
$source = array('C:\wamp\tmp\Log-1.10.0\Log', 'C:\wamp\tmp\File_Find-1.3.0\Find.php');
|
||||
$options = array('debug' => true);
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
$compatInfo->parseData($source, $options);
|
||||
?>
|
||||
130
database/php/docs/examples/pci180_parsedir_tohtml.php
Normal file
130
database/php/docs/examples/pci180_parsedir_tohtml.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a list of files into a directory
|
||||
* Output is produced by a custom renderer (html2).
|
||||
* Rather than write your own stylesheet, you may use the default one, and
|
||||
* change some colors on the fly.
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsedir_tohtml.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b4 (2008-06-18)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
require_once 'PHP/CompatInfo/Renderer.php';
|
||||
require_once 'PHP/CompatInfo/Renderer/Html.php';
|
||||
|
||||
/**
|
||||
* Custom html layout
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
class PHP_CompatInfo_Renderer_Html2 extends PHP_CompatInfo_Renderer_Html
|
||||
{
|
||||
/**
|
||||
* Html2 Renderer Class constructor
|
||||
*
|
||||
* @param object &$parser Instance of the parser (model of MVC pattern)
|
||||
* @param array $conf A hash containing any additional configuration
|
||||
*
|
||||
* @access public
|
||||
* @since version 1.8.0b4 (2008-06-18)
|
||||
*/
|
||||
function PHP_CompatInfo_Renderer_Html2(&$parser, $conf)
|
||||
{
|
||||
parent::__construct($parser, $conf);
|
||||
// use default stylesheet (pci.css)
|
||||
$this->setStyleSheet(); // Important: do not remove it
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML code of parsing result
|
||||
*
|
||||
* @param object $obj instance of HTML_Table
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function toHtml($obj)
|
||||
{
|
||||
$styles = $this->getStyleSheet(3, array(&$this, '_getStyles'));
|
||||
|
||||
$body = $obj->toHtml();
|
||||
|
||||
$html = <<<HTML
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
||||
<meta name="author" content="Laurent Laville" />
|
||||
<title>my PCI widget</title>
|
||||
<link rel="stylesheet" type="text/css" href="yoursite.css" />
|
||||
<link rel="stylesheet" type="text/css" href="$styles" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
<h1>Laurent-Laville.org</h1>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
</div>
|
||||
|
||||
<div id="contents">
|
||||
|
||||
<div class="outer">
|
||||
<div class="inner">
|
||||
$body
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* User callback to modify stylesheet object
|
||||
*
|
||||
* @param object $css Instance of HTML_CSS
|
||||
* @return string
|
||||
* @access private
|
||||
*/
|
||||
function _getStyles($css)
|
||||
{
|
||||
$stylesheet = 'pciskin.css';
|
||||
$css->setStyle('.inner', 'height', '12em');
|
||||
$css->setStyle('.inner .even', 'background-color', '#449922');
|
||||
$css->setStyle('.inner .even', 'color', '#FFFFFF');
|
||||
$css->setStyle('.outer thead td', 'background-color', '#006600');
|
||||
$css->setStyle('.outer tfoot td', 'background-color', '#006600');
|
||||
$css->toFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . $stylesheet);
|
||||
return $stylesheet;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Display parsing result of directory '$source' with a website integration
|
||||
look and feel.
|
||||
*/
|
||||
$driverType = 'html2';
|
||||
$driverOptions = array('args' => array('output-level' => 18));
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$source = 'C:\wamp\tmp\Services_W3C_CSSValidator-0.1.0';
|
||||
$compatInfo->parseData($source);
|
||||
?>
|
||||
56
database/php/docs/examples/pci180_parsefile.php
Normal file
56
database/php/docs/examples/pci180_parsefile.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a single file
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsefile.php,v 1.3 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b2 (2008-06-03)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With all default options, its same as version 1.8.0b1 or less
|
||||
No need to specify driver type ('array') and options, in class constructor
|
||||
Results display made with PHP::var_export
|
||||
*/
|
||||
//$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
|
||||
Here we choose to display result still as an array, but with PEAR::Var_Dump
|
||||
package if available (installed).
|
||||
On CLI we have only ability to use the "Text" Var_Dump renderer (display_mode)
|
||||
*/
|
||||
$driverType = 'array';
|
||||
|
||||
// use default "HTML4_Table" Var_Dump renderer
|
||||
/* Be aware that if you run this script in CLI, the Var_Dump renderer used
|
||||
is "Text" (no choice) */
|
||||
$driverOptions
|
||||
= array('PEAR::Var_Dump' =>
|
||||
array('options' => array('display_mode' => 'HTML4_Table')));
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$source = 'C:\php\pear\HTML_Progress2\Progress2.php';
|
||||
$r = $compatInfo->parseFile($source);
|
||||
// You may also use the new unified method parseData(), parseFile() became an alias
|
||||
//$r = $compatInfo->parseData($source);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
?>
|
||||
58
database/php/docs/examples/pci180_parsefolder.php
Normal file
58
database/php/docs/examples/pci180_parsefolder.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a single directory
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsefolder.php,v 1.3 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b2 (2008-06-03)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With all default options, its same as version 1.8.0b1 or less
|
||||
No need to specify driver type ('array') and options, in class constructor
|
||||
Results display made with PHP::var_export
|
||||
*/
|
||||
//$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
|
||||
Here we choose to display result as XML stream, beautified if PEAR::XML_Beautifier
|
||||
package is available (installed).
|
||||
*/
|
||||
$driverType = 'xml';
|
||||
|
||||
/*
|
||||
Display wait messages or a progress bar (PEAR::Console_ProgressBar)
|
||||
if available while parsing data source
|
||||
Default behavior is: silent = true (no wait system)
|
||||
Use (progress => text) if you don't want a progress bar but only text messages
|
||||
*/
|
||||
$driverOptions = array('silent' => false, 'progress' => 'bar');
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$source = 'C:\wamp\tmp\Log-1.10.0\Log';
|
||||
$options = array();
|
||||
$r = $compatInfo->parseFolder($source, $options);
|
||||
// You may also use the new unified method parseData(), parseFolder() became an alias
|
||||
//$r = $compatInfo->parseData($source);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
129
database/php/docs/examples/pci180_parsefolder_tohtml.php
Normal file
129
database/php/docs/examples/pci180_parsefolder_tohtml.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Parse a folder and wait with an HTML Progress bar
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsefolder_tohtml.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b4 (2008-06-18)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'HTML/Progress2.php';
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class myClass
|
||||
{
|
||||
function doSomething()
|
||||
{
|
||||
global $bar;
|
||||
|
||||
// You may also use, all others renderer available
|
||||
$driverType = 'html';
|
||||
$driverOptions = array('args' => array('output-level' => 18));
|
||||
|
||||
$info = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
$info->addListener(array(&$bar, 'notify'));
|
||||
$dir = 'C:\Temp\beehiveforum082\forum';
|
||||
$opt = array();
|
||||
|
||||
// You may use the new unified method parseData(), parseDir() became an alias
|
||||
$info->parseData($dir, $opt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class myBar extends HTML_Progress2
|
||||
{
|
||||
// number of file to parse
|
||||
var $_fileCount;
|
||||
|
||||
function myBar()
|
||||
{
|
||||
parent::HTML_Progress2();
|
||||
|
||||
$this->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt1');
|
||||
$this->setLabelAttributes('txt1', array(
|
||||
'valign' => 'top',
|
||||
'left' => 0,
|
||||
));
|
||||
$this->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt2');
|
||||
$this->setLabelAttributes('txt2', array(
|
||||
'valign' => 'bottom',
|
||||
'left' => 0,
|
||||
));
|
||||
}
|
||||
|
||||
function notify(&$notification)
|
||||
{
|
||||
$notifyName = $notification->getNotificationName();
|
||||
$notifyInfo = $notification->getNotificationInfo();
|
||||
|
||||
switch ($notifyName) {
|
||||
case PHP_COMPATINFO_EVENT_AUDITSTARTED :
|
||||
$this->_fileCount = $notifyInfo['dataCount'];
|
||||
// to keep the good proportion with default increment (+1)
|
||||
$this->setMaximum($this->_fileCount);
|
||||
break;
|
||||
case PHP_COMPATINFO_EVENT_FILESTARTED :
|
||||
$current = $notifyInfo['fileindex'];
|
||||
$max = $this->_fileCount;
|
||||
$file = basename($notifyInfo['filename']);
|
||||
|
||||
$this->setLabelAttributes('txt1',
|
||||
array('value' => $current.'/'.$max.' files'));
|
||||
$this->setLabelAttributes('txt2',
|
||||
array('value' => $file));
|
||||
break;
|
||||
case PHP_COMPATINFO_EVENT_FILEFINISHED :
|
||||
$this->moveNext();
|
||||
break;
|
||||
case PHP_COMPATINFO_EVENT_AUDITFINISHED :
|
||||
$this->hide(); // progress bar hidden
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_time_limit(0); // because parsing a huge folder may exceed 30 seconds
|
||||
$bar = new myBar();
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>Parse a folder and wait with an HTML progress bar</title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
<?php echo $bar->getStyle(); ?>
|
||||
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<?php echo $bar->getScript(false); ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$bar->display();
|
||||
|
||||
$process = new myClass();
|
||||
$process->doSomething();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
65
database/php/docs/examples/pci180_parsestring.php
Normal file
65
database/php/docs/examples/pci180_parsestring.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a chunk of code
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsestring.php,v 1.3 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b2 (2008-06-03)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
/*
|
||||
With all default options, its same as version 1.8.0b1 or less
|
||||
No need to specify driver type ('array') and options, in class constructor
|
||||
Results display made with PHP::var_export
|
||||
*/
|
||||
//$compatInfo = new PHP_CompatInfo();
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
|
||||
Here we choose to display result as XML stream, beautified if PEAR::XML_Beautifier
|
||||
package is available (installed).
|
||||
*/
|
||||
$driverType = 'xml';
|
||||
|
||||
// use some options of XML_Beautifier to change default render
|
||||
$driverOptions = array('beautifier' => array('indent' => ' ', 'linebreak' => PHP_EOL));
|
||||
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
|
||||
$source = '<?php
|
||||
$nl = "\n";
|
||||
echo "$nl Atom = " . DATE_ATOM;
|
||||
echo "$nl Cookie = " . DATE_COOKIE;
|
||||
echo "$nl Iso8601 = " . DATE_ISO8601;
|
||||
echo "$nl Rfc822 = " . DATE_RFC822;
|
||||
echo "$nl Rfc850 = " . DATE_RFC850;
|
||||
echo "$nl Rfc1036 = " . DATE_RFC1036;
|
||||
echo "$nl Rfc1123 = " . DATE_RFC1123;
|
||||
echo "$nl Rfc2822 = " . DATE_RFC2822;
|
||||
echo "$nl RSS = " . DATE_RSS;
|
||||
echo "$nl W3C = " . DATE_W3C;
|
||||
?>';
|
||||
|
||||
$r = $compatInfo->parseString($source);
|
||||
// You may also use the new unified method parseData(), parseString() became an alias
|
||||
//$r = $compatInfo->parseData($source);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
var_export($r);
|
||||
?>
|
||||
96
database/php/docs/examples/pci180_parsestring_toxml.php
Normal file
96
database/php/docs/examples/pci180_parsestring_toxml.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Get the Compatibility info for a chunk of code
|
||||
*
|
||||
* This example show the new options|features available with API 1.8.0
|
||||
* Especially, observer and xml renderer
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CompatInfo
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD
|
||||
* @version CVS: $Id: pci180_parsestring_toxml.php,v 1.2 2008/07/22 20:26:45 farell Exp $
|
||||
* @link http://pear.php.net/package/PHP_CompatInfo
|
||||
* @since version 1.8.0b4 (2008-06-18)
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
require_once 'PHP/CompatInfo.php';
|
||||
|
||||
define('DEST_LOG_FILE', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'notify.log');
|
||||
|
||||
/*
|
||||
Add an observer to listen all PCI events
|
||||
*/
|
||||
function pci180_debug(&$auditEvent)
|
||||
{
|
||||
$notifyName = $auditEvent->getNotificationName();
|
||||
$notifyInfo = $auditEvent->getNotificationInfo();
|
||||
error_log('notifyName:'. $notifyName . PHP_EOL, 3, DEST_LOG_FILE);
|
||||
error_log('notifyInfo:'. PHP_EOL .
|
||||
var_export($notifyInfo, true) . PHP_EOL, 3, DEST_LOG_FILE);
|
||||
}
|
||||
|
||||
/*
|
||||
With API 1.8.0 you may choose a custom render,
|
||||
between all default renderers (all customizable).
|
||||
|
||||
Here we choose to display result as XML stream,
|
||||
beautified if PEAR::XML_Beautifier package is available (installed).
|
||||
*/
|
||||
$driverType = 'xml';
|
||||
|
||||
// use some options of XML_Beautifier to change default render
|
||||
$driverOptions = array('beautifier' => array('indent' => ' ',
|
||||
'linebreak' => PHP_EOL),
|
||||
// output all informations except tokens (output-level = 23)
|
||||
'args' => array('output-level' => 23));
|
||||
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
|
||||
$compatInfo->addListener('pci180_debug');
|
||||
|
||||
$str1 = '<?php
|
||||
$nl = "\n";
|
||||
echo "$nl Atom = " . DATE_ATOM;
|
||||
echo "$nl Cookie = " . DATE_COOKIE;
|
||||
echo "$nl Iso8601 = " . DATE_ISO8601;
|
||||
echo "$nl Rfc822 = " . DATE_RFC822;
|
||||
echo "$nl Rfc850 = " . DATE_RFC850;
|
||||
echo "$nl Rfc1036 = " . DATE_RFC1036;
|
||||
echo "$nl Rfc1123 = " . DATE_RFC1123;
|
||||
echo "$nl Rfc2822 = " . DATE_RFC2822;
|
||||
echo "$nl RSS = " . DATE_RSS;
|
||||
echo "$nl W3C = " . DATE_W3C;
|
||||
?>';
|
||||
|
||||
$str2 = '<?php
|
||||
class Request6056
|
||||
{
|
||||
function testMaxVersion()
|
||||
{
|
||||
// PHP 5 <= 5.0.4
|
||||
$res = php_check_syntax(\'bug6581.php\');
|
||||
|
||||
$array1 = array(\'blue\' => 1, \'red\' => 2, \'green\' => 3);
|
||||
$array2 = array(\'green\' => 5, \'blue\' => 6, \'yellow\' => 7);
|
||||
|
||||
// PHP 5 >= 5.1.0RC1
|
||||
$diff = array_diff_key($array1, $array2);
|
||||
}
|
||||
}
|
||||
?>';
|
||||
|
||||
$source = array($str1, $str2);
|
||||
$options = array('is_string' => true, 'debug' => true);
|
||||
|
||||
//$r = $compatInfo->parseString($source, $options);
|
||||
// You may also use the new unified method parseData(), parseString() became an alias
|
||||
$r = $compatInfo->parseData($source, $options);
|
||||
|
||||
/*
|
||||
To keep backward compatibility, result is also return (here in $r)
|
||||
but you don't need to print it, it's the default behavior of API 1.8.0
|
||||
*/
|
||||
//var_export($r);
|
||||
?>
|
||||
60
database/php/docs/examples/yoursite.css
Normal file
60
database/php/docs/examples/yoursite.css
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
border:0;
|
||||
padding:0;
|
||||
height:100%;
|
||||
max-height:100%;
|
||||
background:#eee;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#header {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
height:86px;
|
||||
overflow:auto;
|
||||
background:#ccffff;
|
||||
color:#090;
|
||||
border-bottom: 4px solid #eee;
|
||||
}
|
||||
#header h1 {
|
||||
color: #090;
|
||||
text-align: left;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
#footer {
|
||||
position:absolute;
|
||||
bottom:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
height:38px;
|
||||
overflow:auto;
|
||||
text-align:right;
|
||||
background:#cfc;
|
||||
border-top: 2px solid #090;
|
||||
}
|
||||
|
||||
#contents {
|
||||
position:fixed;
|
||||
top:90px;
|
||||
left:0;
|
||||
bottom:40px;
|
||||
right:0;
|
||||
overflow:auto;
|
||||
background:#fff;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
/* for internet explorer */
|
||||
* html body {
|
||||
padding:90px 0 50px 0;
|
||||
}
|
||||
* html #contents {
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user