2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

UPDATEd : Bootstrap to 3.3.6; font-awesome to 4.5.0; bootstrap-tables;

CLEANED  not used doc, examples e.t.c files and folders
This commit is contained in:
Alex
2015-12-10 17:08:44 +03:00
parent d4ffeda3ed
commit 0e3dfa06b8
210 changed files with 1036 additions and 15682 deletions

View File

@@ -1,461 +0,0 @@
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)
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.
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');
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.

View File

@@ -1,5 +0,0 @@
Joshua Eichorn <josh@bluga.net> - Project Lead
David Coallier <davidc@php.net> - Project Lead
Laurent Yaish <laurenty@gmail.com> - Developer
Elizabeth Smith <auroraeosrose@gmail.com> - Developer
Arpad Ray <arpad@php.net> - Developer

View File

@@ -1,7 +0,0 @@
JPSpan serializer for compatibility
Additional functionality to helper class
Inline frame ajax fallback and file upload support
Something for Polling
Basic debugging tools (XMLHttpRequest tester, serialized items viewer, debug console)
Complete Documentation including basic tutorials and step by step for advanced uses
Framework integration - either documentation or some kind of API

View File

@@ -1,3 +0,0 @@
This is the README file, its loaded in lots of examples
See Index.php for details

View File

@@ -1,49 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX_Action
*
* All the work happens in support/testHaa.class.php
* This class just attaches some acctions to calls to the server class
*
* This just shows basic functionality, what were doing isn't actually useful
* For an example on how one would actually use HTML_AJAX_Action check out the guestbook example
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2006 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<script type='text/javascript' src="auto_server.php?client=all"></script>
<script type='text/javascript' src="auto_server.php?stub=testHaa"></script>
<script type='text/javascript'>
// create our remote object so we can use it elsewhere
var remote = new testHaa({}); // pass in an empty hash so were in async mode
</script>
</head>
<body>
<h1>Basic HTML_AJAX_Action Usage</h1>
<ul>
<li><a href="#" onclick="remote.greenText('target')">Make Target Green</a></li>
<li><a href="#" onclick="remote.highlight('target')">Highlight Target</a></li>
<li><a href="#" onclick="remote.duplicate('target','dest')">Duplicate Target</a></li>
</ul>
<div id="target">
I'm some random text. Ain't I fun.
</div>
<div id="dest">
</div>
</body>
</html>

View File

@@ -1,70 +0,0 @@
<?php
/**
* Advanced usage of HTML_AJAX_Server
* Allows for a single server to manage exporting a large number of classes without high overhead per call
* Also gives a single place to handle setup tasks especially useful if session setup is required
*
* The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir
* 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
class TestServer extends HTML_AJAX_Server {
// this flag must be set to on init methods
var $initMethods = true;
// init method for the test class, includes needed files an registers it for ajax
function initTest() {
include 'support/test.class.php';
$this->registerClass(new test());
}
// init method for the livesearch class, includes needed files an registers it for ajax
function initLivesearch() {
include 'support/livesearch.class.php';
$this->registerClass(new livesearch());
}
// init method for the testHaa class, includes needed files an registers it for ajax, directly passes in methods to register to specify case in php4
function initTestHaa() {
include 'support/testHaa.class.php';
$this->registerClass(new testHaa(),'testHaa',array('updateClassName','greenText','highlight','duplicate'));
}
}
// create an instance of our test server
$server = new TestServer();
// init methods can also be added to the server by registering init objects, this is useful in cases where you want to dynamically add init methods
class initObject {
// init method for the test class, includes needed files an registers it for ajax
function initTest2() {
include 'support/test2.class.php';
$this->server->registerClass(new test2());
}
}
$init = new initObject();
$server->registerInitObject($init);
// you can use HTML_AJAX_Server to deliver your own custom javascript libs, when used with comma seperated client lists you can
// use just one javascript include for all your library files
// example url: auto_server.php?client=auto_server.php?client=Util,Main,Request,HttpClient,Dispatcher,Behavior,customLib
$server->registerJSLibrary('customLib','customLib.js','./support/');
// handle requests as needed
$server->handleRequest();
?>

View File

@@ -1,31 +0,0 @@
<?php
/**
* Test class used in other examples
* Constructors and private methods marked with _ are never exported in proxies to JavaScript
*
* @category HTML
* @package AJAX
* @author David Coallier <davidc@agoraproduction.com>
* @copyright 2005 David Coallier
* @license LGPL http://www.gnu.org/copyleft/lesser.txt
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
require_once 'HTML/AJAX.php';
class error_test
{
function error_test()
{
$ajax =& new HTML_AJAX;
$ajax->debugEnabled = true;
$ajax->debugSession = true;
set_error_handler(array(&$ajax, '_errorHandler'));
trigger_error("I don't know");
}
}
$t =& new error_test;
print_r($t);
?>

View File

@@ -1,91 +0,0 @@
<?php
/**
* AJAX form submission example
*
* @category HTML
* @package AJAX
* @author Arpad Ray <arpad@php.net>
* @author Laurent Yaish <laurenty@gmail.com>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<script type="text/javascript" src="server.php?client=all&stub=test"></script>
</head>
<body>
<pre id="target">
</pre>
<form action="server.php" method="post" onsubmit="return !HTML_AJAX.formSubmit(this, 'target', {className: 'test', methodName:'multiarg'});">
<table>
<tr>
<td>Text</td>
<td><input type="text" name="test_text" value="example" /></td>
</tr>
<tr>
<td>Single Select</td>
<td>
<select name="test_select">
<option value="example1">Example 1</option>
<option value="example2">Example 2</option>
</select>
</td>
</tr>
<tr>
<td>Multi Select</td>
<td>
<select name="test_select_multiple[]" multiple="multiple">
<option value="examplea">Example A</option>
<option value="exampleb">Example B</option>
<option value="examplec">Example C</option>
<option value="exampled">Example D</option>
</select>
</td>
</tr>
<tr>
<td>Single Checkbox</td>
<td><input type="checkbox" name="single_checkbox" value="single_check1" /></td>
</tr>
<tr>
<td>Multi Checkboxes</td>
<td>
<input type="checkbox" name="multi_checkbox[]" value="multi_check1" />1
<input type="checkbox" name="multi_checkbox[]" value="multi_check2" />2
<input type="checkbox" name="multi_checkbox[]" value="multi_check3" />3
</td>
</tr>
<tr>
<td>Radio Buttons</td>
<td>
<input type="radio" name="test_radio" value="radio_1" />1
<input type="radio" name="test_radio" value="radio_2" />2
<input type="radio" name="test_radio" value="radio_3" />3
</td>
</tr>
<tr>
<td>Textarea</td>
<td>
<textarea name="long_text">type a long string in here....</textarea>
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit form" />
</form>
<h3>JavaScript callback function target test</h3>
<form action="server.php" method="post" onsubmit="return !HTML_AJAX.formSubmit(this, function(result) { document.getElementById('target').innerHTML = result; }, {className: 'test', methodName:'multiarg'});">
<table>
<tr>
<td>Text</td>
<td><input type="text" name="test_text" value="example" /></td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -1,45 +0,0 @@
<?php
/**
* Simple grab example
*
* @category HTML
* @package AJAX
* @author Arpad Ray <arpad@php.net>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
include 'HTML/AJAX.php';
if (isset($_GET['grab'])) {
die('Grabbed from php!');
}
$ajax = new HTML_AJAX();
if ($ajax->handleRequest()) {
exit;
}
?><html>
<head>
<script type='text/javascript' src="../js/HTML_AJAX.js"></script>
<script type="text/javascript">
function grab()
{
var callback = function(result) {
document.getElementById('target').innerHTML = result;
}
HTML_AJAX.grab('grab.php?grab=1', callback);
}
</script>
</head>
<body>
<a href="javascript:grab()">grab</a>
<pre id="target">
</pre>
</body>
</html>

View File

@@ -1,34 +0,0 @@
<?php
/**
* Server that exposes a class for doing a fake guestbook
*
* @category HTML
* @package AJAX
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
class GuestbookServer extends HTML_AJAX_Server {
// this flag must be set to on init methods
var $initMethods = true;
// init method for the test class, includes needed files an registers it for ajax
function initGuestbook() {
include 'guestbook.class.php';
$this->registerClass(new Guestbook(),'guestbook',array('newEntry', 'clearGuestbook', 'deleteEntry', 'editEntry', 'updateSelect')); // specify methods so that we get case in php4
}
}
session_start();
// create an instance of our test server
$server = new GuestbookServer();
// handle requests as needed
$server->handleRequest();
?>

View File

@@ -1,185 +0,0 @@
<?php
/**
* Guestbook uses HTML_AJAX_Action class to interact with the page - the
* javascript is all written from here
*
* @category HTML
* @package AJAX
* @author Elizabeth Smith <auroraeosrose@gmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
/**
* Require the action class
*/
require_once 'HTML/AJAX/Action.php';
class guestbook {
// constructor won't be exported
function guestbook() {
if (!isset($_SESSION['entries'])) {
$_SESSION['entries'] = array();
}
}
// data is an array of objects
function newEntry($data) {
//validation code is identical
$response = new HTML_AJAX_Action();
//remove any error nodes present
$response->removeNode('nameError');
$response->removeNode('emailError');
$response->removeNode('emailError2');
$response->removeNode('commentError');
//checking data
if(!isset($data['name']) or empty($data['name']))
{
//create error div after bad name node
$response->createNode('name', 'div', array('class' => 'error', 'innerHTML' => 'Name is a required field', 'id' => 'nameError'), 'insertAfter');
$error = TRUE;
}
if(!isset($data['email']) or empty($data['email']))
{
//create error div after bad name node
$response->createNode('email', 'div', array('class' => 'error', 'innerHTML' => 'Email is a required field', 'id' => 'emailError'), 'insertAfter');
$error = TRUE;
}
if($this->_checkEmail($data['email']) != TRUE)
{
//create error div after bad name node
$response->createNode('email', 'div', array('class' => 'error', 'innerHTML' => 'That email address is incorrect', 'id' => 'emailError2'), 'insertAfter');
$error = TRUE;
}
if(!isset($data['comments']) or empty($data['comments']))
{
//create error div after bad name node
$response->createNode('comments', 'div', array('class' => 'error', 'innerHTML' => 'Comment is a required field', 'id' => 'commentError'), 'insertAfter');
$error = TRUE;
}
if(!isset($error))
{
//clean name - strip tags and html_entity it :)
$data['name'] = htmlentities(strip_tags($data['name']));
//clean email - strip tags it
$data['email'] = strip_tags($data['email']);
//clean website - strip http://if needed
$data['website'] = strip_tags($data['website']);
if(strpos($data['website'], 'http://') === 0)
{
$data['website'] = str_replace('http://', '', $data['website']);
}
//clean like name
$data['comments'] = htmlentities(strip_tags($data['comments']));
//branch here depending on if form is new
if($data['submit'] == 'Edit Entry')
{
$old = $_SESSION['entries'][$data['key']];
//merge new data over old
foreach($data as $key => $value)
{
$old[$key] = $value;
}
$_SESSION['entries'][$data['key']] = $old;
//replace div innerHTML, fun fun
$response->assignAttr('entry'.$data['key'], 'innerHTML', $this->_makeDiv($data['key'], $_SESSION['entries'][$data['key']], TRUE));
//remove hidden input
$response->removeNode('key');
}
else
{
$data['date'] = date('j/n/Y, h:i');
$_SESSION['entries'][] = $data;
end($_SESSION['entries']);
$key = key($_SESSION['entries']);
$response->prependAttr('guestbookList', 'innerHTML', $this->_makeDiv($key, $data));
}
//reset the form
$response->assignAttr('name', 'value', '');
$response->assignAttr('email', 'value', '');
$response->assignAttr('website', 'value', '');
$response->assignAttr('comments', 'value', '');
$response->assignAttr('submit', 'value', 'Add Comments');
}
return $response;
}
// empty the guestbook
function clearGuestbook($data) {
$_SESSION['entries'] = array();
$response = new HTML_AJAX_Action();
$response->insertAlert('You will clear all entries, this cannot be undone!');
$response->assignAttr('guestbookList', 'innerHTML', '');
return $response;
}
// delete an entry from the guestbook
function deleteEntry($id) {
unset($_SESSION[$id]);
$response = new HTML_AJAX_Action();
$response->removeNode('entry'.$id);
return $response;
}
// puts a guestbook entry back in
function editEntry($id) {
$data = $_SESSION['entries'][$id];
$response = new HTML_AJAX_Action();
//send to the form
$response->assignAttr('name', 'value', $data['name']);
$response->assignAttr('email', 'value', $data['email']);
$response->assignAttr('website', 'value', $data['website']);
$response->assignAttr('comments', 'value', $data['comments']);
$response->assignAttr('submit', 'value', 'Edit Entry');
$response->createNode('submit', 'input', array('id' => 'key', 'name' => 'key', 'type' => 'hidden', 'value' => $id), 'insertBefore');
return $response;
}
function updateSelect($id)
{
$response = new HTML_AJAX_Action();
$attr = array('id' => $id, 'name' => $id);
$response->replaceNode($id, 'select', $attr);
for ($i=1;$i<=10;$i++)
{
$attr = array('value' => $i, 'innerHTML' => 'Option ' . $i);
$response->createNode($id, 'option', $attr, 'append');
}
return $response;
}
function _makeDiv($key, $data, $replace = FALSE) {
$div = '';
if($replace == FALSE)
{
$div .= '<div class="entry" id="entry'.$key.'">';
}
$div .= '<h3><a href="mailto:'.$data['email'].'">'.$data['name'].'</a></h3>';
if(!empty($data['website']))
{
$div .= '<a href="http://'.$data['website'].'">'.$data['website'].'</a><br />';
}
$div .= '<p>'.$data['comments'].'</p>'
.'<div class="small">Posted: '.$data['date'].' | '
.'<a href="#" onclick="editentry('.$key.');">Edit</a> | '
.'<a href="#" onclick="deleteentry('.$key.');">Delete</a></div>';
if($replace == FALSE)
{
$div .= '</div>';
}
return $div;
}
function _checkEmail($email)
{
//checks proper syntax
if(preg_match( '/^[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}$/i' , $email))
{
return true;
}
return false;
}
}
?>

View File

@@ -1,202 +0,0 @@
<?php
/**
* A simple guestbook with the goal of not a line of javascript :)
*
* @category HTML
* @package AJAX
* @author Elizabeth Smith <auroraeosrose@gmail.com>
* @copyright 2005 Elizabeth Smith
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
//require the helper class - it will take care of everything else
require_once 'HTML/AJAX/Helper.php';
//since we're not REALLY using a backend like a database, use sessions to store data
session_start();
//set up HTML_AJAX_Helper
$ajaxHelper = new HTML_AJAX_Helper();
//tell it what url to use for the server
$ajaxHelper->serverUrl = 'auto_server.php';
//add haserializer to set
$ajaxHelper->jsLibraries[] = 'haserializer';
// Open tags problem... I know ugly.
$ajaxHelper->stubs[] = 'guestbook';
print '<?xml version="1.0" encoding="utf-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>My Guestbook</title>
<?php
// output a javascript neded to setup HTML_AJAX
echo $ajaxHelper->setupAJAX();
?>
<script type="text/javascript">
HTML_AJAX.onError = function(e) { alert(HTML_AJAX_Util.quickPrint(e)); }
</script>
<style type="text/css">
body {
color: #24006B;
}
h2 {
text-align: center;
color: #330099;
}
#guestbookForm, #guestbookList {
width: 65%;
margin-right: auto;
margin-left: auto;
padding: 1.5em;
margin-top: 10px;
background-color: #D5BFFF;
border: 4px double #FFCC00;
}
fieldset, div.entry {
background-color: #FFF2BF;
border: 4px double #330099;
padding: 0.5em;
}
legend {
color: #330099;
font-size: 0.8em;
font-style: italic;
}
label {
clear: both;
display: block;
float: left;
width: 20%;
text-align: right;
font-weight: bold;
}
input {
display: block;
float: left;
width: 40%;
margin: 0 0.5em 0.5em 0.5em;
background-color: #B38F00;
border: 1px solid #AA80FF;
color: #330099;
}
input:focus, textarea:focus {
background-color: #D5BFFF;
border: 1px solid #B38F00;
}
textarea {
display: block;
float: left;
width: 40%;
height: 10em;
margin: 0 0.5em 0.5em 0.5em;
background-color: #B38F00;
border: 1px solid #AA80FF;
color: #330099;
}
input[type="submit"] {
display: block;
width: auto;
float: none;
margin-right: auto;
margin-left: auto;
font-size: 1.5em;
font-weight: bold;
background-color: #330099;
color: #FFCC00;
border: 3px double #FFE680;
}
.error {
color: #CC0000;
font-weight: bold;
float: left;
}
.small {
font-size: 0.8em
}
</style>
</head>
<body>
<?php //eventually ajax_helper should set this up for you, it's not done yet?>
<script type="text/javascript">
function sendguestbook(form) {
var remoteguestbook = new guestbook();
var payload = new Object();
for(var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name) {
payload[form.elements[i].name] = form.elements[i].value;
}
}
remoteguestbook.newEntry(payload);
return false;
}
function clearguestbook() {
var remoteguestbook = new guestbook();
remoteguestbook.clearGuestbook();
}
function deleteentry(id) {
var remoteguestbook = new guestbook();
remoteguestbook.deleteEntry(id);
}
function editentry(id) {
var remoteguestbook = new guestbook();
remoteguestbook.editEntry(id);
}
function updateselect(id) {
var remoteguestbook = new guestbook();
remoteguestbook.updateSelect(id);
}
</script>
<h2>Welcome to the Guestbook</h2>
<div id="guestbookList">
<?php
if (isset($_SESSION['entries'])) {
foreach($_SESSION['entries'] as $key => $data) {
echo '<div class="entry" id="entry'.$key.'">'
.'<h3><a href="mailto:'.$data->email.'">'.$data->name.'</a></h3>';
if(!empty($data->website))
{
echo '<a href="http://'.$data->website.'">'.$data->website.'</a><br />';
}
echo '<p>'.$data->comments.'</p>'
.'<div class="small">Posted: '.$data->date.' | '
.'<a href="#" onclick="editentry('.$key.');">Edit</a> | '
.'<a href="#" onclick="deleteentry('.$key.');">Delete</a></div>'
.'</div>';
}
}
?>
</div>
<div><a href="#" onclick="clearguestbook(this);">Clear Guestbook</a></div>
<form id="guestbookForm" action="index.php" method="post" onsubmit="sendguestbook(this); return false;">
<fieldset>
<legend>Leave Your Comments</legend>
<label for="name">Name: </label><input name="name" id="name" />
<label for="email">Email: </label><input name="email" id="email" />
<label for="website">Website: </label><input name="website" id="website" />
<label for="comments">Comments: </label><textarea name="comments" id="comments"></textarea>
<br style="clear: both" />
<input type="submit" id="submit" name="submit" value="Add Comments" />
</fieldset>
</form>
<p>Fill a select item with a list of options - tests the HTML_AJAX_Action::replaceNode and HTML_AJAX_Action::createNode methods</p>
<form id="testing" action="index.php" method="post" onsubmit="return false;">
<div>
<a href="#" onclick="updateselect('replaceme');">Gimme some options</a>
<select id="replaceme">
<option name="dog" id="dog">Dog</option>
</select>
</div>
</form>
</body>
</html>

View File

@@ -1,52 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX_Action see support/testHaa.class.php
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'auto_server.php';
$ajaxHelper->jsLibraries[] = array('haserializer');
$ajaxHelper->stubs[] = 'testHaa';
?>
<html>
<head>
<?php
echo $ajaxHelper->setupAJAX();
?>
<script type="text/javascript">
var remote = new testHaa();
</script>
<style type="text/css">
.test {
color: red;
}
</style>
</head>
<body>
<div id="test">
I'm some test content
</div>
<ul>
<li><a href="#" onclick="remote.updateClassName()">Update className</a></li>
</ul>
</body>
</html>

View File

@@ -1,59 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX_Helper
*
* HTML_AJAX_Helper takes care of basic JavaScript and HTML generation that is needed in many AJAX requests
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'auto_server.php';
$ajaxHelper->jsLibraries[] = 'customLib';
?>
<html>
<head>
<?php
// output a javascript neded to setup HTML_AJAX
// by default this is all the libraries shipped with HTML_AJAX, take a look at $ajaxHelper->jsLibraries to edit the list
echo $ajaxHelper->setupAJAX();
?>
</head>
<body>
<?php
// output a custom loading message
echo $ajaxHelper->loadingMessage("Waiting on the Server ...");
?>
<div id="updateTarget">I'm an update Target</div>
<?php
// update the element using ajax
echo $ajaxHelper->updateElement('updateTarget',array('test','echo_string','Some text to echo'),'replace',true);
?>
<p>Was this page loaded using AJAX: <?php var_dump($ajaxHelper->isAJAX()); ?></p>
Below is the output of HTML_AJAX_Helper::isAJAX() on content loaded from AJAX
<div id="updateTarget2"></div>
<?php
echo $ajaxHelper->updateElement('updateTarget2','support/isajax.php','replace',true);
?>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,92 +0,0 @@
<html>
<head>
<title>HTML_AJAX 0.5.2 Examples</title>
</head>
<body>
<h1>HTML_AJAX 0.5.2 Examples</h1>
<p>
These are examples showing the basics of using HTML_AJAX
</p>
<p>
These examples show off many of the features of HTML_AJAX, but you'll find them most useful as a learning tool.
Reading through the commented code as you view the examples in your browser.
</p>
<p>
These examples are available online at: http://bluga.net/projects/HTML_AJAX or in your local PEAR install in the documentation dir.
On most Linux systems the location is /usr/share/pear/docs/HTML_AJAX/examples/
You can find the location of your PEAR documentation dir running
<code>pear config-get doc_dir</code>
</p>
<p>The term proxy in these examples refers to a javascript class that is generated and has functions that map to the eqivalent php class.
These proxy classes work much in the same way as a SOAP proxy class that is generated from wsdl.
</p>
<p>
Front end files for examples, you can actually run these and see some example output
</p>
<ul>
<li><a href='proxyless_usage.php'>proxyless_usage.php</a> - Using HTML_AJAX in standalone mode, possible doesn't require PHP or any backend HTML_AJAX classes</li>
<li><a href='proxy_usage_inline_javascript.php'>proxy_usage_inline_javascript.php</a> - Single file proxy style usage</li>
<li><a href='proxy_usage_server.php'>proxy_usage_server.php</a> - Multi-file proxy usage, either server file could be used with this example</li>
<li><a href='queue_usage.php'>queue_usage.php</a> - An example of using a queue to manage ajax calls, a simple live search example</li>
<li><a href='slow_livesearch.php'>slow_livesearch.php</a> - An example showing how the ordered queue can be used to manage high latency</li>
<li><a href='helper_usage.php'>helper_usage.php</a> - An example showing the basics of the helper api</li>
<li><a href='form.php'>form.php</a> - Basic AJAX form submission example</a></li>
<li><a href='action_usage.php'>action_usage.php</a> - Basic HTML_AJAX_Action usage</a></li>
<li><a href='xml_usage.php'>xml_usage.php</a> - Basic XML serializer usage</a></li>
</ul>
<p>Real Life Examples</p>
<ul>
<li><a href='login/index.php'>login/index.php</a> - An example creating an AJAX driven login</a></li>
<li><a href='review/index.php'>review/index.php</a> - A simple live review system, AJAX form submission and click to edit</a></li>
<li><a href='guestbook/index.php'>guestbook/index.php</a> - A simple guestbook system, uses action system so you never write a line of javascript</a></li>
<li><a href='shoutbox.php'>shoutbox.php</a> - How to use AJAX form submission</a></li>
</ul>
<p>
2 server examples are provided, both provide the same output but the auto_server example has code to help you deal with managing multiple ajax classes
</p>
<ul>
<li>server.php - Basic server operation, serving ajax calls and client lib requests</li>
<li>auto_server.php - Advanced server operation, only create php classes as needed</li>
<li><a href='server.php?client=util,main'>server.php?client=util,main</a> - server.php generating a javascript file with the main and util libs in it</li>
<li><a href='auto_server.php?stub=test2'>server.php?stub=test2</a> - auto_server.php generating a javascript file a which contains a generated proxy class for the test2 php class</li>
<li><a href='auto_server.php?stub=all'>server.php?stub=all</a> - auto_server.php generating a javascript file which contains proxies for all the php classes registered with it</li>
</ul>
<p>
Examples files showing howto use HTML_AJAX_Util javascript class
</p>
<ul>
<li><a href='tests/js_utils_vardump.php'>js_utils_vardump.php</a> - Shows the output of HTML_AJAX_Util.varDump() and compares its against PHP's var_dump
</ul>
<p>
Other Example files:
</p>
<ul>
<li><a href='tests/test_speed.php'>test_speed.php</a> - A basic setup for measuring the speed of calls</li>
<li><a href='tests/test_priority.php'>test_priority.php</a> - A basic test showing how Priority queue works</li>
<li><a href='tests/serialize.php.examples.php'>serialize.php.examples.php</a> - Internal tests for the php serialize format serializer</li>
<li><a href='tests/serialize.url.examples.php'>serialize.url.examples.php</a> - Internal tests for the urlencoded format serializer</li>
<li><a href='tests/setInnerHTML.php'>setInnerHTML.php</a> - Tests used to verify the operation of HTML_AJAX_Util.setInnerHTML</li>
<li><a href='tests/duplicateJSLib.php'>duplicateJSLib.php</a> - Tests used to verify that HTML_AJAX_Server is removing duplicate JS libraries from client generation correctly</li>
<li><a href='tests/behaviorSpeed.php'>behaviorSpeed.php</a> - Tests used to see how fast the JavaScript behavior code runs.</li>
<li><a href='interceptors.php'>interceptors.php</a> - Interceptors test</a></li>
</ul>
<p>
Javascript and Html Examples:
</p>
<ul>
<li><a href="tests/test_behavior.html">test_behavior.html</a> - A short overview of how to use behavior.js. Behavior uses css selectors to apply javascript behaviors without throwing lots of javascript handlers into your html.</li>
</ul>
</body>
</html>

View File

@@ -1,40 +0,0 @@
<?php
/**
* HTML_AJAX_Server with a register itnerceptor class
*
* The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir
* 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2007 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// include the test class will be registering
include 'support/test.class.php';
include 'support/test2.class.php';
include 'support/interceptor.php';
// create our new server
$server = new HTML_AJAX_Server();
// register an instance of the class were registering
$test = new test();
$server->registerClass($test,'test');
$test2 = new test2();
$server->registerClass($test2,'test2');
$server->ajax->packJavaScript = true;
$server->ajax->setInterceptor(new Interceptor());
$server->handleRequest();
?>

View File

@@ -1,67 +0,0 @@
<?php
/**
* Front end for interceptor examples, see support/interceptor.php for the interceptor class that is being used, and interceptorServer.php for how to register one
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?><html>
<head>
<script type='text/javascript' src="interceptorServer.php?client=all"></script>
<script type='text/javascript' src="interceptorServer.php?stub=all"></script>
<script type='text/javascript'>
// definition of the callback javascript class, used to handle async requests
var callback = {
test1: function(result) {
document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result);
},
test2: function(result) {
document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result);
},
test3: function(result) {
document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result);
}
}
// function used to clear out the target div
function clearTarget() {
document.getElementById('target').innerHTML = 'clear';
}
HTML_AJAX.onError = function(e) {
document.getElementById('errors').innerHTML = HTML_AJAX_Util.varDump(e);
}
</script>
</head>
<body>
<script type="text/javascript">
// create a proxy in async mode
var testProxy = new test(callback);
var test2Proxy = new test2({test: function(result) { document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result); }});
// run a sync call and set its results to the target div
</script>
<ul>
<li><a href="javascript:clearTarget()">Clear Target</a></li>
<li><a href="javascript:testProxy.test1('One')">Run test::test1, matches interceptor for specific method</a></li>
<li><a href="javascript:testProxy.test2('Two')">Run test::test2, matches interceptor for class</a></li>
<li><a href="javascript:testProxy.test3('Three')">Run test::test3, matches interceptor for class</a></li>
<li><a href="javascript:test2Proxy.test('Four')">Run test2::test, matches global interceptor</a></li>
</ul>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="errors">Errors</div>
</div>
</body>
</html>

View File

@@ -1,147 +0,0 @@
<?php
require_once 'HTML/AJAX/Helper.php';
$objAjaxHelper = new HTML_AJAX_Helper();
$objAjaxHelper->serverUrl = './php/auto_server.php';
$objAjaxHelper->jsLibraries[] = 'haserializer';
$objAjaxHelper->stubs[] = 'login';
$strAjaxScript = $objAjaxHelper->setupAJAX();
?>
<html>
<head>
<title>Form validation (v2) with HTML_AJAX</title>
<!-- HTML_AJAX -->
<?php echo $strAjaxScript ?>
<script type="text/javascript">
/**
* Basic page initialization
*/
function initPage() {
// Set up the labels so they know the associated input elements
var arrLabels = document.getElementsByTagName("label");
for (var i=0; i < arrLabels.length; i++) {
var objTemp = arrLabels[i];
var strFor = objTemp.getAttribute('for');
// Fix the attributes
if (strFor != '') {
// Set the ID of the label
objTemp.setAttribute('id', 'l' + strFor);
// Save the original class of the label (if any)
objTemp.setAttribute('classOrig', objTemp.getAttribute('class'));
}
}
// Set the focus on the first element
document.getElementById('username').focus();
}
/**
* Sets the class of an element (build for this example)
*/
function setElement(strElement, blnValidated) {
// Update the label
var objElem = document.getElementById('l' + strElement);
if (objElem) {
if (blnValidated == 1) {
strClass = objElem.getAttribute('classOrig');
} else {
strClass = 'error';
}
objElem.setAttribute('class', '' + strClass);
}
return false;
}
/**
* Shows or hides an element
*/
function toggleElement(strElement, blnVisible) {
var objStyle = document.getElementById(strElement).style;
if (objStyle) {
objStyle.display = (blnVisible == 1) ? 'block' : 'none';
}
}
/**
* Login function
*/
function doLogin() {
// Create object with values of the form
var objTemp = new Object();
objTemp['username'] = document.getElementById('username').value;
objTemp['password'] = document.getElementById('password').value;
objTemp['email'] = document.getElementById('email').value;
// Create a dummy callback so the loading box will appear...
var objCallback = { validate: function() {} };
// Send the object to the remote class
var objLogin = new login(objCallback);
objLogin.validate(objTemp);
}
</script>
<!-- STYLESHEET -->
<link rel="stylesheet" type="text/css" href="login.css" />
</head>
<body>
<!-- THE ERROR MESSAGES -->
<div id="messages" class="errorbox"></div>
<br />
<!-- THE FORM -->
<form action="" method="post" onSubmit="doLogin(); return false;">
<fieldset style="width: 500px;">
<legend>Enter your login details</legend>
<table width="400" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><label for="username">Username:</label></td>
<td><input type="text" name="username" id="username" size="40" tabindex="1"></td>
</tr>
<tr>
<td><label for="password">Password:</label></td>
<td><input type="text" name="password" id="password" size="40" tabindex="2"></td>
</tr>
<tr>
<td><label for="email">E-mail:</label></td>
<td><input type="text" name="email" id="email" size="40" tabindex="3"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value=" login ">&nbsp;<input type="reset" value=" reset "></td>
</tr>
</table>
</fieldset>
</form>
<div id="HTML_AJAX_LOADING" class="AjaxLoading">Please wait while loading</div>
<p>
<strong>This sample is an updated version of the original login sample</strong>:<br />
&#0187; It now uses the new HTML_AJAX_Action class.<br>
&#0187; The initialization of the labels and their input elements is done by Javascript to clean up the page (function: initPage()).<br>
<br>
<strong>Design notes</strong>:<br>
&#0187; The attribute &quot;style.display&quot; cannot be set from php code. Don't know why though. I created a wrapper function for it called &quot;toggleElement&quot; which does the trick. Funny enough when i execute thesame lines of script using -&gt;insertScript nothing happens.<br>
&#0187; You have to add a dummy callback in order to show the loading progress bar.<br>
&#0187; Enter username &quot;peter&quot;, password &quot;gabriel&quot; and any valid e-mail adress to see a messagebox.<br>
<br>
&copy; under LGPL @ 21 nov 2005 by www.webunity.nl<br>
</p>
<script type="text/javascript">
if (document.getElementsByTagName) {
initPage();
} else {
alert('This sample requires the DOM2 "getElementsByTagName" function.');
}
</script>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,66 +0,0 @@
/* --------------------------------------------------------------------------------------------------
General styles
------------------------------------------------------------------------------------------------- */
body, table {
color: #000000;
font-size: 70%;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
}
table, fieldset {
font-size: 1em;
}
body, td, th {
line-height: 140%;
}
td, th {
vertical-align: top;
}
form, ul {
margin: 0;
padding: 0;
}
legend {
color: #0046D5;
font-weight: bold;
padding-right: 8px;
margin-bottom: 5px;
}
ol, ul {
margin-left: 6px;
padding-left: 15px;
}
/* --------------------------------------------------------------------------------------------------
Custom styles
------------------------------------------------------------------------------------------------- */
.errorbox {
padding: 8px;
border: 1px solid #ff0000;
display: none;
}
label {
color: #006fcc;
font-weight: bold;
}
label.error {
color: #ff0000;
font-weight: bold;
}
.AjaxLoading {
position: absolute;
top: 10px;
right: 10px;
background-color: red;
width: 80px;
padding: 4px;
display: none;
}

View File

@@ -1,34 +0,0 @@
<?php
/**
* Very simple form script with error handling.
*
* @category HTML
* @package AJAX
* @author Gilles van den Hoven <gilles@webunity.nl>
* @copyright 2005 Gilles van den Hoven
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
class LoginServer extends HTML_AJAX_Server {
// this flag must be set to on init methods
var $initMethods = true;
// init method for the test class, includes needed files an registers it for ajax
function initLogin() {
include 'class.login.php';
$this->registerClass(new login(), 'login', array('validate'));
}
}
// create an instance of our test server
$server = new LoginServer();
// handle requests as needed
$server->handleRequest();
?>

View File

@@ -1,128 +0,0 @@
<?php
// Includes
require_once 'HTML/AJAX/Action.php';
// Error messages
define('ERR_USERNAME_EMPTY', 'You forgot to enter a username, please try again');
define('ERR_USERNAME_INVALID', 'The username you entered is invalid. Please try "peter" (without quotes)');
define('ERR_PASSWORD_EMPTY', 'You forgot to enter a password, please try again');
define('ERR_PASSWORD_INVALID', 'The password you entered is invalid. Please try "gabriel" (without quotes)');
define('ERR_EMAIL_EMPTY', 'You forgot to enter an e-mail address');
define('ERR_EMAIL_INVALID', 'The e-mail address you entered is invalid. Please enter a valid e-mail address.');
/**
* Login class used in the "login form" example
* Please note: Constructors and private methods marked with _ are never exported in proxies to JavaScript
*
* @category HTML
* @package AJAX
* @author Gilles van den Hoven <gilles@webunity.nl>
* @copyright 2005 Gilles van den Hoven
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
class login {
/**
* PHP5 requires a constructor
*/
function login() {
}
/**
* Checks the proper syntax
*/
function _checkEmail($strEmail) {
return (preg_match( '/^[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}$/i' , $strEmail));
}
/**
* Checks if the passed values are correct.
*
* @param array the form object
*/
function validate($arrayForm) {
//--------------------------------------------------
// Initialize function
//--------------------------------------------------
// Array to hold the messages
$arrMessages = array();
// Set all form values that they validated. Could be improved by analyzing
// the values passed in $objForm and setting values accordingly.
$arrValidated = array();
$arrValidated['username'] = true;
$arrValidated['password'] = true;
$arrValidated['email'] = true;
// Never trust the values passed by users :)
$objForm = new stdClass();
$objForm->username = trim($arrayForm['username']);
$objForm->password = trim($arrayForm['password']);
$objForm->email = trim($arrayForm['email']);
//--------------------------------------------------
// Check values
//--------------------------------------------------
// Check username
if ($objForm->username == '') {
$arrMessages[] = ERR_USERNAME_EMPTY;
$arrValidated['username'] = false;
} else if ($objForm->username != 'peter') {
$arrMessages[] = ERR_USERNAME_INVALID;
$arrValidated['username'] = false;
}
// Check password
if ($objForm->password == '') {
$arrMessages[] = ERR_PASSWORD_EMPTY;
$arrValidated['password'] = false;
} else if ($objForm->password != 'gabriel') {
$arrMessages[] = ERR_PASSWORD_INVALID;
$arrValidated['password'] = false;
}
// Check email
if ($objForm->email == '') {
$arrMessages[] = ERR_EMAIL_EMPTY;
$arrValidated['email'] = false;
} else if ($this->_checkEmail($objForm->email) == false) {
$arrMessages[] = ERR_EMAIL_INVALID;
$arrValidated['email'] = false;
}
//--------------------------------------------------
// Finalize function
//--------------------------------------------------
// Create the message list
$strMessages = '';
if (count($arrMessages) > 0) {
$strMessages = '<ul>';
foreach ($arrMessages as $strTemp) {
$strMessages.= '<li>'.$strTemp.'</li>';
}
$strMessages.= '</ul>';
}
// Create a response object
$objResponse = new HTML_AJAX_Action();
// Assign the messages
$objResponse->assignAttr('messages', 'innerHTML', $strMessages);
$objResponse->insertScript("toggleElement('messages', ".(($strMessages != '') ? 1 : 0).");");
// Generate the scripts to update the form elements' label and input element
foreach ($arrValidated as $strKey => $blnValue) {
$objResponse->insertScript("setElement('".$strKey."', ".(($blnValue) ? '1' : '0').");");
}
// Test for no messages
if ($strMessages == "") {
$objResponse->insertAlert("Well done chap!");
}
// And ready! :)
return $objResponse;
}
}
?>

View File

@@ -1 +0,0 @@
["argument1","argument2","argument3"]

View File

@@ -1,74 +0,0 @@
<?php
require_once 'HTML/AJAX/Server.php';
class Foo {
function bar()
{
return 'hello';
}
}
function foobar()
{
return 'hello';
}
// start server
$server = new HTML_AJAX_Server();
// register normal function
$callback = 'foobar';
$server->registerPhpCallback($callback);
// register static method
$callback = array('Foo', 'bar');
$server->registerPhpCallback($callback);
// register object method
$foo = new Foo;
$callback = array($foo, 'bar');
$server->registerPhpCallback($callback);
// handle the request
if ($server->handleRequest()) {
exit;
}
?>
<html>
<head>
<script type='text/javascript' src="?client=all&amp;stub=all"></script>
<script type="text/javascript" language="Javascript">
<!--
HTML_AJAX.defaultServerUrl = 'php_callback.php';
function testCallPhpCallback(cb)
{
HTML_AJAX.callPhpCallback(cb, showResult);
}
function showResult(result)
{
alert(result);
}
var foo = new foo;
//-->
</script>
</head>
<body>
using HTML_AJAX.callPhpCallback()
<ul>
<li><a href="javascript:testCallPhpCallback('foobar')">normal function</a></li>
<li><a href="javascript:testCallPhpCallback(['Foo', 'bar'])">static method</a></li>
<li><a href="javascript:testCallPhpCallback([foo, 'bar'])">object method</a></li>
</ul>
exported
<ul>
<li><a href="javascript:alert(foo.bar())">object method</a></li>
</ul>
</body>
</html>

View File

@@ -1,166 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX in proxy operation
*
* All AJAX calls are handled by this same file and the proxy js is outputed in a js block directly in this script
* This is a use case very similar to Sajax (Sajax registers functions not objects)
*
* The only needed interaction is creation of a new object from the proxy defintion, all AJAX calls happen transparently from
*
* If you want to perform async calls a callback object must be passed to the constructor of the object
*
* The client JavaScript library is provided by server.php, you could also copy HTML_AJAX.js (all js files combined) or the seperate js files into your webroot
* from the PEAR data dir and src them directly
*
* This example also registers a custom error handler, without this handler errors float out of the app as an Exception
*
* An example debugging event listener is also shown
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the main HTML_AJAX class
include 'HTML/AJAX.php';
// our simple test class
include 'support/test.class.php';
// create an instance of HTML_AJAX
$ajax = new HTML_AJAX();
// register an instance of the test class
$ajax->registerClass(new test());
// handle and ajax call, if one is made die, else continue processing
if ($ajax->handleRequest()) {
die();
}
?><html>
<head>
<!-- the entire client library can be retreived in one call using the all keyword, or each piece can be requested like below -->
<script type='text/javascript' src="server.php?client=Main"></script>
<script type='text/javascript' src="server.php?client=Dispatcher"></script>
<script type='text/javascript' src="server.php?client=HttpClient"></script>
<script type='text/javascript' src="server.php?client=Request"></script>
<script type='text/javascript' src="server.php?client=JSON"></script>
<script type='text/javascript' src="server.php?client=iframe"></script>
<script type='text/javascript' src="server.php?client=loading"></script>
<script type='text/javascript'>
<?php
// generate proxy definition javascript for all registered class
echo $ajax->generateJavascriptClient();
?>
// definition of the callback javascript class, used to handle async requests
function callback() {}
callback.prototype = {
echo_string: function(result) {
document.getElementById('target').innerHTML = result;
},
slow_echo_string: function(result) {
document.getElementById('target').innerHTML = result;
},
error_test: function(result) {
document.getElementById('target').innerHTML = result;
}
}
// function used to clear out the target div
function clearTarget() {
document.getElementById('target').innerHTML = 'clear';
document.getElementById('eventLog').innerHTML = 'clear';
document.getElementById('error').innerHTML = 'clear';
}
// register a custom error handler
HTML_AJAX.onError = function(e) {
msg = "\n\n";
for(var i in e) {
msg += i + ':' + e[i] +"\n";
}
document.getElementById('error').innerHTML += msg;
}
// register custom event handlers, but lets keep the old ones so we still have that automatic loading message
var Open = HTML_AJAX.Open;
var Load = HTML_AJAX.Load;
HTML_AJAX.Open = function(request) {
Open(request);
document.getElementById('eventLog').innerHTML += "Open: "+request.className+'::'+request.methodName+"\n";
}
HTML_AJAX.Send = function(request) {
document.getElementById('eventLog').innerHTML += "Send: "+request.className+'::'+request.methodName+"\n";
}
HTML_AJAX.rogress = function(request) {
document.getElementById('eventLog').innerHTML += "Progress: "+request.className+'::'+request.methodName+"\n";
}
HTML_AJAX.Load = function(request) {
Load(request);
document.getElementById('eventLog').innerHTML += "Load: "+request.className+'::'+request.methodName+"\n";
}
</script>
</head>
<body>
<script type="text/javascript">
// create a proxy in sync mode
var syncProxy = new test();
// create a proxy in async mode
var asyncProxy = new test(new callback());
// run a sync call and set its results to the target div
function syncCall() {
document.getElementById('target').innerHTML = syncProxy.echo_string("I'm a sync call");
}
// run a sync call, callback class will handle its results
function asyncCall() {
asyncProxy.echo_string("I'm a async call");
}
// run a sync call, callback class will handle its results
// the purpose of this slow call is to show off the built in loading messaging
function slowAsyncCall() {
asyncProxy.slow_echo_string("I'm a slow async call");
}
// same thing, notice how it locks up your browser in Firefox you can't switch to another tab
function slowSyncCall() {
document.getElementById('target').innerHTML = syncProxy.slow_echo_string("I'm a slow sync call");
}
// run a sync call, callback class will handle its results
function serverErrorExample() {
asyncProxy.error_test("I'm an error generated by trigger error in test.class.php");
}
// same as above, shown for completeness
function serverErrorSyncExample() {
document.getElementById('target').innerHTML = syncProxy.error_test("I'm an error generated by trigger error in test.class.php");
}
</script>
<ul>
<li><a href="javascript:clearTarget()">Clear Target</a></li>
<li><a href="javascript:syncCall()">Run Sync Echo call</a></li>
<li><a href="javascript:asyncCall();">Run Async Echo call</a></li>
<li><a href="javascript:slowAsyncCall();">Run Slow Async Echo call (sleep on server to emulate slow processing)</a></li>
<li><a href="javascript:slowSyncCall();">Run Slow Sync Echo call (notice how it locks your browser)</a></li>
<li><a href="javascript:serverErrorExample();">Run a call where an error is generated on the server (Async)</a></li>
<li><a href="javascript:serverErrorSyncExample();">Run a call where an error is generated on the server (Sync)</a></li>
</ul>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 300px; height: 400px; border: solid 2px black; overflow: auto; float: right;" id="error">Error Target</div>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 500px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 500px; height: 400px; border: solid 2px black; overflow: auto;" id="eventLog">Event Log
</div>
</body>
</html>

View File

@@ -1,123 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX in proxy operation
*
* All AJAX calls are handled by the auto_server.php file, server.php could also be used, the differences between the two are covered in those files
* This is a use case very similar to JPSpan (JPSpan only has a server.php equivalent)
*
* The only needed interaction is creation of a new object from the proxy defintion, all AJAX calls happen transparently from there
*
* If you want to perform async calls a callback object must be passed to the constructor of the object
*
* The client JavaScript library is provided by auto_server.php, you could also copy HTML_AJAX.js (all js files combined) or the seperate js files into your webroot
* from the PEAR data dir and src them directly. You can use multiple includes of the component files or use the all flag to get them all at once.
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// set a cookie so we always have an example cookie for the test
setcookie('testcookie',"Doesn't taste as good as a peanut butter cookie");
?><html>
<head>
<!-- These two calls can be combined into one call if wanted, but its not recomended since it will hurt caching as you might want stubs of multiple classes -->
<script type='text/javascript' src="auto_server.php?client=all"></script>
<!-- Stub is passed the class you want the proxy definition for, you can also use all to get every registered class but that create those auto server
has to instanciate every class where here only the class used on this page has to be instanciated -->
<script type='text/javascript' src="auto_server.php?stub=test"></script>
<script type='text/javascript'>
// definition of the callback javascript class, used to handle async requests
function callback() {}
callback.prototype = {
echo_string: function(result) {
document.getElementById('target').innerHTML = result;
},
cookies: function(result) {
var ret = "";
for(var i in result) {
ret += i+':'+result[i]+"\n";
}
document.getElementById('target').innerHTML = ret;
},
echo_data: function(result) {
document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result);
},
unicode_data: function(result) {
document.getElementById('target').innerHTML = HTML_AJAX_Util.varDump(result);
},
dump: function(result) {
document.getElementById('target').innerHTML = result;
}
}
// function used to clear out the target div
function clearTarget() {
document.getElementById('target').innerHTML = 'clear';
}
</script>
</head>
<body>
<script type="text/javascript">
// create a proxy in sync mode
var syncProxy = new test();
// create a proxy in async mode
var asyncProxy = new test(new callback());
// run a sync call and set its results to the target div
function syncCall() {
document.getElementById('target').innerHTML = syncProxy.echo_string("I'm a sync call");
}
// run a sync call, callback class will handle its results
function asyncCall() {
asyncProxy.echo_string("I'm a async call");
}
function unicodeTest() {
//asyncProxy.echo_data({'suggestion': ['Français', 'caractères']});
asyncProxy.echo_data({"suggestion":["Fran\u00e7ais","caract\u00e8res"]});
}
function unicodeTest2() {
asyncProxy.unicode_data();
}
function cookieTest() {
asyncProxy.cookies();
}
function assocTest() {
asyncProxy.dump({a: 'first var', b: 'second var'});
}
</script>
<ul>
<li><a href="javascript:clearTarget()">Clear Target</a></li>
<li><a href="javascript:syncCall()">Run Sync Echo call</a></li>
<li><a href="javascript:asyncCall();">Run Async Echo call</a></li>
<li><a href="javascript:unicodeTest();">Check ability to round trip utf-8 JSON data</a></li>
<li><a href="javascript:unicodeTest2();">Check ability to recieve utf-8 JSON data</a></li>
<li><a href="javascript:assocTest();">Check ability to decode js hashes into PHP associative arrays using JSON</a></li>
<li><a href="javascript:cookieTest();">View Cookies</a></li>
</ul>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
<div>
Runing view Cookies should show you these same cookies being returned by the AJAX call<br>
If the lists don't match, try reloading this page, it sets a test cookie, but we can't see it on the PHP side until the client returns it on a test.
<pre>
<?php
var_dump($_COOKIE);
?>
</pre>
</div>
</body>
</html>

View File

@@ -1,149 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX in proxyless operation
*
* This is the simplest way to use HTML_AJAX if your just using grab and replace functions you don't even need a server
* You need every javascript file except JSON which is optional and is only needed if your using that encoding
*
* The proxyless api is provided by Main.js
*
* There are 4 main methods and 2 properties to the proxyless api, they all exist as static methods on HTML_AJAX
* HTML_AJAX.grab(url)
* HTML_AJAX.post(url,payload)
* HTML_AJAX.replace(id,url) or HTML_AJAX.replace(id,class,method,arg1,arg2,etc)
* HTML_AJAX.call(class,method,callback,arg1,arg2,etc)
*
* HTML_AJAX.defaultServerUrl = 'serverurl';
* HTML_AJAX.defaultEncoding = 'Null';
*
* The api is demonstrated below, server.php is used for call examples and to load the needed js files
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<script type='text/javascript' src="server.php?client=Util"></script>
<script type='text/javascript' src="server.php?client=main"></script>
<script type='text/javascript' src="server.php?client=dispatcher"></script>
<script type='text/javascript' src="server.php?client=HttpClient"></script>
<script type='text/javascript' src="server.php?client=Request"></script>
<script type='text/javascript' src="server.php?client=json"></script>
<script type='text/javascript' src="server.php?client=loading"></script>
<script type='text/javascript' src="server.php?client=iframe"></script>
<script type='text/javascript' src="server.php?client=urlserializer"></script>
</head>
<body>
<script type="text/javascript">
function clearTarget() {
document.getElementById('target').innerHTML = 'clear';
}
// Add an error handler so we get an alert if any errors happen while making an AJAX call
HTML_AJAX.onError = function(e)
{
alert(HTML_AJAX_Util.varDump(e));
}
// Grab is the simplest usage of HTML_AJAX you use it to perform a request to a page and get its results back
// It can be used in either Sync mode where it returns directory or with a call back, both methods are shown below
var url = 'README';
function grabSync() {
document.getElementById('target').innerHTML = HTML_AJAX.grab(url);
}
function grabAsync() {
HTML_AJAX.grab(url,grabCallback);
}
function grabCallback(result) {
document.getElementById('target').innerHTML = result;
}
// POST lets you make simple POST requests to a url, if you use a hash {key:value,key2:value,etc} as the payload then the
// data will be automatically be urlencoded, making it look like a form submission to the server
// if the data is a string it will be sent as is
var postUrl = 'support/post_tester.php';
function postSync() {
document.getElementById('target').innerHTML = HTML_AJAX.post(postUrl,{dog:'bob',cat:'tigger'});
}
function postAsync() {
HTML_AJAX.post(postUrl,{dog:'bob',cat:'tigger'},grabCallback);
}
function postCallback(result) {
document.getElementById('target').innerHTML = result;
}
// replace can operate either against a url like grab or against a remote method
// if its going to be used against a remote method defaultServerUrl needs to be set to a url that is exporting the class its trying to call
// note that replace replace always works async
HTML_AJAX.defaultServerUrl = 'server.php';
function replaceUrl() {
HTML_AJAX.replace('target',url);
}
function replaceFromMethod() {
HTML_AJAX.replace('target','test','echo_string','Im a method call replacement');
}
function replaceFromMethodMulti() {
// Null encoding does not support multiple arguments, you have to use JSON for that
HTML_AJAX.defaultEncoding = 'JSON'; // set encoding to JSON encoding method
HTML_AJAX.replace('target','test','multiarg','argument1','argument2','argument3');
HTML_AJAX.defaultEncoding = 'Null'; // return it to default which is Null
}
// call is used to call a method on a remote server
// you need to set HTML_AJAX.defaultServerUrl to use it
// you might also want to set HTML_AJAX.defaultEncoding, options are Null and JSON, the server will autodetect this encoding from your content type
// but the return content type will be based on whatever the servers settings are
// You can use call in either Sync or Async mode depending on if you pass it a callback function
function callSync() {
HTML_AJAX.defaultEncoding = 'JSON'; // set encoding to JSON encoding method
document.getElementById('target').innerHTML = HTML_AJAX.call('test','echo_string',false,'Im text that was echoed');
HTML_AJAX.defaultEncoding = 'Null'; // return it to default which is Null
}
function callAsync() {
HTML_AJAX.call('test','echo_string',callCallback,'Im text that was echoed Async');
}
function callCallback(result) {
document.getElementById('target').innerHTML = result;
}
</script>
<ul>
<li><a href="javascript:clearTarget()">Clear Target</a></li>
<li><a href="javascript:grabSync()">Run Sync Grab Example</a></li>
<li><a href="javascript:grabAsync()">Run Async Grab Example</a></li>
<li><a href="javascript:postSync()">Run Sync Post Example</a></li>
<li><a href="javascript:postAsync()">Run Async Post Example</a></li>
<li><a href="javascript:replaceUrl()">Replace with content from a url</a></li>
<li><a href="javascript:replaceFromMethod()">Replace with content from a method call</a></li>
<li><a href="javascript:replaceFromMethodMulti()">Replace with content from a method call (multiple method arguments)</a></li>
<li><a href="javascript:callSync()">Sync Call</a></li>
<li><a href="javascript:callAsync()">ASync Call</a></li>
</ul>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,76 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX with a queue
*
* When using HTML_AJAX your actually always using a queue, its just its a simple one that always performs whatever actions its given immediately
* HTML_AJAX however provides other queues offering different modes of operation
*
* Currently the Queues are (class names are prefixed with: HTML_AJAX_Queue_):
* Immediate - Default make the request immediately
* Interval_SingleBuffer - Make request on an interval with holding just the last request between calls
*
* Interval_SingleBuffer is generally used for Live Search/Google Suggest type operations
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<script type='text/javascript' src="server.php?client=Util,main,dispatcher,httpclient,request,json,loading,iframe,queues"></script>
<script type='text/javascript' src="auto_server.php?stub=livesearch"></script>
</head>
<body>
<script type="text/javascript">
// callback hash, outputs the results of the search method
callback = {
search: function(result) {
var out = "<ul>";
// if we have object this works right, if we have an array we get a problem
// if we have sparse keys will get an array back otherwise will get an array
for(var i in result) {
if (i != '______array') {
out += "<li>"+i+" = "+result[i]+"</li>";
}
}
out += "</ul>";
document.getElementById('target').innerHTML = out;
}
}
// setup our remote object from the generated proxy stub
var remoteLiveSearch = new livesearch(callback);
// we could change the queue by overriding the default one, but generally you want to create a new one
// set our remote object to use the rls queue
remoteLiveSearch.dispatcher.queue = 'rls';
// create the rls queue, with a 350ms buffer, a larger interval such as 2000 is useful to see what is happening but not so useful in real life
HTML_AJAX.queues['rls'] = new HTML_AJAX_Queue_Interval_SingleBuffer(350);
// what to call on onkeyup, you might want some logic here to not search on empty strings or to do something else in those cases
function searchRequest(searchBox) {
remoteLiveSearch.search(searchBox.value);
}
</script>
<p>This is a really basic LiveSearch example, type in the box below to find a fruit</p>
Search <input id="search" autocomplete="off" onkeyup="searchRequest(this)">
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,36 +0,0 @@
<?php
/**
* Server that exposes a class for doing a fake review
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
class ReviewServer extends HTML_AJAX_Server {
// this flag must be set to on init methods
var $initMethods = true;
// init method for the test class, includes needed files an registers it for ajax
function initReview() {
include 'review.class.php';
$this->registerClass(new review(),'Review',array('newReview','updateReview')); // specify methods so that we get case in php4
}
}
session_start();
// create an instance of our test server
$server = new ReviewServer();
// handle requests as needed
$server->handleRequest();
?>

View File

@@ -1,136 +0,0 @@
<?php
/**
* Almost real life example, show a list reviews, letting you add one, and then updating the list
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
session_start();
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'auto_server.php';
$ajaxHelper->jsLibraries[] = 'JSON'; // not included in the default list before 0.2.6
?>
<html>
<head>
<?php
// output a javascript neded to setup HTML_AJAX
// by default this is all the libraries shipped with HTML_AJAX, take a look at $ajaxHelper->jsLibraries to edit the list
echo $ajaxHelper->setupAJAX();
// ajax helper should do this for you but it doesn't yet
?>
<script type="text/javascript" src="auto_server.php?stub=review"></script>
<script type="text/javascript">
var reviewCallback = {
// after a review we get a chunk of html that we can update the reviewList with
newReview: function(result) {
document.getElementById('reviewList').innerHTML += result;
},
// after a review is updated we get a chunk of html, replace a node from our lookup list with that
updateReview: function(result) {
var newdiv = document.createElement('div');
newdiv.innerHTML = result[1];
document.getElementById('reviewList').replaceChild(newdiv.firstChild,reviewCallback.nodeList[result[0]]);
},
nodeList: []
}
function sendReview(form) {
var remoteReview = new Review(reviewCallback);
var payload = new Object();
for(var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name) {
payload[form.elements[i].name] = form.elements[i].value;
}
}
// do any needed validation here
remoteReview.newReview(payload);
}
function updateReview(id,form) {
var remoteReview = new Review(reviewCallback);
var payload = new Object();
for(var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name) {
payload[form.elements[i].name] = form.elements[i].value;
}
}
// do any needed validation here
remoteReview.updateReview(id,payload);
}
function editReview(id,node) {
var form = document.getElementById('reviewForm').cloneNode(true);
form.onsubmit = function() { updateReview(id,this); return false; }
var data = new Object();
var divs = node.getElementsByTagName('div');
for(var i = 0; i < divs.length; i++) {
if (divs[i].className) {
data[divs[i].className] = divs[i].innerHTML;
}
}
for(var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name) {
form.elements[i].value = data[form.elements[i].name];
}
}
document.getElementById('reviewList').replaceChild(form,node);
reviewCallback.nodeList[id] = form;
}
</script>
<style type="text/css">
.name {
margin-top: 5px;
background-color: #ddd;
}
#reviewList {
width: 300px;
}
</style>
</head>
<body>
<h2>Add a new Review</h2>
<form id="reviewForm" onsubmit="sendReview(this); return false;" style="border: dotted 1px black">
Your Name: <input name="name"><br>
Your Review: <textarea name="review"></textarea><br>
<input type="submit">
</form>
<div id="reviewList">
<?php
if (isset($_SESSION['reviews'])) {
foreach($_SESSION['reviews'] as $key => $review) {
echo "<div onclick='editReview($key,this)'><div class='name'>$review->name</div><div class='review'>$review->review</div></div>\n";
}
}
?>
</div>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,33 +0,0 @@
<?php
class Review {
// constructor won't be exported
function Review() {
if (!isset($_SESSION['reviews'])) {
$_SESSION['reviews'] = array();
}
}
// data is an array of objects
function newReview($data) {
// clean data, its coming from the client
$data['name'] = htmlentities($data['name']);
$data['review'] = htmlentities($data['review']);
$_SESSION['reviews'][] = $data;
$key = count($_SESSION['reviews'])-1;
return "<div onclick='editReview($key,this)'><div class='name'>$data[name]</div><div class='review'>$data[review]</div></div>";
}
function updateReview($key,$data) {
// clean data, its coming from the client
$data['name'] = htmlentities($data['name']);
$data['review'] = htmlentities($data['review']);
$_SESSION['reviews'][$key] = $data;
return array($key,"<div onclick='editReview($key,this)'><div class='name'>$data[name]</div><div class='review'>$data[review]</div></div>");
}
}
?>

View File

@@ -1,36 +0,0 @@
<?php
/**
* Simplest possible usage of HTML_AJAX_Server
*
* The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir
* 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
// include the server class
include 'HTML/AJAX/Server.php';
// include the test class will be registering
include 'support/test.class.php';
// create our new server
$server = new HTML_AJAX_Server();
// register an instance of the class were registering
$test =& new test();
$server->registerClass($test);
$server->ajax->packJavaScript = true;
// handle different types of requests possiblities are
// ?client=all - request for all javascript client files
// ?stub=classname - request for proxy stub for given class, can be combined with client but this may hurt caching unless stub=all is used
// ?c=classname&m=method - an ajax call, server handles serialization and handing things off to the proper method then returning the results
$server->handleRequest();
?>

View File

@@ -1,67 +0,0 @@
<?php
/**
* AJAX form submission, practical example
*
* @category HTML
* @package AJAX
* @author Arpad Ray <arpad@php.net>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
define('MESSAGE_FILE', 'messages.txt');
$messages = (is_readable(MESSAGE_FILE) ? unserialize(file_get_contents(MESSAGE_FILE)) : array());
function show_messages()
{
foreach ($GLOBALS['messages'] as $m) {
echo "<br>Name:{$m[0]}<br>Message:{$m[1]}<br><hr>";
}
}
function save_messages()
{
if ($h = @fopen(MESSAGE_FILE, 'wb')) {
$GLOBALS['messages'] = array_slice($GLOBALS['messages'], -5);
fwrite($h, serialize($GLOBALS['messages']));
fclose($h);
}
}
if (!empty($_POST)) {
if (!empty($_POST['name']) && !empty($_POST['message'])) {
$messages[] = array(
htmlspecialchars(strip_tags(substr($_POST['name'], 0, 10))),
htmlspecialchars(strip_tags(substr($_POST['message'], 0, 30)))
);
save_messages();
}
show_messages();
exit;
}
?><html>
<head>
<script type="text/javascript" src="server.php?client=all&amp;stub=all"></script>
</head>
<body>
<h1>Messages:</h1>
<div id="target">
<?php show_messages(); ?>
</div>
<form action="shoutbox.php" method="post" onsubmit="return !HTML_AJAX.formSubmit(this, 'target')">
<label>
Name:
<input type="text" name="name" id="name" />
</label>
<label>
Message:
<input type="text" name="message" id="message" />
</label>
<input type="submit" value="Submit" />
</form>
</body>
</html>

View File

@@ -1,77 +0,0 @@
<?php
/**
* Using the ordered queue to deal with high latency
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
session_start();
if (isset($_GET['latency'])) {
$_SESSION['sleep'] = $_GET['latency'];
}
?>
<html>
<head>
<script type='text/javascript' src="server.php?client=Util,main,dispatcher,httpclient,request,json,loading,iframe,orderedqueue"></script>
<script type='text/javascript' src="slow_server.php?stub=livesearch"></script>
</head>
<body>
<script type="text/javascript">
// callback hash, outputs the results of the search method
callback = {
search: function(result) {
var out = "<ul>";
// if we have object this works right, if we have an array we get a problem
// if we have sparse keys will get an array back otherwise will get an array
for(var i in result) {
if (i != '______array') {
out += "<li>"+i+" = "+result[i]+"</li>";
}
}
out += "</ul>";
document.getElementById('target').innerHTML = out;
}
}
// setup our remote object from the generated proxy stub
var remoteLiveSearch = new livesearch(callback);
// we could change the queue by overriding the default one, but generally you want to create a new one
// set our remote object to use the ordered queue
remoteLiveSearch.dispatcher.queue = 'ordered';
HTML_AJAX.queues['ordered'] = new HTML_AJAX_Queue_Ordered();
// what to call on onkeyup, you might want some logic here to not search on empty strings or to do something else in those cases
function searchRequest(searchBox) {
remoteLiveSearch.search(searchBox.value);
}
</script>
<p>This is a really basic LiveSearch example, type in the box below to find a fruit</p>
<p>By deafult server add latency to the request, starting with 5 seconds and reducing 1 second per request</p>
<p>An ordered queue has been used which should make results come back in the order they are sent not the order they are received</p>
<form action="slow_livesearch.php">
<label>Set current latency too: <input name="latency" size=4><input type="submit">
</form>
<hr><br>
Search <input id="search" autocomplete="off" onkeyup="searchRequest(this)">
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
</body>
</html>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@@ -1,56 +0,0 @@
<?php
/**
* A server that adds artificial latency to requests
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
session_start();
// include the server class
include 'HTML/AJAX/Server.php';
// don't add delays to client library requests
if (!isset($_GET['client']) && !isset($_GET['stub'])) {
if (!isset($_SESSION['sleep']) || $_SESSION['sleep'] == 0) {
$_SESSION['sleep'] = 5;
}
sleep($_SESSION['sleep']--);
}
// extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
class TestServer extends HTML_AJAX_Server {
// this flag must be set to on init methods
var $initMethods = true;
// init method for the test class, includes needed files an registers it for ajax
function initTest() {
include 'support/test.class.php';
$this->registerClass(new test());
}
// init method for the livesearch class, includes needed files an registers it for ajax
function initLivesearch() {
include 'support/livesearch.class.php';
$this->registerClass(new livesearch());
}
// init method for the testHaa class, includes needed files an registers it for ajax, directly passes in methods to register to specify case in php4
function initTestHaa() {
include 'support/testHaa.class.php';
$this->registerClass(new testHaa(),'testHaa',array('updateClassName'));
}
}
$server = new TestServer();
// handle requests as needed
$server->handleRequest();
?>

View File

@@ -1,5 +0,0 @@
// An example custom javascript library served up by the auto_server
function customLibAlert(msg) {
alert(msg);
}

View File

@@ -1,35 +0,0 @@
<?php
class Interceptor {
/**
* A global interceptor runs all calls not matched by a more specific rule
* This example creates a not logged in error
*/
function intercept($className,$methodName,$params) {
// if you were using php5 you could throw an exception instead of using trigger_error
trigger_error("Not logged in: $className::$methodName");
return $params;
}
/**
* A class level interceptor for the test class
* This examples sets the first parameter to the method name
*/
function test($methodName,$params) {
$params[0] = 'Intercepted: '.$methodName.' - Original: '.$params[0];
return $params;
}
/**
* A method level interceptor for the test::test1 method
* This examples sets the first parameter to boink
*/
function test_test1($params) {
$params[0] = 'Intercepted: boink - Original: '.$params[0];
return $params;
}
}

View File

@@ -1,7 +0,0 @@
<?php
require_once 'HTML/AJAX/Helper.php';
$helper = new HTML_AJAX_Helper();
var_dump($helper->isAJAX());
?>

View File

@@ -1,60 +0,0 @@
<?php
/**
* Simple test class for doing fake livesearch
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
class livesearch {
/**
* Items to search against
*/
var $livesearch = array(
'Orange',
'Apple',
'Pear',
'Banana',
'Blueberry',
'Fig',
'Apricot',
'Cherry',
'Peach',
'Plum',
'Nectarine',
'Boysenberry',
'Cranberry',
'Blackberry',
'Clementine',
'Grapefruit',
'Lemon',
'Lime',
'Tangerine'
);
/**
* Perform a search
*
* @return array
*/
function search($input="") {
$ret = array();
if(empty($input)) {
return $ret;
}
if (isset($_SESSION['sleep'])) {
$ret['Latency Added'] = $_SESSION['sleep'];
}
foreach($this->livesearch as $key => $value) {
if (stristr($value,$input)) {
$ret[$key] = $value;
}
}
return $ret;
}
}
?>

View File

@@ -1,3 +0,0 @@
<?php
var_dump($_POST);
?>

View File

@@ -1,68 +0,0 @@
<?php
/**
* Test class used in other examples
* Constructors and private methods marked with _ are never exported in proxies to JavaScript
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
class test {
function test() {
}
function _private() {
}
function echo_string($string) {
return "From PHP: ".$string;
}
function echo_strings($strings) {
return $strings;
}
function slow_echo_string($string) {
sleep(2);
return "From PHP: ".$string;
}
function error_test($string) {
trigger_error($string);
}
function multiarg() {
$args = func_get_args();
return "passed in ".count($args)." args ".var_export($args, TRUE);
}
function cookies() {
return $_COOKIE;
}
function echo_data($data) {
return array('From PHP:'=>$data);
}
function dump($data) {
return print_r($data, true);
}
function unicode_data() {
$returnData = array('word' => mb_convert_encoding('Français','UTF-8'), 'suggestion' => array(mb_convert_encoding('Français','UTF-8'), mb_convert_encoding('caractères','UTF-8')));
return $returnData;
}
function test1($in) {
return $in;
}
function test2($in) {
return $in;
}
function test3($in) {
return $in;
}
}
if (isset($_GET['TEST_CLASS'])) {
$t = new test();
var_dump($t->echo_string('test string'));
var_dump($t->slow_echo_string('test string'));
var_dump($t->error_test('test string'));
var_dump($t->multiarg('arg1','arg2','arg3'));
}
?>

View File

@@ -1,18 +0,0 @@
<?php
/**
* Test class used in other examples
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
class test2 {
function test($in) {
return $in;
}
}
?>

View File

@@ -1,37 +0,0 @@
<?php
/**
* Require the action class
*/
require_once 'HTML/AJAX/Action.php';
class testHaa {
function updateClassName() {
$response = new HTML_AJAX_Action();
$response->assignAttr('test','className','test');
return $response;
}
function greenText($id) {
$response = new HTML_AJAX_Action();
$response->assignAttr($id,'style','color: green');
return $response;
}
function highlight($id) {
$response = new HTML_AJAX_Action();
$response->assignAttr($id,'style','background-color: yellow');
return $response;
}
function duplicate($id,$dest) {
// there really should be an action method to do this
$response = new HTML_AJAX_Action();
$response->insertScript("
var newNode = document.getElementById('$id').cloneNode(true);
newNode.id = 'newNode';
document.getElementById('$dest').appendChild(newNode);");
return $response;
}
}

View File

@@ -1,119 +0,0 @@
<?php
/**
* Test class used in xml examples - notice we have a dom(php5) and a domxml(php4) version
*
* @category HTML
* @package AJAX
* @author Elizabeth Smith <auroraeosrose@gmail.com>
* @copyright 2005-2006 Elizabeth Smith
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
class TestXml {
function createHealthy()
{
if(extension_loaded('Dom'))
{
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->createElement('root');
$root = $dom->appendChild($root);
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'fruit');
$element->appendChild($dom->createTextNode('peach'));
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'fruit');
$element->appendChild($dom->createTextNode('plum'));
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'vegetable');
$element->appendChild($dom->createTextNode('carrot'));
return $dom;
}
elseif (extension_loaded('Domxml'))
{
$dom = domxml_new_doc('1.0');
$element = $dom->create_element('root');
$root = $dom->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'fruit');
$element->set_content('peach');
$root->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'fruit');
$element->set_content('plum');
$root->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'vegetable');
$element->set_content('carrot');
$root->append_child($element);
return $dom;
}
else {
return 'No Dom Support';
}
}
function createJunk()
{
if(extension_loaded('Dom'))
{
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->createElement('root');
$root = $dom->appendChild($root);
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'drink');
$element->appendChild($dom->createTextNode('coke'));
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'drink');
$element->appendChild($dom->createTextNode('beer'));
$element = $dom->createElement('item');
$element = $root->appendChild($element);
$element->setAttribute('type', 'dessert');
$element->appendChild($dom->createTextNode('pie'));
return $dom;
}
else if(extension_loaded('Domxml'))
{
$dom = domxml_new_doc('1.0');
$element = $dom->create_element('root');
$root = $dom->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'fruit');
$element->set_content('peach');
$root->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'fruit');
$element->set_content('plum');
$root->append_child($element);
$element = $dom->create_element('item');
$element->set_attribute('type', 'vegetable');
$element->set_content('carrot');
$root->append_child($element);
return $dom;
}
else {
return 'No Dom Support';
}
}
function writeDoc($dom) {
if(extension_loaded('Dom'))
{
// save implementation is broken in dom right now
file_put_contents('test.xml', $dom->saveXML());
}
else if(extension_loaded('Domxml'))
{
$doc->dump_file(realpath('test.xml'),false,true);
}
else {
return 'No Dom Support';
}
}
}
?>

View File

@@ -1,49 +0,0 @@
<html>
<head>
<title>Behavior Speed Test</title>
<script type="text/javascript" src="../server.php?client=util,main,alias,behavior"></script>
<script type="text/javascript">
Behavior.debug = 'debug';
Behavior.register('.one',function(element) {
element.style.color = 'red';
}
);
Behavior.register('.two',function(element) {
element.style.color = 'blue';
}
);
Behavior.register('.three',function(element) {
element.style.color = 'green';
}
);
Behavior.register('.four',function(element) {
element.style.color = 'orange';
}
);
Behavior.register('.five',function(element) {
element.style.color = 'purple';
}
);
</script>
</head>
<body>
<p>This page is used to test the speed of HTML_AJAX's JavaScript Behavior support.</p>
<pre id="debug">
</pre>
<?php
$classes = array('one','two','three','four','five');
for($i = 0; $i < 100; $i++) {
$class = $classes[array_rand($classes)];
echo "<div class='$class' id='el$i'>$class";
for($b = 0; $b < 50; $b++) {
$c = $classes[array_rand($classes)];
echo "<span class='$c' id='el$i$b'>$c</span>";
}
echo "</div>\n";
}
?>
</body>
</html>

View File

@@ -1,16 +0,0 @@
<?php
/**
* Duplicate JS files are automatically removed by HTML_AJAX_Server
*
* This is a test for that functionality
*/
?>
<html>
<head>
<title>Duplicate JS library Test</title>
<script src="../server.php?client=Queue,orderedQueue,priorityqueue"></script>
</head>
<body>
<p>Nothing to see here, view: <a href="../server.php?client=Queue,orderedQueue,priorityqueue">../server.php?client=Queue,orderedQueue,priorityQueue</a> to test</p>
</body>
</html>

View File

@@ -1,51 +0,0 @@
<?php
/**
* HTML_AJAX_Util.getElements*() examples
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn josh@bluga.net
* @copyright 2006 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<title>HTML_AJAX_Util.getElements* examples</title>
<script type="text/javascript" src="../server.php?client=util"></script>
</head>
<body>
<div id="t">
<div id="test_one" class="test">Blah</div>
<div id="test_two" class="yellow">blah 2</div>
<div id="three" class="test">Blah 3</div>
</div>
<h3>Test HTML</h3>
<pre id="target0"></pre>
<h3>getElementsByClassName</h3>
<div id="target1"></div>
<h3>getElementsById</h3>
<div id="target2"></div>
<script type="text/javascript">
document.getElementById('target0').innerHTML = HTML_AJAX_Util.htmlEscape(document.getElementById('t').innerHTML);
var els = HTML_AJAX_Util.getElementsByClassName('test');
var t = document.getElementById('target1');
for(var i = 0; i < els.length; i++) {
t.innerHTML += "Found: "+els[i].innerHTML+"<br>";
}
var els = HTML_AJAX_Util.getElementsById('test');
var t = document.getElementById('target2');
for(var i = 0; i < els.length; i++) {
t.innerHTML += "Found: "+els[i].innerHTML+"<br>";
}
</script>
</body>
</html>

View File

@@ -1,90 +0,0 @@
<?php
/**
* HTML_AJAX_Util.varDump() examples
*
* @category HTML
* @package AJAX
* @author Arpad Ray <arpad@php.net>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<script type="text/javascript" src="../server.php?client=util"></script>
<script type="text/javascript">
function foo() {
this.bar = "baz";
this.bat = 5;
}
var obj = new foo();
var a = [
null,
true,
13,
1.337,
'foo',
[1, 2, 3],
[1, [1, 2, 3], 3],
obj
];
function dotest() {
var foo = document.getElementById("foo");
for (ak in a) {
foo.innerHTML += "<pre>" + HTML_AJAX_Util.varDump(a[ak], 1) + "</pre><br>";
}
}
</script></head><body onload="dotest()">
<hr>
PHP:
<hr>
<div>
<?php
class foo {
var $bar = 'baz';
var $bat = 5;
}
$obj = new foo;
$a = array(
null,
true,
13,
1.337,
'foo',
array(1, 2, 3),
array(1, array(1, 2, 3), 3),
$obj
);
foreach ($a as $v) {
echo "<pre>";
var_dump($v);
echo "</pre>";
}
?>
</div>
<hr>
Javascript:
<hr>
<div id="foo">
</div>
<hr>
Source:
<hr>
<div>
<?php show_source(__FILE__); ?>
</div>
</body>
</html>

View File

@@ -1,106 +0,0 @@
<script type="text/javascript" src="../server.php?client=phpSerializer,util"></script>
<?php
$examples = array(
'$foo = null;',
'$foo = true;',
'$foo = "foobar";',
'$foo = 337;',
'$foo = 99.99;',
'$foo = array("a" => 1, "b" => 2, 3);',
'$foo = array(1,2,array(1,2,3));',
'class Foo { var $foo; var $bar; }'
. '$foo = new Foo; $foo->foo = "hello"; $foo->bar = array("world","universe");'
);
echo '<h1><a name="pos">Positives</a> | <a href="#neg">Negatives</a></h1>';
$c = count($examples);
for ($i = 0; $i < $c; $i++) {
echo "<strong>PHP Code:</strong>\n<pre>$examples[$i]</pre>\n<strong>PHP value:</strong><pre>\n";
eval($examples[$i]);
var_dump($foo);
$sfoo = serialize($foo);
echo "</pre>\n<strong>Serialized in PHP:</strong>\n<pre>", $sfoo, "</pre>\n",
"<strong>Unserialized in JS:</strong>\n<pre>\n",
'<script type="text/javascript">',
'var jsr = new HTML_AJAX_Serialize_PHP();',
'var sfoo = unescape("', urlencode($sfoo), '"); var usfoo = jsr.unserialize(sfoo); if (jsr.error) {',
'document.write("Error: " + jsr.getError() + "\n"); } document.write(HTML_AJAX_Util.varDump(usfoo) + ',
'"</pre>\n<strong>Serialized in JS:</strong>\n<pre>" + jsr.serialize(usfoo));', "</script>\n</pre>\n<hr />\n\n";
}
$bad_examples = array(
'x',
'x:1',
'N',
'Nx',
'b:f;',
'b:1',
'i:foo;',
'i:1',
'd:foo;',
'd:1.1.1;',
'd:1.1',
's:6:"foo";',
's:6:"foofoo"',
's:1:"foo";',
's:0:""',
'a:3:{s:1:"aa";i:1;s:1:"b";i:2;i:0;i:3;}',
'a:4:{s:1:"a";i:1;s:1:"b";i:2;i:0;i:3;',
'a:3:{i:1;s:1:"b";i:2;i:0;i:3;}',
'a:3:{}',
'O:3:"Fooo":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":3:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}',
'O:3:"Foo":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe"}}'
);
echo '<h1><a href="#pos">Positives</a> | <a name="neg">Negatives</a></h1>';
foreach ($bad_examples as $sfoo) {
echo "</pre>\n<strong>Invalidly serialized:</strong>\n<pre>", $sfoo, "</pre>\n",
"<strong>Unserialized in JS:</strong>\n<pre>\n",
'<script type="text/javascript">',
'var sfoo = unescape("', urlencode($sfoo), '"); var usfoo = jsr.unserialize(sfoo); if (jsr.error) {',
'document.write("Error: " + jsr.getError() + "\n"); } document.write(HTML_AJAX_Util.varDump(usfoo));',
"</script>\n</pre>\n<hr />\n\n";
}
$good_objects = array(
'O:3:"Foo":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:3:"foo";s:87:"O:3:"Bar":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:3:"foo";s:90:"hi"O:3:"Bar":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}'
);
$bad_objects = array(
'O:6:"stdClass":2:{s:3:"foo";s:5:"hello";s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";s:2:"hi";}s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}',
'O:3:"Foo":2:{s:6:"hi"foo";O:8:"stdClass":1:{s:3:"bar";s:2:"hi";}s:3:"bar";a:2:{i:0;s:5:"world";i:1;s:8:"universe";}}'
);
include('HTML/AJAX/Serializer/PHP.php');
$sr = new HTML_AJAX_Serializer_PHP;
$allowedClasses = array('Foo');
echo '<h1><a name="opos">Object Positives</a> | <a href="#oneg">Object Negatives</a></h1>';
foreach ($good_objects as $sfoo) {
echo "</pre>\n<strong>Serialized in PHP:</strong>\n<pre>", $sfoo, "</pre>\n",
"<strong>Class Names</strong><pre>\n", implode(', ', $sr->_getSerializedClassNames($sfoo)),
"</pre><strong>Unserialized in PHP:</strong>\n<pre>\n";
var_dump($sr->unserialize($sfoo, $allowedClasses));
echo "</pre>\n<hr />\n\n";
}
echo '<h1><a href="#opos">Object Positives</a> | <a name="oneg">Object Negatives</a></h1>';
foreach ($bad_objects as $sfoo) {
echo "</pre>\n<strong>Serialized in PHP:</strong>\n<pre>", $sfoo, "</pre>\n",
"<strong>Class Names</strong><pre>\n", implode(', ', $sr->_getSerializedClassNames($sfoo)),
"</pre><strong>Unserialized in PHP:</strong>\n<pre>\n";
var_dump($sr->unserialize($sfoo, $allowedClasses));
echo "</pre>\n<hr />\n\n";
}
?>

View File

@@ -1,73 +0,0 @@
<?php
/**
* Test cases for the UrlSerializer
*/
?>
<script type="text/javascript" src="../server.php?client=UrlSerializer,util"></script>
<script type="text/javascript">
</script>
<?php
$examples = array(
'$foo = null;',
'$foo = true;',
'$foo = "foobar";',
'$foo = 337;',
'$foo = 99.99;',
'$foo = array("a" => 1, "b" => 2, 3);',
'$foo = array(1,2,array(1,2,3));',
'class Foo { var $foo; var $bar; }'
. '$foo = new Foo; $foo->foo = "hello"; $foo->bar = array("world","universe");'
);
require_once 'HTML/AJAX/Serializer/Urlencoded.php';
$sr = new HTML_AJAX_Serializer_Urlencoded;
echo '<h1><a name="pos">Positives</a> | <a href="#neg">Negatives</a></h1>';
$c = count($examples);
for ($i = 0; $i < $c; $i++) {
echo "<strong>PHP Code:</strong>\n<pre>$examples[$i]</pre>\n<strong>PHP value:</strong><pre>\n";
eval($examples[$i]);
var_dump($foo);
$sfoo = $sr->serialize($foo);
echo "</pre>\n<strong>Unserialized in PHP:</strong>\n<pre>";
var_dump($sr->unserialize($sfoo));
echo "</pre>\n<strong>Unserialized in JS:</strong>\n<pre>\n",
'<script type="text/javascript">',
'var jsr = new HTML_AJAX_Serialize_Urlencoded();',
'var sfoo = unescape("', urlencode($sfoo), '"); var usfoo = jsr.unserialize(sfoo); if (jsr.error) {',
'document.write("Error: " + jsr.getError() + "\n"); } document.write(HTML_AJAX_Util.varDump(usfoo) + ',
'"</pre>\n<strong>Serialized in PHP:</strong>\n<pre>', $sfoo, '</pre>\n',
'\n<strong>Serialized in JS:</strong>\n<pre>" + jsr.serialize(usfoo));',
"\n</script>\n</pre>\n<hr />\n\n";
}
$bad_examples = array(
'x',
'x-1',
'x=1x=2',
'x=1&',
'x[=]1',
'[]x=1',
'_HTML_AJAX]]=1',
'_HTML_AJAX[[=1',
'_HTML_AJAX][=1',
'_HTML_AJAX[=]1',
'_HTML_AJAX[=1]',
'_HTML_AJAX[0]=1&_HTML_AJAX]]=1',
'_HTML_AJAX[0[1]]=1',
'_HTML_AJAX[0[1]=1'
);
echo '<h1><a href="#pos">Positives</a> | <a name="neg">Negatives</a></h1>';
foreach ($bad_examples as $sfoo) {
echo "</pre>\n<strong>Invalidly serialized:</strong>\n<pre>", $sfoo, "</pre>\n",
"<strong>Unserialized in JS:</strong>\n<pre>\n",
'<script type="text/javascript">',
'var sfoo = unescape("', urlencode($sfoo), '"); var usfoo = jsr.unserialize(sfoo); if (jsr.error) {',
'document.write("Error: " + jsr.getError() + "\n"); } document.write(HTML_AJAX_Util.varDump(usfoo));',
"</script>\n</pre>\n<hr />\n\n";
}
?>

View File

@@ -1 +0,0 @@
alert('Loaded setInnerHTML.js');

View File

@@ -1,132 +0,0 @@
<?php
/**
* HTML_AJAX_Util.setInnerHTML tests
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2006 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?>
<html>
<head>
<style type="text/css">
div {
padding: 1em;
margin: 1em;
border: solid 1px black;
}
pre {
padding: 1em;
border: dotted 1px black;
}
</style>
<script type="text/javascript" src="../server.php?client=util"></script>
<script type="text/javascript">
function test(compareto,input,mode) {
if (compareto == true) {
compareto = input;
}
document.getElementById('input').innerHTML = HTML_AJAX_Util.htmlEscape(input);
HTML_AJAX_Util.setInnerHTML('target',input,mode);
document.getElementById('source').innerHTML = HTML_AJAX_Util.htmlEscape(document.getElementById('target').innerHTML);
document.getElementById('status').innerHTML = 'Test Successful';
document.getElementById('status').style.color = 'green';
if (compareto == false) {
document.getElementById('status').innerHTML = 'Nothing to compare against';
document.getElementById('status').style.color = 'yellow';
return;
}
if (compareto != document.getElementById('target').innerHTML) {
document.getElementById('status').innerHTML = 'Test Failed';
document.getElementById('status').style.color = 'red';
}
}
function test1() {
test(true,'<script type="text/javascript">alert("hello world");</'+'script>');
}
function test2() {
test(true,'<div id="blah">Blah Blah</div><script type="text/javascript">document.getElementById("target").style.color = "blue";</'+'script><div>blah blah</div>');
}
function test3() {
test(true,'<script type="text/javascript">function blah() { document.getElementById("target").style.color = "blue"; }</'+'script><div>Blah Blah</div><script type="text/javascript">blah();</'+'script><div>blah blah</div>');
}
function test4() {
test(true,'<script type="text/javascript">function blah() { document.getElementById("target").style.color = "blue"; }</'+'script>'+"\n"+
'<form><fieldset><legend>Fieldset</legend>'+"\n"+
'<div>Blah Blah</div>'+"\n"+
'<script type="text/javascript">blah();</'+'script>'+"\n"+
'<div>blah blah</div></fieldset></form>');
}
function test5() {
test(false,'<div>start</div>');
test('<div>Add</div><div>start</div>','<div>Add</div>','prepend');
}
function test6() {
test(false,'<div>start</div>');
test('<div>start</div><div>Add</div>','<div>Add</div>','append');
}
function test7() {
test(false,'<img src="http://phpdoc.org/images/logo-trans.png" onload="this.style.border = \'solid 10px orange\'">');
}
function test8() {
test(false,'<script type="text/javascript">document.write("Hello World")</'+'script>');
}
function test9() {
test(false,'<script type="text/javascript" src="setInnerHTML.js"></'+'script>');
}
function test10() {
test(false,'<script type="text/javascript">function blah() { document.getElementById("target").style.color = "blue"; }</'+'script>Test');
blah();
}
function test11() {
HTML_AJAX_Util.setInnerHTML('target','<p>blah</p>');
HTML_AJAX_Util.setInnerHTML('target','<p>blah</a>');
}
function test12() {
test(false,'<div id="test12">Blah</div><script type="text/javascript">document.getElementById("test12").style.color = "orange";</s'+'cript>');
}
function test13() {
test(false, '<script type="text/javascript">\n<!--\n alert("hello world from comments!");\n//-->\n</' + 'script>');
}
function test14() {
test(false, '<script type="text/javascript">\n<![CDATA[\n alert("hello world from cdata comments!");\n]]>\n</' + 'script>');
}
</script>
</head>
<body>
<ol>
<li><a href="javascript:test1()">Basic Test just a script block</a></li>
<li><a href="javascript:test2()">Script block with content before and after</a></li>
<li><a href="javascript:test3()">Script content Script content</a></li>
<li><a href="javascript:test4()">Script form content Script content /form</a></li>
<li><a href="javascript:test5()">Prepend</a></li>
<li><a href="javascript:test6()">Append</a></li>
<li><a href="javascript:test7()">onload</a></li>
<li><a href="javascript:test8()">document.write</a></li>
<li><a href="javascript:test9()">load an external js file</a></li>
<li><a href="javascript:test10()">Create a function and call it in the parent scope</a></li>
<li><a href="javascript:test11()">Replace/Replace make sure default mode is detected properly</a></li>
<li><a href="javascript:test12()">Use an element adding in this set latter in the process</a></li>
<li><a href="javascript:test13()">Script inside comment</a></li>
<li><a href="javascript:test14()">Script inside cdata comment</a></li>
</ol>
<div id="status"></div>
<h3>Input String</h3>
<pre id="input">
</pre>
<h3>HTML Source Output</h3>
<pre id="source">
</pre>
<h3>Normal Output</h3>
<div id="target">
</div>

View File

@@ -1,88 +0,0 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
How to use behavior.js
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="../server.php?client=behavior" type="text/javascript"></script>
<script type="text/javascript">
Behavior.register(
".alert",
function(element) {
element.onclick = function(){
alert('I alert on click');
}
}
);
Behavior.register(
".annoy",
function(element) {
element.onmouseout = function(){
alert('I alert on mouseout, very annoying');
}
}
);
Behavior.register(
".red",
function(element) {
element.onmouseover = function(){
element.style.backgroundColor = 'red';
}
}
);
</script>
</head>
<body>
<p>
This file requires two javascript files to work properly. They are behavior.js and css-Query-p.js and can be found in the js/behaviors folder.
The script allows you to apply behaviors to a css class, so you don't pollute your html with a ton of
inline javascript. The example below uses the following script tag to apply the behaviors.
you can also link external javascript files to apply behaviors as well.
</p>
<pre>
Behavior.register(
".alert",
function(element) {
element.onclick = function(){
alert('I alert on click');
}
}
);
Behavior.register(
".annoy",
function(element) {
element.onmouseout = function(){
alert('I alert on mouseout, very annoying');
}
}
);
Behavior.register(
".red",
function(element) {
element.onmouseover = function(){
element.style.backgroundColor = 'red';
}
}
);
</pre>
<div style="border: 1px solid black; width: 50%; margin: 5em">
<div class="alert">
I am a div that alerts when you click on me - notice I just have class="alert" to make it work :)
</div>
<div class="annoy">
I am a div that alerts when you mouseout me - class="annoy" makes it work
</div>
<div class=" alert red">
I am a div that alerts when you click on me and the background turns red on mouseover - class="alert red"
</div>
</div>
</body>
</html>

View File

@@ -1,83 +0,0 @@
<?php
/**
* Priority queue test.
*
* Makes 10 calls at one priority, then 10 calls at a higher priority.
*
* @category HTML
* @package AJAX
* @author Arpad Ray <arpad@php.net>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
include 'HTML/AJAX.php';
include '../support/test.class.php';
$ajax = new HTML_AJAX();
$ajax->serializer = "Null";
$ajax->unserializer = "Null";
$ajax->registerClass(new test());
if ($ajax->handleRequest()) {
die();
}
?><html>
<head>
<script type='text/javascript' src="../server.php?client=all&amp;stub=all"></script>
<script type="text/javascript">
HTML_AJAX.queues['priority'] = new HTML_AJAX_Queue_Priority_Simple(40);
var t = new test({echo_string: function(result){ endCall(result); }});
var time1;
var count = 0;
function priorityTest() {
document.getElementById('target').innerHTML += "<br><br>";
count = 0;
for (var i = 0; i < 10; i++) {
runLow(i);
}
for (var i = 0; i < 10; i++) {
runHigh(i);
}
total = 0;
}
function runLow(i) {
startCall();
t.dispatcher.queue = 'priority';
t.dispatcher.priority = 10;
return t.echo_string('Not urgent, number ' + i + ' ');
}
function runHigh(i) {
startCall();
t.dispatcher.queue = 'priority';
t.dispatcher.priority = 0;
return t.echo_string('Urgent, number ' + i + ' ');
}
function startCall() {
time1 = new Date();
}
function endCall(name) {
var time = 0;
var time2 = new Date();
time = time2.getTime() - time1.getTime();
document.getElementById('target').innerHTML += name + "time: " + time + "<br>";
if (++count == 20) {
document.getElementById('target').innerHTML += "Done<br>";
}
}
</script>
</head>
<body>
<a href="javascript:priorityTest()">Start Priority Test</a>
<div id="target">
</div>
</body>
</html>

View File

@@ -1,91 +0,0 @@
<?php
/**
* Simple speed test using the null serializer, possibly useful in comparing overhead when tested on local host
*
*
* @category HTML
* @package AJAX
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
include 'HTML/AJAX.php';
include '../support/test.class.php';
$ajax = new HTML_AJAX();
$ajax->serializer = "Null";
$ajax->unserializer = "Null";
$ajax->registerClass(new test());
if ($ajax->handleRequest()) {
die();
}
?><html>
<head>
<script type='text/javascript' src="../server.php?client=all&stub=all"></script>
</head>
<body>
<script type="text/javascript">
var t = new test();
var t2 = new test({echo_string: function(){ endCall('Async Echo'); totalA(); }});
var time1;
var total = 0;
var count = 0;
function speedTest() {
document.getElementById('target').innerHTML += "10 Sync Calls<br>";
for(var i = 0; i < 10; i++) {
startCall();
t.echo_string('Test');
endCall('Sync Echo');
}
document.getElementById('target').innerHTML += "Total: "+total+"<br><br><br>";
total = 0;
document.getElementById('target').innerHTML += "10 Async Calls<br>";
count = 0;
for(var i = 0; i < 10; i++) {
setTimeout("runAsync();",500*i);
}
total = 0;
}
function totalA() {
count++;
if (count == 10) {
document.getElementById('target').innerHTML += "Total: "+total+"<br>";
}
}
function runAsync() {
startCall();
t2.echo_string('Test');
}
function startCall() {
time1 = new Date();
}
function endCall(name) {
var time = 0;
var time2 = new Date();
time = time2.getTime() - time1.getTime();
total += time;
document.getElementById('target').innerHTML += name+":"+time+"<br>";
}
</script>
<a href="javascript:speedTest()">Start Speed Test</a>
<div id="target">
</div>
</body>
</html>

View File

@@ -1,132 +0,0 @@
<?php
/**
* Example of Using HTML_AJAX in proxy operation
*
* All AJAX calls are handled by the xmlserver.php
*
* The only needed interaction is creation of a new object from the proxy defintion, all AJAX calls happen transparently from there
*
* If you want to perform async calls a callback object must be passed to the constructor of the object
*
* @category HTML
* @package AJAX
* @author Elizabeth Smith <auroraeosrose@gmail.com>
* @copyright 2006 Elizabeth Smith
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.2
* @link http://pear.php.net/package/HTML_AJAX
*/
?><html>
<head>
<script type='text/javascript' src="xmlserver.php?client=all"></script>
<script type='text/javascript' src="xmlserver.php?stub=testxml"></script>
<script type='text/javascript'>
// function to display xml received from server
function showItems(xml)
{
var list=xml.getElementsByTagName('item');
document.getElementById('target').innerHTML = '<p>My Fridge</p>';
for (var i=0;i<list.length;i++)
{
var node = list[i];
document.getElementById('target').innerHTML += '<p>' + node.firstChild.nodeValue
+ ' is a ' + node.getAttribute('type') + '</p>';
}
}
// function to display xml created here
function showMessage(xml)
{
var list=xml.getElementsByTagName('tag');
document.getElementById('target').innerHTML = '';
for (var i=0;i<list.length;i++)
{
var node = list[i];
document.getElementById('target').innerHTML += '<p>' + node.firstChild.nodeValue + '</p>';
}
}
// definition of the callback javascript class, used to handle async requests
function callback() {}
callback.prototype = {
createJunk: function(result) {
showItems(result);
},
writeDoc: function(result) {
dom = HTML_AJAX.grab('test.xml');
showMessage(dom);
}
}
// function used to clear out the target div
function clearTarget() {
document.getElementById('target').innerHTML = 'clear';
}
//create xml document to send back to server
var xmlhello = '<' + '?xml version="1.0"?><root><tag>Hello</tag></root>';
xmlhello = new DOMParser().parseFromString(xmlhello, 'text/xml');
var xmlgoodbye = '<' + '?xml version="1.0"?><root><tag>Goodbye</tag></root>';
xmlgoodbye = new DOMParser().parseFromString(xmlgoodbye, 'text/xml');
</script>
</head>
<body>
<script type="text/javascript">
// create a proxy in sync mode
var syncProxy = new TestXml();
// create a proxy in async mode
var asyncProxy = new TestXml(new callback());
// run a sync call and set its results to the target div
function syncCall() {
dom = syncProxy.createHealthy();
showItems(dom);
}
function syncSend(xml) {
syncProxy.writeDoc(xml);
dom = HTML_AJAX.grab('test.xml');
showMessage(dom);
}
// run a sync call, callback class will handle its results
function asyncCall() {
asyncProxy.createJunk();
}
// run a sync call, callback class will handle its results
function asyncSend(xml) {
asyncProxy.writeDoc(xml);
}
</script>
<p>HTML_AJAX XML functionality needs the Dom extensions in PHP5 or the DOMXML extension in PHP4.<br>
It looks like you have:<br>
<?php
if (extension_loaded('Dom')) {
echo 'The Dom extension';
}
else if (extension_loaded('Domxml')) {
echo 'The Domxml extension';
}
else {
echo 'No XML DOM support, so you can expect these examples to fail';
}
?>
</p>
<ul>
<li><a href="javascript:clearTarget()">Clear Target</a></li>
<li><a href="javascript:syncCall()">Retrieve XmlDom Sync</a></li>
<li><a href="javascript:asyncCall();">Retrieve XmlDom Async</a></li>
<li><a href="javascript:syncSend(xmlhello);">Send XmlDom Sync</a></li>
<li><a href="javascript:asyncSend(xmlgoodbye);">Send XmlDom Async</a></li>
</ul>
<div style="white-space: pre; padding: 1em; margin: 1em; width: 600px; height: 300px; border: solid 2px black; overflow: auto;" id="target">Target</div>
</div>
</body>
</html>

View File

@@ -1,12 +0,0 @@
<?php
include 'HTML/AJAX/Server.php';
include 'support/xml.class.php';
$server = new HTML_AJAX_Server();
// register an instance of the class were registering
$xml =& new TestXml();
$server->registerClass($xml,'TestXml',array('createHealthy','createJunk','writeDoc'));
$server->setSerializer('XML');
$server->handleRequest();
?>

View File

@@ -1,155 +0,0 @@
<?php
/**
* Example of usage for PEAR class HTML_QuickForm
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: elements.php,v 1.3 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
$form =& new HTML_QuickForm('frmTest', 'get');
// Use a two-label template for the elements that require some comments
$twoLabel = <<<_HTML
<tr valign="top">
<td align="right">
<!-- BEGIN required --><span style="color: #F00;">*</span><!-- END required --><b>{label}</b>
</td>
<td align="left">
<!-- BEGIN error --><span style="color: #F00;">{error}</span><br /><!-- END error -->{element}
<!-- BEGIN label_2 --><br /><span style="font-size: 80%;">{label_2}</span><!-- END label_2 -->
</td>
</tr>
_HTML;
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate($twoLabel, 'iadvChk');
$renderer->setElementTemplate($twoLabel, 'iautoComp');
// Fills with some defaults values
$form->setDefaults(array(
'itxtTest' => 'Test Text Box',
'itxaTest' => 'Hello World',
'ichkTest' => true,
'iradTest' => 1,
'iselTest' => array('B', 'C'),
'name' => array('first'=>'Adam', 'last'=>'Daniel'),
'phoneNo' => array('513', '123', '3456'),
'iradYesNo' => 'Y',
'ichkABC' => array('A'=>true,'B'=>true),
'dateTest1' => array('d'=>11, 'm'=>1, 'Y'=>2003)
));
$form->setConstants(array(
'dateTest3' => time()
));
// Elements will be displayed in the order they are declared
$form->addElement('header', '', 'Normal Elements');
// Classic form elements
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'itxtTest', 'Test Text:');
$form->addElement('textarea', 'itxaTest', 'Test TextArea:', array('rows' => 3, 'cols' => 20));
$form->addElement('password', 'ipwdTest', 'Test Password:');
$form->addElement('checkbox', 'ichkTest', 'Test CheckBox:', 'Check the box');
$form->addElement('radio', 'iradTest', 'Test Radio Buttons:', 'Check the radio button #1', 1);
$form->addElement('radio', 'iradTest', '(Not a group)', 'Check the radio button #2', 2);
$form->addElement('button', 'ibtnTest', 'Test Button', array('onclick' => "alert('This is a test');"));
$form->addElement('reset', 'iresTest', 'Test Reset');
$form->addElement('submit', 'isubTest', 'Test Submit');
$form->addElement('image', 'iimgTest', 'http://pear.php.net/gifs/pear-icon.gif');
$select =& $form->addElement('select', 'iselTest', 'Test Select:', array('A'=>'A', 'B'=>'B','C'=>'C','D'=>'D'));
$select->setSize(5);
$select->setMultiple(true);
$form->addElement('header', '', 'Custom Elements');
// Date elements
$form->addElement('date', 'dateTest1', 'Date1:', array('format'=>'dmY', 'minYear'=>2010, 'maxYear'=>2001));
$form->addElement('date', 'dateTest2', 'Date2:', array('format'=>'d-F-Y H:i', 'language'=>'de', 'optionIncrement' => array('i' => 5)));
$form->addElement('date', 'dateTest3', 'Today is:', array('format'=>'l d M Y'));
$main[0] = "Pop";
$main[1] = "Rock";
$main[2] = "Classical";
$secondary[0][0] = "Belle & Sebastian";
$secondary[0][1] = "Elliot Smith";
$secondary[0][2] = "Beck";
$secondary[1][3] = "Noir Desir";
$secondary[1][4] = "Violent Femmes";
$secondary[2][5] = "Wagner";
$secondary[2][6] = "Mozart";
$secondary[2][7] = "Beethoven";
$opts[] = $main;
$opts[] = $secondary;
$hs =& $form->addElement('hierselect', 'ihsTest', 'Hierarchical select:', array('style' => 'width: 20em;'), '<br />');
$hs->setOptions($opts);
$form->addElement('advcheckbox', 'iadvChk', array('Advanced checkbox:', 'Unlike standard checkbox, this element <b>has</b> a value<br />when it is not checked.'), 'Check the box', null, array('off', 'on'));
$form->addElement('autocomplete', 'iautoComp', array('Your favourite fruit:', 'This is autocomplete element.<br />Start typing and see how it suggests possible completions.'), array('Pear', 'Orange', 'Apple'), array('size' => 30));
$form->addElement('header', '', 'Grouped Elements');
// Grouped elements
$name['last'] = &HTML_QuickForm::createElement('text', 'last', null, array('size' => 30));
$name['first'] = &HTML_QuickForm::createElement('text', 'first', null, array('size' => 20));
$form->addGroup($name, 'name', 'Name (last, first):', ',&nbsp;');
// Creates a group of text inputs
$areaCode = &HTML_QuickForm::createElement('text', '', null, array('size' => 3, 'maxlength' => 3));
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, array('size' => 3, 'maxlength' => 3));
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, array('size' => 4, 'maxlength' => 4));
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phoneNo', 'Telephone:', '-');
// Creates a radio buttons group
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No:');
// Creates a checkboxes group
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$form->addGroup($checkbox, 'ichkABC', 'ABC:', '<br />');
// Creates a group of buttons to be displayed at the bottom of the form
$buttons[] = &HTML_QuickForm::createElement('submit', null, 'Submit');
$buttons[] = &HTML_QuickForm::createElement('reset', null, 'Reset');
$buttons[] = &HTML_QuickForm::createElement('image', 'iimgTest', 'http://pear.php.net/gifs/pear-icon.gif');
$buttons[] = &HTML_QuickForm::createElement('button', 'ibutTest', 'Test Button', array('onClick' => "alert('This is a test');"));
$form->addGroup($buttons, null, null, '&nbsp;', false);
// applies new filters to the element values
$form->applyFilter('__ALL__', 'trim');
// Adds some validation rules
$form->addRule('itxtTest', 'Test Text is a required field', 'required');
$form->addRule('itxaTest', 'Test TextArea is a required field', 'required');
$form->addRule('itxaTest', 'Test TextArea must be at least 5 characters', 'minlength', 5);
$form->addRule('ipwdTest', 'Password must be between 8 to 10 characters', 'rangelength', array(8, 10));
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then processes the data
$form->freeze();
$form->process('myProcess', false);
echo "\n<HR>\n";
}
// Process callback
function myProcess($values)
{
echo '<pre>';
var_dump($values);
echo '</pre>';
}
$form->display();
?>

View File

@@ -1,64 +0,0 @@
<?php
/**
* Example of usage for PEAR class HTML_QuickForm.
* Using filters to clean up the submitted values.
*
* @category HTML
* @package HTML_QuickForm
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: filters.php,v 1.2 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
function _filterAustin($value)
{
return strtoupper($value).', GROOVY BABY!';
}
$form =& new HTML_QuickForm('frmTest', 'get');
$form->addElement('text', 'txtTest', 'Test Text to trim:');
$form->addRule('txtTest', 'Test text is required', 'required');
$phoneGrp[] =& $form->createElement('text', '', null, array('size' => 3, 'maxlength' => 3));
$phoneGrp[] =& $form->createElement('text', '', null, array('size' => 3, 'maxlength' => 3));
$phoneGrp[] =& $form->createElement('text', '', null, array('size' => 4, 'maxlength' => 4));
$form->addGroup($phoneGrp, 'phone', 'Telephone (will be converted to numbers):', '-');
$form->addGroupRule('phone', 'The phone is required', 'required', null, 3);
$form->addElement('text', 'txtAustin', 'Text for custom filter:');
$form->addRule('txtAustin', 'Custom filter text is required', 'required');
$form->addElement('submit', 'isubTest', 'Submit');
// now we apply the filters
$form->applyFilter('txtTest', 'trim');
// the filter will be applied recursively
$form->applyFilter('phone', 'intval');
if ($form->validate()) {
// Here the filter is applied after validation
$form->applyFilter('txtAustin', '_filterAustin');
echo "<pre>\n";
echo "Values before filter:\n\n";
var_dump($form->getElementValue('txtTest'));
echo "\n";
var_dump($form->getElementValue('phone'));
echo "\n";
var_dump($form->getElementValue('txtAustin'));
echo "\n\nValues after filter:\n\n";
var_dump($form->exportValue('txtTest'));
echo "\n";
var_dump($form->exportValue('phone'));
echo "\n";
var_dump($form->exportValue('txtAustin'));
echo "</pre>\n";
}
$form->display();
?>

View File

@@ -1,104 +0,0 @@
<?php
/**
* Examples of usage for HTML_QuickForm: fancy validation with addFormRule()
*
* $Id: formrule.php,v 1.2 2007/05/29 19:12:26 avb Exp $
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: formrule.php,v 1.2 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
function _validate_shipping($values)
{
// In Real Life (tm) you will probably query your DB for these
$profiles = array('foo', 'bar', 'baz');
$errors = array();
switch ($values['profile']) {
case 'personal':
if (empty($values['persProfileName'])) {
$errors['persProfileName'] = 'Enter the profile name';
} elseif (in_array($values['persProfileName'], $profiles)) {
$errors['persProfileName'] = 'The profile already exists';
}
if (empty($values['persName']['first']) || empty($values['persName']['last'])) {
$errors['persName'] = 'Name is required';
}
if (empty($values['persAddress'])) {
$errors['persAddress'] = 'Address is required';
}
break;
case 'company':
if (empty($values['compProfileName'])) {
$errors['compProfileName'] = 'Enter the profile name';
} elseif (in_array($values['compProfileName'], $profiles)) {
$errors['compProfileName'] = 'The profile already exists';
}
if (empty($values['compName'])) {
$errors['compName'] = 'Company name is required';
}
if (empty($values['compAddress'])) {
$errors['compAddress'] = 'Address is required';
}
break;
case 'existing':
default:
if (empty($values['profileName'])) {
$errors['profileName'] = 'Enter the profile name';
} elseif (!in_array($values['profileName'], $profiles)) {
$errors['profileName'] = 'The profile does not exist';
}
break;
} // switch
return empty($errors)? true: $errors;
}
$form =& new HTML_QuickForm('frmFancy');
$form->setDefaults(array(
'profile' => 'existing',
'stuffAmount' => '1'
));
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate("\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #F0F0F0;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{element}</b></td>\n\t</tr>", 'profile');
$form->addElement('header', null, 'Choose stuff');
$form->addElement('select', 'stuffName', 'Stuff to send:', array('' => '--select--', 'n' => 'Nuts', 'b' => 'Bolts', 'f' => 'Flotsam', 'j' => 'Jetsam'));
$form->addElement('text', 'stuffAmount', 'Amount of stuff:', array('size' => 2, 'maxlength' => 2));
$form->addElement('header', null, 'Choose shipping profile');
$form->addElement('static', 'note', 'Note:', 'profiles \'foo\', \'bar\' and \'baz\' are considered existing');
$form->addElement('radio', 'profile', null, 'Use existing profile', 'existing');
$form->addElement('text', 'profileName', 'Profile name:', array('size' => 32, 'maxlength' => 32));
$form->addElement('radio', 'profile', null, 'New personal profile', 'personal');
$form->addElement('text', 'persProfileName', 'Profile name:', array('size' => 32, 'maxlength' => 32));
$name[] =& $form->createElement('text', 'first', null, array('size' => 14, 'maxlength' => 100));
$name[] =& $form->createElement('text', 'last', null, array('size' => 14, 'maxlength' => 100));
$form->addGroup($name, 'persName', 'Name (first, last):', ' ');
$form->addElement('text', 'persAddress', 'Address:', array('size' => 32, 'maxlength' => 255));
$form->addElement('radio', 'profile', null, 'New company profile', 'company');
$form->addElement('text', 'compProfileName', 'Profile name:', array('size' => 32, 'maxlength' => 32));
$form->addElement('text', 'compName', 'Company name:', array('size' => 32, 'maxlength' => 100));
$form->addElement('text', 'compAddress', 'Address:', array('size' => 32, 'maxlength' => 255));
$form->addElement('submit', null, 'Send');
$form->addFormRule('_validate_shipping');
if ($form->validate()) {
echo "<pre>\n";
var_dump($form->exportValues());
echo "</pre>\n";
}
$form->display();
?>

View File

@@ -1,96 +0,0 @@
<?php
/**
* Examples of usage for grouped elements in HTML_QuickForm
*
* @category HTML
* @package HTML_QuickForm
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: groups.php,v 1.2 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
$form =& new HTML_QuickForm('frmGroups');
$form->setDefaults(array(
'id' => array('lastname' => 'Mamasam', 'code' => '1234'),
'phoneNo' => array('513', '123', '3456'),
'ichkABC' => array('A'=>true)
));
$renderer =& $form->defaultRenderer();
// Setting templates for form and headers
$renderer->setFormTemplate("<form{attributes}>\n<table width=\"450\" border=\"0\" cellpadding=\"3\" cellspacing=\"2\" bgcolor=\"#CCCC99\">\n{content}\n</table>\n</form>");
$renderer->setHeaderTemplate("\t<tr>\n\t\t<td style=\"white-space:nowrap;background:#996;color:#ffc;\" align=\"left\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>");
// Setting a special template for id element
$renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'id');
$renderer->setGroupElementTemplate('<td>{element}<br /><span style="font-size:10px;"><!-- BEGIN required --><span style="color: #f00">* </span><!-- END required --><span style="color:#996;">{label}</span></span></td>', 'id');
$form->addElement('header', '', 'Tests on grouped elements');
// Creates a group of text inputs with templates
$id['lastname'] = &HTML_QuickForm::createElement('text', 'lastname', 'Name', array('size' => 30));
$id['code'] = &HTML_QuickForm::createElement('text', 'code', 'Code', array('size' => 5, 'maxlength' => 4));
$form->addGroup($id, 'id', 'ID:', ',&nbsp');
// Add a complex rule for id element
$form->addGroupRule('id', array(
'lastname' => array(
array('Name is required', 'required', null, 'client'),
array('Name is letters only', 'lettersonly', null, 'client')
),
'code' => array(
array('Code must be numeric', 'numeric', null, 'client')
)
));
// Creates a group of text inputs
$areaCode = &HTML_QuickForm::createElement('text', '', null, array('size' => 4, 'maxlength' => 3));
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, array('size' => 4, 'maxlength' => 3));
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, array('size' => 5, 'maxlength' => 4));
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phoneNo', 'Telephone:', '-');
// Adds validation rules for groups
$form->addGroupRule('phoneNo', 'Please fill all phone fields', 'required', null, 3, 'client');
$form->addGroupRule('phoneNo', 'Values must be numeric', 'numeric', null, 3, 'client');
// Creates a checkboxes group using an array of separators
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABC', 'ABCD:', array('&nbsp;', '<br />'));
// At least one element is required
$form->addGroupRule('ichkABC', 'Please check at least two boxes', 'required', null, 2, 'client', true);
// Creates a standard radio buttons group
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No:');
// Validate the radio buttons
$form->addRule('iradYesNo', 'Check Yes or No', 'required', null, 'client');
// Creates a group of buttons to be displayed at the bottom of the form
$buttons[] =& $form->createElement('submit', null, 'Submit');
$buttons[] =& $form->createElement('reset', null, 'Reset');
$buttons[] =& $form->createElement('checkbox', 'clientSide', null, 'use client-side validation', array('checked' => 'checked', 'onclick' => "if (this.checked) {this.form.onsubmit = validate_" . $form->getAttribute('id') . ";} else {this.form.onsubmit = null;}"));
$form->addGroup($buttons);
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then processes the data
$form->freeze();
$form->process('var_dump');
echo "\n<HR>\n";
}
$form->display();
?>

View File

@@ -1,114 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm Object renderer
* with Flexy template engine and dynamic template
*
* @category HTML
* @package HTML_QuickForm
* @author Ron McClain <mixtli@cats.ucsc.edu>
* @version CVS: $Id: FlexyDynamic_example.php,v 1.3 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/Object.php';
require_once 'HTML/Template/Flexy.php';
$form = new HTML_QuickForm('frmTest', 'post');
$form->setDefaults(array(
'itxtTest' => 'Test Text Box',
'itxaTest' => 'Hello World',
'iselTest' => array('B', 'C'),
'name' => array('first' => 'Thomas', 'last' => 'Schulz'),
'iradYesNo' => 'Y',
'ichkABCD' => array('A'=>true,'D'=>true)
));
$form->addElement('header', '', 'Normal Elements');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'itxtTest', 'Test Text');
$form->addElement('textarea', 'itxaTest', 'Test TextArea');
// will be later assigned to style green
$form->addElement('password', 'ipwdTest', array('Test Password', 'Please choose a password which is hard to guess'));
$select =& $form->addElement('select', 'iselTest', 'Test Select', array('A'=>'A', 'B'=>'B','C'=>'C','D'=>'D'));
$select->setSize(5);
$select->setMultiple(true);
$form->addElement('submit', 'isubTest', 'Test Submit');
$form->addElement('header', '', 'Grouped Elements');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABCD', 'ABCD', '<br />');
// will be later assigned to style fancygroup
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No');
// will be later assigned to style fancygroup
$name['first'] = &HTML_QuickForm::createElement('text', 'first', 'First:');
$name['first']->setSize(20);
$name['last'] = &HTML_QuickForm::createElement('text', 'last', 'Last:');
$name['last']->setSize(30);
$form->addGroup($name, 'name', 'Name');
// add some 'required' rules to show "stars" and (possible) errors...
$form->addRule('itxtTest', 'Test Text is a required field', 'required');
$form->addRule('itxaTest', 'Test TextArea is a required field', 'required');
$form->addGroupRule('iradYesNo', 'Check Yes or No', 'required');
$form->addGroupRule('name', array('last' => array(array('Last name is required', 'required'))));
// try to validate the form
if ($form->validate()) {
$form->freeze();
}
$renderer =& new HTML_QuickForm_Renderer_Object(true);
// give some elements aditional style informations
$renderer->setElementStyle(array(
'ipwdTest' => 'green',
'iradYesNo' => 'fancygroup',
'name' => 'fancygroup'
));
$form->accept($renderer);
$options = &PEAR::getStaticProperty('HTML_Template_Flexy','options');
$options = array(
'templateDir' => './templates',
'compileDir' => './templates/build',
'debug' => 0
);
$tpl =& new HTML_Template_Flexy($options);
//$tpl->compile("styles/green.html");
//$tpl->compile("styles/fancygroup.html");
// assign array with form data
$view = new StdClass;
$view->form = $renderer->toObject();
// capture the array stucture
// (only for showing in sample template)
ob_start();
print_r($renderer->toObject());
$view->dynamic_object = ob_get_contents();
// XXX: dunno how to make Flexy ignore the placeholder
$view->formdata = '{formdata}';
ob_end_clean();
// render and display the template
$tpl->compile('flexy-dynamic.html');
$tpl->outputObject($view);
?>

View File

@@ -1,150 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm Object renderer
* with Flexy template engine and static template
*
* @category HTML
* @package HTML_QuickForm
* @author Ron McClain <mixtli@cats.ucsc.edu>
* @version CVS: $Id: FlexyStatic_example.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once('HTML/Template/Flexy.php');
require_once('HTML/QuickForm.php');
require_once('HTML/QuickForm/Renderer/ObjectFlexy.php');
function myProcess($values)
{
echo "<pre>";
var_dump($values);
echo "</pre>";
}
$form = new HTML_QuickForm('form', 'POST');
// Fills with some defaults values
$defaultValues['company'] = 'Devils son in law';
$defaultValues['country'] = array();
$defaultValues['name'] = array('first'=>'Petey', 'last'=>'Wheatstraw');
$defaultValues['phone'] = array('513', '123', '4567');
$form->setDefaults($defaultValues);
// Hidden
$form->addElement('hidden', 'session', '1234567890');
// Personal information
$form->addElement('header', 'personal', 'Personal Information');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'email', 'Your email:');
$form->addElement('password', 'pass', 'Your password:', 'size=10');
$name['last'] = &HTML_QuickForm::createElement('text', 'first', 'First',
'size=10');
$name['first'] = &HTML_QuickForm::createElement('text', 'last', 'Last',
'size=10');
$form->addGroup($name, 'name', 'Name:', ',&nbsp;');
$areaCode = &HTML_QuickForm::createElement('text', '', null,'size=4
maxlength=3');
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, 'size=4
maxlength=3');
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, 'size=5
maxlength=4');
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phone',
'Telephone:', '-');
// Company information
$form->addElement('header', 'company_info', 'Company Information');
$form->addElement('text', 'company', 'Company:', 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$form->addGroup($str, 'street', 'Street:', '<br />');
$addr['zip'] = &HTML_QuickForm::createElement('text', 'zip', 'Zip', 'size=6
maxlength=10');
$addr['city'] = &HTML_QuickForm::createElement('text', 'city', 'City',
'size=15');
$form->addGroup($addr, 'address', 'Zip, city:');
$select = array('' => 'Please select...', 'AU' => 'Australia', 'FR' =>
'France', 'DE' => 'Germany', 'IT' => 'Italy');
$form->addElement('select', 'country', 'Country:', $select);
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'destination', 'Destination:', array('&nbsp;',
'<br />'));
// Other elements
$form->addElement('checkbox', 'news', '', " Check this box if you don't want
to receive our newsletter.");
$form->addElement('reset', 'reset', 'Reset');
$form->addElement('submit', 'submit', 'Register');
// Adds some validation rules
$form->addRule('email', 'Email address is required', 'required');
$form->addGroupRule('name', 'Name is required', 'required');
$form->addRule('pass', 'Password must be between 8 to 10 characters',
'rangelength', array(8, 10),'client');
$form->addRule('country', 'Country is a required field', 'required');
$form->addGroupRule('destination', 'Please check at least two boxes',
'required', null, 2);
$form->addGroupRule('phone', 'Please fill all phone fields', 'required');
$form->addGroupRule('phone', 'Values must be numeric', 'numeric');
$AddrRules['zip'][0] = array('Zip code is required', 'required');
$AddrRules['zip'][1] = array('Zip code is numeric only', 'numeric');
$AddrRules['city'][0] = array('City is required', 'required');
$AddrRules['city'][1] = array('City is letters only', 'lettersonly');
$form->addGroupRule('address', $AddrRules);
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then freezes the data
$form->freeze();
$form->process('myProcess', false);
echo "\n<hr>\n";
}
// setup a template object
$options = &PEAR::getStaticProperty('HTML_Template_Flexy','options');
$options = array(
'templateDir' => './templates',
'compileDir' => './templates/build',
'forceCompile' => 1,
'debug' => 0,
'local' => 'en'
);
$template = new HTML_Template_Flexy($options);
$renderer =& new HTML_QuickForm_Renderer_ObjectFlexy($template);
$renderer->setLabelTemplate("label.html");
$renderer->setHtmlTemplate("html.html");
$form->accept($renderer);
$view = new StdClass;
$view->form = $renderer->toObject();
$template->compile("flexy-static.html");
// capture the array stucture
ob_start();
print_r($view->form);
$view->static_object = ob_get_contents();
ob_end_clean();
// render and display the template
$template->outputObject($view);
?>

View File

@@ -1,98 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm with ITDynamic renderer
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: ITDynamic_example.php,v 1.4 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ITDynamic.php';
// can use either HTML_Template_Sigma or HTML_Template_ITX
require_once 'HTML/Template/ITX.php';
// require_once 'HTML/Template/Sigma.php';
$form = new HTML_QuickForm('frmTest', 'post');
$form->setDefaults(array(
'itxtTest' => 'Test Text Box',
'itxaTest' => 'Hello World',
'iselTest' => array('B', 'C'),
'name' => array('first' => 'Alexey', 'last' => 'Borzov'),
'iradYesNo' => 'Y',
'ichkABCD' => array('A'=>true,'D'=>true)
));
$form->addElement('header', '', 'Normal Elements');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
// will be rendered in default qf_element block
$form->addElement('text', 'itxtTest', 'Test Text:');
// will be rendered in qf_textarea block, as it exists in template
$form->addElement('textarea', 'itxaTest', 'Test TextArea:', array('rows' => 5, 'cols' => 40));
// will be later assigned to qf_green, note that an array of labels is passed
$form->addElement('password', 'ipwdTest', array('Test Password:', 'The password is expected to be long enough.'));
$select =& $form->addElement('select', 'iselTest', 'Test Select:', array('A'=>'A', 'B'=>'B','C'=>'C','D'=>'D'));
$select->setSize(5);
$select->setMultiple(true);
$form->addElement('submit', 'isubTest', 'Test Submit');
$form->addElement('header', '', 'Grouped Elements');
// will be rendered in default qf_group block
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABCD', 'ABCD:', array('&nbsp;', '<br />'));
// fancygroup candidates
// will be rendered in qf_fancygroup_radio
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No:');
// will be rendered in qf_fancygroup_element
$name['first'] = &HTML_QuickForm::createElement('text', 'first', 'First:');
$name['first']->setSize(20);
$name['last'] = &HTML_QuickForm::createElement('text', 'last', 'Last:');
$name['last']->setSize(30);
$form->addGroup($name, 'name', 'Name');
// add some 'required' rules to show "stars" and (possible) errors...
$form->addRule('itxtTest', 'Test Text is a required field', 'required');
$form->addRule('itxaTest', 'Test TextArea is a required field', 'required');
$form->addRule('iradYesNo', 'Check Yes or No', 'required');
$form->addGroupRule('name', array('last' => array(array('Last name is required', 'required'))));
// try to validate the form
if ($form->validate()) {
$form->freeze();
}
// create a template object and load the template file
// can use either HTML_Template_Sigma or HTML_Template_ITX
$tpl =& new HTML_Template_ITX('./templates');
// $tpl =& new HTML_Template_Sigma('./templates');
$tpl->loadTemplateFile('it-dynamic.html', true, true);
// create a renderer
$renderer =& new HTML_QuickForm_Renderer_ITDynamic($tpl);
// assign elements to blocks
$renderer->setElementBlock(array(
'ipwdTest' => 'qf_green',
'iradYesNo' => 'qf_fancygroup',
'name' => 'qf_fancygroup'
));
// Black Magic :]
$form->accept($renderer);
// display the results
$tpl->show();
?>

View File

@@ -1,122 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm with ITDynamic renderer (2-column layout)
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: ITDynamic_example2.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ITDynamic.php';
// can use either HTML_Template_Sigma or HTML_Template_ITX
require_once 'HTML/Template/ITX.php';
//require_once 'HTML/Template/Sigma.php';
$form = new HTML_QuickForm('frmTest', 'POST');
// Fills with some defaults values
$defaultValues['company'] = 'Mamasam';
$defaultValues['country'] = array();
$defaultValues['name'] = array('first'=>'Alexey', 'last'=>'Borzov');
$defaultValues['phone'] = array('513', '123', '4567');
$form->setDefaults($defaultValues);
// Hidden
$form->addElement('hidden', 'session', '1234567890');
$form->addElement('hidden', 'timer', '12345');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
// Personal information
$form->addElement('header', 'personal_info', 'Personal Information');
$name['last'] = &HTML_QuickForm::createElement('text', 'first', 'First', 'size=10');
$name['first'] = &HTML_QuickForm::createElement('text', 'last', 'Last', 'size=10');
$form->addGroup($name, 'name', 'Name:', ',&nbsp;');
$areaCode = &HTML_QuickForm::createElement('text', '', null,'size=4 maxlength=3');
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, 'size=4 maxlength=3');
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, 'size=5 maxlength=4');
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phone', 'Telephone:', '-');
$form->addElement('text', 'email', 'Your email:');
$form->addElement('password', 'pass', 'Your password:', 'size=10');
// to finish the first column:
$form->addElement('static', null, null, 'first column');
// Company information
$form->addElement('header', 'company_info', 'Company Information');
$form->addElement('text', 'company', 'Company:', 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$form->addGroup($str, 'street', 'Street:', '<br />');
$addr['zip'] = &HTML_QuickForm::createElement('text', 'zip', 'Zip', 'size=6 maxlength=10');
$addr['city'] = &HTML_QuickForm::createElement('text', 'city', 'City', 'size=15');
$form->addGroup($addr, 'address', 'Zip, city:');
$select = array('' => 'Please select...', 'AU' => 'Australia', 'FR' => 'France', 'DE' => 'Germany', 'IT' => 'Italy');
$form->addElement('select', 'country', 'Country:', $select);
// Creates a checkboxes group using an array of separators
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'destination', 'Destination:', array('&nbsp;', '<br />'));
// to finish the second column:
$form->addElement('static', null, null, 'second column');
// can't render these elements properly, so they are in the template
//$form->addElement('reset', 'reset', 'Reset');
//$form->addElement('submit', 'submit', 'Register');
// Adds some validation rules
$form->addRule('email', 'Email address is required', 'required');
$form->addGroupRule('name', 'Name is required', 'required');
$form->addRule('pass', 'Password must be between 8 to 10 characters', 'rangelength', array(8, 10));
$form->addRule('country', 'Country is a required field', 'required');
$form->addGroupRule('destination', 'Please check at least two boxes', 'required', null, 2);
$form->addGroupRule('phone', 'Please fill all phone fields', 'required');
$form->addGroupRule('phone', 'Values must be numeric', 'numeric');
$AddrRules['zip'][0] = array('Zip code is required', 'required');
$AddrRules['zip'][1] = array('Zip code is numeric only', 'numeric');
$AddrRules['city'][0] = array('City is required', 'required');
$AddrRules['city'][1] = array('City is letters only', 'lettersonly');
$form->addGroupRule('address', $AddrRules);
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then freezes the data
$form->freeze();
}
// can use either HTML_Template_Sigma or HTML_Template_ITX
$tpl =& new HTML_Template_ITX('./templates');
// $tpl =& new HTML_Template_Sigma('./templates');
$tpl->loadTemplateFile('it-dynamic-2.html');
$renderer =& new HTML_QuickForm_Renderer_ITDynamic($tpl);
$renderer->setElementBlock(array(
'name' => 'qf_group_table',
'address' => 'qf_group_table'
));
$form->accept($renderer);
$tpl->show();
?>

View File

@@ -1,114 +0,0 @@
<?php
/**
* Example of usage for PEAR class HTML_QuickForm
*
* @category HTML
* @package HTML_QuickForm
* @author Bertrand Mansion <bmansion@mamasam.com>
* @version CVS: $Id: ITStatic_example.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
// $Id: ITStatic_example.php,v 1.5 2007/05/29 19:12:26 avb Exp $
require_once('HTML/QuickForm.php');
require_once('HTML/QuickForm/Renderer/ITStatic.php');
require_once('HTML/Template/ITX.php');
// Form name will be used to find the placeholders.
$form = new HTML_QuickForm('form', 'POST');
// Fills with some defaults values
$defaultValues['company'] = 'Mamasam';
$defaultValues['country'] = array();
$defaultValues['name'] = array('first'=>'Bertrand', 'last'=>'Mansion');
$defaultValues['phone'] = array('513', '123', '4567');
$form->setDefaults($defaultValues);
// Hidden
$form->addElement('hidden', 'session', '1234567890');
// Personal information
$form->addElement('header', 'personal', 'Personal Information');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'email', 'Your email:');
$form->addElement('password', 'pass', 'Your password:', 'size=10');
$name['last'] = &HTML_QuickForm::createElement('text', 'first', 'First', 'size=10');
$name['first'] = &HTML_QuickForm::createElement('text', 'last', 'Last', 'size=10');
$form->addGroup($name, 'name', 'Name:', ',&nbsp;');
$areaCode = &HTML_QuickForm::createElement('text', '', null,'size=4 maxlength=3');
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, 'size=4 maxlength=3');
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, 'size=5 maxlength=4');
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phone', 'Telephone:', '-');
// Company information
$form->addElement('header', 'company_info', 'Company Information');
$form->addElement('text', 'company', 'Company:', 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$form->addGroup($str, 'street', 'Street:', '<br />');
$addr['zip'] = &HTML_QuickForm::createElement('text', 'zip', 'Zip', 'size=6 maxlength=10');
$addr['city'] = &HTML_QuickForm::createElement('text', 'city', 'City', 'size=15');
$form->addGroup($addr, 'address', 'Zip, city:');
$select = array('' => 'Please select...', 'AU' => 'Australia', 'FR' => 'France', 'DE' => 'Germany', 'IT' => 'Italy');
$form->addElement('select', 'country', 'Country:', $select);
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'destination', 'Destination:', array('&nbsp;', '<br />'));
// Other elements
$form->addElement('checkbox', 'news', '', " Check this box if you don't want to receive our newsletter.");
$form->addElement('reset', 'reset', 'Reset');
$form->addElement('submit', 'submit', 'Register');
// Adds some validation rules
$form->addRule('email', 'Email address is required', 'required');
$form->addGroupRule('name', 'Name is required', 'required');
$form->addRule('pass', 'Password must be between 8 to 10 characters', 'rangelength', array(8, 10));
$form->addRule('country', 'Country is a required field', 'required');
$form->addGroupRule('destination', 'Please check at least two boxes', 'required', null, 2);
$form->addGroupRule('phone', 'Please fill all phone fields', 'required');
$form->addGroupRule('phone', 'Values must be numeric', 'numeric');
$AddrRules['zip'][0] = array('Zip code is required', 'required');
$AddrRules['zip'][1] = array('Zip code is numeric only', 'numeric');
$AddrRules['city'][0] = array('City is required', 'required');
$AddrRules['city'][1] = array('City is letters only', 'lettersonly');
$form->addGroupRule('address', $AddrRules);
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then freezes the data
$form->freeze();
}
// Could be HTML_Template_Sigma('./templates')
$tpl =& new HTML_Template_ITX('./templates');
$tpl->loadTemplateFile('it-static.html');
$renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl);
$renderer->setRequiredTemplate('{label}<font color="red" size="1">*</font>');
$renderer->setErrorTemplate('<font color="orange" size="1">{error}</font><br />{html}');
$form->accept($renderer);
$tpl->show();
?>

View File

@@ -1,149 +0,0 @@
<html>
<title>QuickForm Using QuickHtml Renderer</title>
<body>
<?php
/**
* Another example of usage for PEAR class HTML_QuickForm using the
* QuickHtml renderer.
*
* This renderer has three main distinctives: an easy way to create
* custom-looking forms, the ability to separate the creation of form
* elements from their display, and being able to use QuickForm in
* widget-based template systems. See the online documentation for more
* info.
*
* @category HTML
* @package HTML_QuickForm
* @author Jason Rust <jrust@rustyparts.com>
* @version CVS: $Id: QuickHtml_example.php,v 1.2 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once ("HTML/QuickForm.php");
require_once ("HTML/QuickForm/Renderer/QuickHtml.php");
$form =& new HTML_QuickForm('tmp_form','POST');
// get our render
$renderer =& new HTML_QuickForm_Renderer_QuickHtml();
// create the elements
createElements($form);
// set their values
setValues($form);
// Do the magic of creating the form. NOTE: order is important here: this must
// be called after creating the form elements, but before rendering them.
$form->accept($renderer);
// Because radio buttons have the same name we have to pass the value
// as well as the name in order to get the correct one.
$tmp_radio = ' Yes: ' . $renderer->elementToHtml('tmp_radio', 'Y');
$tmp_radio .= ' No: ' . $renderer->elementToHtml('tmp_radio', 'N');
$tmp_submit = $renderer->elementToHtml('tmp_reset');
$tmp_submit .= $renderer->elementToHtml('tmp_submit');
// Make our form table using some of the widget functions.
$data = '
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#eeeeee" width="500">
<tr style="font-weight: bold;">' . createHeaderCell('QuickForm using QuickHtml Renderer', 'center', 2) . '</tr>
<tr>' . createFormCell($renderer->elementToHtml('tmp_textarea'), 'center', 2) . '</tr>
<tr>' . createHeaderCell('Text box (element is part of an array)', 'left') .
createHeaderCell('Yes or no?', 'right') . '</tr>
<tr>' . createFormCell($renderer->elementToHtml('tmp_text[array]'), 'left') .
createFormCell($tmp_radio, 'right') . '</tr>
<tr>' . createHeaderCell('Phone Number (a group)', 'left') .
createHeaderCell('Advanced Check Box?', 'right') . '</tr>
<tr>' . createFormCell($renderer->elementToHtml('phone_num'), 'left') .
createFormCell($renderer->elementToHtml('tmp_checkbox'), 'right') . '</tr>
<tr>' . createHeaderCell('Today is:', 'left') .
createHeaderCell('Multiple Select', 'right') . '</tr>
<tr>' . createFormCell($renderer->elementToHtml('tmp_date'), 'left') .
createFormCell($renderer->elementToHtml('tmp_multipleSelect[0]'), 'right') . '</tr>
<tr>' . createFormCell($tmp_submit, 'center', 2) . '</tr>
</table>';
// Wrap the form and any remaining elements (i.e. hidden elements) into the form tags.
echo $renderer->toHtml($data);
echo "\n<HR> <b>Submitted Values: </b><br />\n";
echo "<pre>";
print_r($_POST);
// {{{ createElements()
// creates all the fields for the form
function createElements(&$form)
{
// select list array
$selectListArray = array(
'windows' => 'Windows',
'linux' => 'Linux',
'irix' => 'Irix',
'mac' => 'Mac',
);
$form->addElement('text','tmp_text[array]',null,array('size' => 10));
$form->addElement('hidden','tmp_hidden', 'value');
$form->addElement('textarea','tmp_textarea',null,array('cols' => 50, 'rows' => 10, 'wrap' => 'virtual'));
$form->addElement('radio','tmp_radio',null,null,'Y');
$form->addElement('radio','tmp_radio',null,null,'N');
$text = array();
$text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 3));
$text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 4));
$text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 3));
$form->addGroup($text, 'phone_num', null, '-');
$form->addElement('advcheckbox','tmp_checkbox',null,'Please Check',null,array('not checked', 'checked'));
$form->addElement('date', 'tmp_date', null, array('format'=>'D d M Y'));
$form->addElement('select', 'tmp_multipleSelect[0]', null, $selectListArray, array('multiple' => 'multiple', 'size' => 4));
$form->addElement('reset','tmp_reset','Reset Form');
$form->addElement('submit','tmp_submit','Submit Form');
$form->addRule('tmp_text[array]','Text length must be greater than 10','minlength',10,'client');
}
// }}}
// {{{ setValues()
// sets all the default and constant values for the form
function setValues(&$form)
{
// Fills with some defaults values
$defaultValues['tmp_textarea'] = '
Test Text Area
With line breaks';
$defaultValues['phone_num'] = array('513', '123', '3456');
$defaultValues['tmp_checkbox'] = 'checked';
$defaultValues['tmp_multipleSelect'][0] = array('linux', 'mac');
// Fill with some constant values.
// Constant is not overridden by POST, GET, or defaultValues
// when values are being filled in
$constantValues['tmp_radio'] = 'Y';
$constantValues['tmp_date'] = time();
$constantValues['tmp_text']['array'] = 'constant';
$form->setDefaults($defaultValues);
$form->setConstants($constantValues);
}
// }}}
// {{{ createHeaderCell()
// creates a header cell
function createHeaderCell($text, $align, $colspan = 1)
{
return '<td align="' . $align . '" width="50%" bgcolor="#cccccc" colspan="' . $colspan . '">' . $text . '</td>';
}
// }}}
// {{{ createFormCell()
// creates a form cell based on the element name
function createFormCell($elementHtml, $align, $colspan = 1)
{
return '<td align="' . $align . '" width="50%" colspan="' . $colspan . '">' .
$elementHtml .
'</td>';
}
// }}}
?>
</body>
</html>

View File

@@ -1,110 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm Array renderer with Smarty template engine
*
* @category HTML
* @package HTML_QuickForm
* @author Thomas Schulz <ths@4bconsult.de>
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: SmartyDynamic_example.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/Array.php';
// fix this if your Smarty is somewhere else
require_once 'Smarty.class.php';
$form = new HTML_QuickForm('frmTest', 'post');
$form->setDefaults(array(
'itxtTest' => 'Test Text Box',
'itxaTest' => 'Hello World',
'iselTest' => array('B', 'C'),
'name' => array('first' => 'Thomas', 'last' => 'Schulz'),
'iradYesNo' => 'Y',
'ichkABCD' => array('A'=>true,'D'=>true)
));
$form->addElement('header', '', 'Normal Elements');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'itxtTest', array('Test Text', 'note' => 'Note for Testtext element.'));
$form->addElement('textarea', 'itxaTest', 'Test TextArea', 'cols="40" rows="2"');
// will be later assigned to style green
$form->addElement('password', 'ipwdTest', 'Test Password');
$select =& $form->addElement(
'select',
'iselTest',
array('Test Select', 'note' => 'We recommend to check at least two categories!'),
array('A'=>'A * * * * (luxory)', 'B'=>'B * * *','C'=>'C * *','D'=>'D * (simple)')
);
$select->setSize(4);
$select->setMultiple(true);
$form->addElement('submit', 'isubTest', 'Test Submit');
$form->addElement('header', '', 'Grouped Elements');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABCD', 'ABCD', array('&nbsp;', '<br />'));
// will be later assigned to style fancygroup
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No');
// will be later assigned to style fancygroup
$name['first'] = &HTML_QuickForm::createElement('text', 'first', 'First:');
$name['first']->setSize(20);
$name['last'] = &HTML_QuickForm::createElement('text', 'last', 'Last:');
$name['last']->setSize(30);
$form->addGroup($name, 'name', 'Name');
// add some 'required' rules to show "stars" and (possible) errors...
$form->addRule('itxtTest', 'Test Text is a required field', 'required');
$form->addRule('itxaTest', 'Test TextArea is a required field', 'required');
$form->addGroupRule('iradYesNo', 'Check Yes or No', 'required');
$form->addGroupRule('name', array('last' => array(array('Last name is required', 'required'))));
// try to validate the form
if ($form->validate()) {
$form->freeze();
}
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
// give some elements aditional style informations
$renderer->setElementStyle(array(
'ipwdTest' => 'green',
'iradYesNo' => 'fancygroup',
'name' => 'fancygroup'
));
$form->accept($renderer);
// setup a template object
$tpl =& new Smarty;
$tpl->template_dir = './templates';
$tpl->compile_dir = './templates';
// assign array with form data
$tpl->assign('form', $renderer->toArray());
// capture the array stucture
// (only for showing in sample template)
ob_start();
print_r($renderer->toArray());
$tpl->assign('dynamic_array', ob_get_contents());
ob_end_clean();
// render and display the template
$tpl->display('smarty-dynamic.tpl');
?>

View File

@@ -1,139 +0,0 @@
<?php
/**
* Example of usage for HTML_QuickForm with Smarty renderer
*
* @category HTML
* @package HTML_QuickForm
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Thomas Schulz <ths@4bconsult.de>
* @version CVS: $Id: SmartyStatic_example.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
// fix this if your Smarty is somewhere else
require_once 'Smarty.class.php';
// Form name will be used to find the placeholders.
$form = new HTML_QuickForm('form', 'POST');
// Fills with some defaults values
$defaultValues['company'] = 'Mamasam';
$defaultValues['country'] = array();
$defaultValues['name'] = array('first'=>'Bertrand', 'last'=>'Mansion');
$defaultValues['phone'] = array('513', '123', '4567');
$form->setDefaults($defaultValues);
// Hidden
$form->addElement('hidden', 'session', '1234567890');
// Personal information
$form->addElement('header', 'personal', 'Personal Information');
$form->addElement('hidden', 'ihidTest', 'hiddenField');
$form->addElement('text', 'email', 'Your email:');
$form->addElement('password', 'pass', array('Your password:', 'note'=>'Please, choose a 8-10 characters password.'), 'size=10');
$name['last'] = &HTML_QuickForm::createElement('text', 'first', 'First', 'size=10');
$name['first'] = &HTML_QuickForm::createElement('text', 'last', 'Last', 'size=10');
$form->addGroup($name, 'name', 'Name:', ',&nbsp;');
$areaCode = &HTML_QuickForm::createElement('text', '', null,'size=4 maxlength=3');
$phoneNo1 = &HTML_QuickForm::createElement('text', '', null, 'size=4 maxlength=3');
$phoneNo2 = &HTML_QuickForm::createElement('text', '', null, 'size=5 maxlength=4');
$form->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'phone', 'Telephone:', '-');
// Company information
$form->addElement('header', 'company_info', 'Company Information');
$form->addElement('text', 'company', 'Company:', 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$str[] = &HTML_QuickForm::createElement('text', '', null, 'size=20');
$form->addGroup($str, 'street', 'Street:', '<br />');
$addr['zip'] = &HTML_QuickForm::createElement('text', 'zip', 'Zip', 'size=6 maxlength=10');
$addr['city'] = &HTML_QuickForm::createElement('text', 'city', 'City', 'size=15');
$form->addGroup($addr, 'address', 'Zip, city:');
$select = array('' => 'Please select...', 'AU' => 'Australia', 'FR' => 'France', 'DE' => 'Germany', 'IT' => 'Italy');
$form->addElement('select', 'country', 'Country:', $select);
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'destination', 'Destination:', array('&nbsp;', '<br />'));
// Other elements
$form->addElement('checkbox', 'news', '', " Check this box if you don't want to receive our newsletter.");
$form->addElement('reset', 'reset', 'Reset');
$form->addElement('submit', 'submit', 'Register');
// Adds some validation rules
$form->addRule('email', 'Email address is required', 'required');
$form->addGroupRule('name', 'Name is required', 'required');
$form->addRule('pass', 'Password must be between 8 to 10 characters', 'rangelength', array(8, 10));
$form->addRule('country', 'Country is a required field', 'required');
$form->addGroupRule('destination', 'Please check at least two boxes', 'required', null, 2);
$form->addGroupRule('phone', 'Please fill all phone fields', 'required');
$form->addGroupRule('phone', 'Values must be numeric', 'numeric');
$AddrRules['zip'][0] = array('Zip code is required', 'required');
$AddrRules['zip'][1] = array('Zip code is numeric only', 'numeric');
$AddrRules['city'][0] = array('City is required', 'required');
$AddrRules['city'][1] = array('City is letters only', 'lettersonly');
$form->addGroupRule('address', $AddrRules);
// Tries to validate the form
if ($form->validate()) {
// Form is validated, then freezes the data
$form->freeze();
}
// setup a template object
$tpl =& new Smarty;
$tpl->template_dir = './templates';
$tpl->compile_dir = './templates';
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl, true);
$renderer->setRequiredTemplate(
'{if $error}
<font color="red">{$label|upper}</font>
{else}
{$label}
{if $required}
<font color="red" size="1">*</font>
{/if}
{/if}'
);
$renderer->setErrorTemplate(
'{if $error}
<font color="orange" size="1">{$error}</font><br />
{/if}{$html}'
);
$form->accept($renderer);
// assign array with form data
$tpl->assign('form', $renderer->toArray());
// capture the array stucture
ob_start();
print_r($renderer->toArray());
$tpl->assign('static_array', ob_get_contents());
ob_end_clean();
// render and display the template
$tpl->display('smarty-static.tpl');
?>

View File

@@ -1,48 +0,0 @@
<?php
/**
* Example of usage for QuickForm elements with multiple labels (using Default renderer)
*
* @category HTML
* @package HTML_QuickForm
* @author Jon Wood <jon@jellybob.co.uk>
* @version CVS: $Id: multiple-labels.php,v 1.2 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
$template =
'<tr>
<td align="right" valign="top">
<!-- BEGIN required --><font color="red">*</font><!-- END required -->
<b>{label}</b>
</td>
<td nowrap="nowrap" valign="top" align="left">
{element}
<!-- BEGIN error --><br/><font color="red">{error}</font><br/><!-- END error -->
<!-- BEGIN label_2 --><br/><font size="-1">{label_2}</font><!-- END label_2 -->
</td>
</tr>';
// Create the form, and add a header to it.
$form = new HTML_QuickForm('labels_example', 'post');
$form->addHeader('QuickForm Labels Example');
// Do the magic! Just pass your label to the element as an array!
$form->addElement('text', 'name', array('Name', 'The name that you would like to enter in this element.'));
$form->addElement('checkbox', 'check', array('Check Me!', 'If you check this box, it will have tick in it.'));
// More boring stuff.
$form->addElement('submit', null, 'Submit');
if ($form->validate()) {
$form->freeze();
}
// customize the element template
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate($template);
// output the form
$form->display();
?>

View File

@@ -1,129 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Id: flexy-dynamic.html,v 1.3 2003/05/21 13:27:59 avb Exp -->
<html>
<head>
<title>Flexy template for Object renderer</title>
<style type="text/css">
body, td, th {
font-family: sans-serif;
color: Navy;
background-color: #EEE;
font-size: smaller;
white-space: nowrap;
}
.maintable {
border: thin dashed #D0D0D0;
background-color: #EEE;
}
.header {
color: #FFF;
background-color: #999;
}
.green {
background-color : #CFC;
color: black;
}
.error {
color: red;
}
</style>
</head>
<body>
{form.javascript:h}
{form.outputHeader():h}
<table border="0" class="maintable" align="center">
{form.outputHeader():h}
{form.hidden:h}
{foreach:form.sections,sec}
<tr>
<td class="header" colspan="2">
<b>{sec.header}</b></td>
</tr>
{foreach:sec.elements,elem}
{if:elem.style}
{elem.outputStyle():h}
{else:}
{if:elem.isButton()}
{if:elem.notFrozen()}
<tr>
<td>&nbsp;</td>
<td align="left">{elem.html:h}</td>
</tr>
{end:}
{else:}
<tr>
{if:elem.isType(#textarea#)}
<td colspan="2">
{if:elem.required}<span class="error">*</span>{end:}
{if:elem.error}<span class="error">{end:}
<b>{elem.label:h}:</b><br />
{if:elem.error}</span>{end:}
{else:}
<td align="right" valign="top">
{if:elem.required}<span class="error">*</span>{end:}
{if:elem.error}<span class="error">{end:}
<b>{elem.label:h}:</b>
{if:elem.error}</span>{end:}
</td>
<td>
{end:}
{if:elem.error}<div class="error">{elem.error}</div>{end:}
{if:elem.isType(#group#)}
{foreach:elem.elements,gitem}
{gitem.label:h}
{gitem.html:h}{if:gitem.required}<span class="error">*</span>*</span>{end:}
{if:elem.separator}{elem.separator:h}{end:}
{end:}
{else:}
{elem.html:h}
{end:}
</td>
</tr>
{end:}
{end:}
{end:}
{end:}
{if:form.requirednote}
<tr>
<td>&nbsp;</td>
<td valign="top">{form.requirednote:h}</td>
</tr>
{end:}
</form>
</table>
&nbsp;
<p><b>Collected Errors:</b><br />
{foreach:form.errors,name,error}
<span class="error">{error:h}</span> in element [{name:h}]<br />
{end:}
</p>
&nbsp;
<p><strong>Best Practice: </strong><br />
Use only one dynamic form template like this for your <br />
Flexy driven project. You include this where <br />
to place a form with the formdata object rendered by <br />
Object QuickForm Renderer as option:</p>
<pre style="font-size: 12px;">
<strong>&lt;include file=form-dynamic.tpl form={formdata}&gt;</strong>
</pre>
&nbsp;
<p><strong>The used &quot;Dynamic&quot; Object </strong></p>
<pre style="font-size: 12px;">
{dynamic_object}
</pre>
</body>
</html>

View File

@@ -1,154 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id: flexy-static.html,v 1.1 2003/08/05 09:34:48 mansion Exp $ -->
<html>
<head>
<title>Flexy template : 2 column layout example</title>
<style type="text/css">
.errors {
font-family: sans-serif;
color : #000;
background-color : #FFF;
font-size : 12pt;
}
.label {
font-family: sans-serif;
color : Navy;
font-size : 11px;
text-align : right;
vertical-align : top;
white-space: nowrap;
}
.element {
font-family: sans-serif;
background-color : #EEE;
text-align : left;
white-space: nowrap;
}
.note {
font-family: sans-serif;
background-color : #EEE;
text-align : center;
font-size : 10pt;
color : AAA;
white-space: nowrap;
}
th {
font-family: sans-serif;
font-size : small;
color : #FFF;
background-color : #AAA;
}
.maintable {
border : thin dashed #D0D0D0;
background-color : #EEE;
}
</style>
{form.javascript:h}
</head>
<body>
{form.outputHeader():h}
{form.hidden:h}
<table class="maintable" width="600" align="center">
<tr>
<td width="50%" valign="top"><!-- Personal info -->
<table width="100%" cellpadding="4">
<tr><th colspan="2">{form.header.personal:h}</th></tr>
<tr>
<td class="label">{form.name.label:h}</td>
<td class="element">{form.name.error:h}
<table cellspacing="0" cellpadding="1">
<tr>
<td>{form.name.first.html:h}</td>
<td>{form.name.last.html:h}</td>
</tr>
<tr>
<td><font size="1" color="grey">{form.name.first.label:h}</font></td>
<td><font size="1" color="grey">{form.name.last.label:h}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="label">{form.phone.label:h}</td>
<td class="element">{form.phone.html:h}</td>
</tr>
<tr>
<td class="label">{form.email.label:h}</td>
<td class="element">{form.email.html:h}</td>
</tr>
<tr><td colspan="2" class="note">Please, choose a 8-10 characters password.</td></tr>
<tr>
<td class="label">{form.pass.label:h}</td>
<td class="element">{form.pass.html:h}</td>
</tr>
</table>
</td>
<td width="50%" valign="top"><!-- Company info -->
<table width="100%" cellpadding="4">
<tr><th colspan="2">{form.header.company_info:h}</th></tr>
<tr>
<td class="label">{form.company.label:h}</td>
<td class="element">{form.company.html:h}</td>
</tr>
<tr>
<td class="label" valign="top">{form.street.label:h}</td>
<td class="element">{form.street.html:h}</td>
</tr>
<tr>
<td class="label">{form.address.label:h}</td>
<td class="element">{form.address.error:h}
<table cellspacing="0" cellpadding="1">
<tr>
<td>{form.address.zip.html:h}</td>
<td>{form.address.city.html:h}</td>
</tr>
<tr>
<td><font size="1" color="grey">{form.address.zip.label:h}</font></td>
<td><font size="1" color="grey">{form.address.city.label:h}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="label">{form.country.label:h}</td>
<td class="element">{form.country.html:h}</td>
</tr>
<tr>
<td class="label">{form.destination.label:h}</td>
<td class="element">{form.destination.html:h}</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td>{form.requirednote:h}</td>
<td align="right">{form.reset.html:h}&nbsp;{form.submit.html:h}</td>
</tr>
<tr>
<td colspan="2" style="font-size:11px; color: navy;"><br />{form.news.html:h}</td>
</tr>
</table>
</form>
<br />
<b>Collected Errors:</b><br />
{foreach:form.errors,error}
<font color="red">{error}</font> in element [{name}]<br />
{end:}
&nbsp;
<p><strong>The used "Static" Object</strong></p>
<pre style="font-size: 12px;">
{static_object}
</pre>
</body>
</html>

View File

@@ -1,4 +0,0 @@
{if:error}
<font color="orange" size="1">{error:h}</font><br />
{end:}
{html:h}

View File

@@ -1,110 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>IT dynamic renderer: 2 column layout example</title>
<style type="text/css">
.errors {
font-family: sans-serif;
color : #000;
background-color : #FFF;
font-size : 12pt;
}
.label {
font-family: sans-serif;
color : Navy;
background-color : #EEE;
font-size : 11px;
text-align : right;
vertical-align : top;
white-space: nowrap;
}
.element {
font-family: sans-serif;
background-color : #EEE;
text-align : left;
white-space: nowrap;
}
.note {
font-family: sans-serif;
background-color : #EEE;
text-align : center;
font-size : 10pt;
color : AAA;
white-space: nowrap;
}
th {
font-family: sans-serif;
font-size : small;
color : #FFC;
background-color : #AAA;
}
.maintable {
border : thin dashed #D0D0D0;
background-color : #EEE;
}
</style>
{qf_javascript}
</head>
<body>
<!-- BEGIN qf_error_loop -->
<font color="red">{qf_error}</font><br />
<!-- END qf_error_loop -->
<form {qf_attributes}>
<!-- BEGIN qf_hidden_block -->
<div style="display: none;">
<!-- BEGIN qf_hidden_loop -->
{qf_hidden}
<!-- END qf_hidden_loop -->
</div>
<!-- END qf_hidden_block -->
<table class="maintable" width="600" align="center">
<tr>
<!-- BEGIN qf_main_loop -->
<!-- BEGIN qf_header -->
<td width="50%" valign="top">
<table width="100%" cellpadding="4">
<tr><th colspan="2">{qf_header}</th></tr>
<!-- END qf_header -->
<!-- BEGIN qf_element -->
<tr><td class="label"><!-- BEGIN qf_element_required --><span style="color: #FF0000;">*</span> <!-- END qf_element_required -->{qf_label}</td><td class="element"><!-- BEGIN qf_element_error --><font size="1" color="red">{qf_error}</font><br /><!-- END qf_element_error -->{qf_element}</td></tr>
<!-- END qf_element -->
<!-- BEGIN qf_password -->
<tr><td colspan="2" class="note">Please, choose a 8-10 characters password.</td></tr>
<tr><td class="label"><!-- BEGIN qf_password_required --><span style="color: #FF0000;">*</span> <!-- END qf_password_required --><span style="color: green;">{qf_label}</span></td><td class="element"><!-- BEGIN qf_password_error --><font size="1" color="red">{qf_error}</font><br /><!-- END qf_password_error -->{qf_element}</td></tr>
<!-- END qf_password -->
<!-- BEGIN qf_group -->
<tr>
<td class="label"><!-- BEGIN qf_group_required --><span style="color: #FF0000;">*</span> <!-- END qf_group_required -->{qf_group_label}</td>
<td class="element"><!-- BEGIN qf_group_loop --><!-- BEGIN qf_group_element -->{qf_separator}{qf_element}<!-- END qf_group_element --><!-- END qf_group_loop --></td>
</tr>
<!-- END qf_group -->
<!-- BEGIN qf_group_table -->
<tr>
<td class="label"><!-- BEGIN qf_group_table_required --><span style="color: #FF0000;">*</span> <!-- END qf_group_table_required -->{qf_group_label}</td>
<td class="element"><table cellpadding="0" cellspacing="0"><tr>
<!-- BEGIN qf_group_table_loop --><!-- BEGIN qf_group_table_element -->
<td>{qf_element}<br /><span style="font-size: 80%; color: #999;">{qf_label}<!-- BEGIN qf_group_table_element_required --><span style="color: #FF0000;">*</span> <!-- END qf_group_table_element_required --></span></td>
<!-- END qf_group_table_element --><!-- END qf_group_table_loop -->
</tr></table></td>
</tr>
<!-- END qf_group_table -->
<!-- BEGIN qf_static -->
</table>
</td><!-- {qf_element} ends -->
<!-- END qf_static -->
<!-- END qf_main_loop -->
</tr>
</table>
<table width="600" align="center">
<tr>
<td>{qf_required_note}</td>
<td align="right"><input name="reset" value="Reset" type="reset" />&nbsp;<input name="submit" value="Register" type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -1,127 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>IT dynamic renderer</title>
<style type="text/css">
body, td, th {
font-family: sans-serif;
color : Navy;
background-color : #EEE;
font-size : smaller;
white-space: nowrap;
}
.maintable {
border : thin dashed #D0D0D0;
background-color : #EEE;
}
.header {
color : #FFF;
background-color : #AAA;
}
.green {
background-color : #CFC;
color : black;
}
</style>
</head>
<body>
{qf_javascript}
<form {qf_attributes}>
<!-- BEGIN qf_hidden_block -->
<div style="display: none;">
<!-- BEGIN qf_hidden_loop -->
{qf_hidden}
<!-- END qf_hidden_loop -->
</div>
<!-- END qf_hidden_block -->
<table border="0" class="maintable" align="center">
<!-- BEGIN qf_errors -->
<tr>
<td align="left" valign="top" colspan="2">
<ul>
<!-- BEGIN qf_error_loop -->
<li>{qf_error}</li>
<!-- END qf_error_loop -->
</ul>
</td>
</tr>
<!-- END qf_errors -->
<!-- BEGIN qf_main_loop -->
<!-- BEGIN qf_header -->
<tr>
<td align="left" valign="top" colspan="2" class="header"><b>{qf_header}</b></td>
</tr>
<!-- END qf_header -->
<!-- BEGIN qf_element -->
<tr>
<td align="right" valign="top"><!-- BEGIN qf_element_required --><span style="color: #FF0000;">*</span><!-- END qf_element_required --><b>{qf_label}</b></td>
<td valign="top" align="left"><!-- BEGIN qf_element_error --><span style="color: #FF0000;">{qf_error}</span><br /><!-- END qf_element_error -->{qf_element}</td>
</tr>
<!-- END qf_element -->
<!-- BEGIN qf_textarea -->
<tr>
<td valign="top" colspan="2"><!-- BEGIN qf_textarea_required --><span style="color: #FF0000;">*</span><!-- END qf_textarea_required --><b>{qf_label}</b><br />
<!-- BEGIN qf_textarea_error --><span style="color: #FF0000;">{qf_error}</span><br><!-- END qf_textarea_error -->{qf_element}</td>
</tr>
<!-- END qf_textarea -->
<!-- BEGIN qf_group -->
<tr>
<td align="right" valign="top"><!-- BEGIN qf_group_required --><span style="color: #FF0000;">*</span><!-- END qf_group_required --><b>{qf_group_label}</b></td>
<td valign="top" align="left">
<!-- BEGIN qf_group_error --><span style="color: #FF0000;">{qf_error}</span><br /><!-- END qf_group_error -->
<!-- BEGIN qf_group_loop --><!-- BEGIN qf_group_element -->{qf_separator}{qf_element}<!-- END qf_group_element --><!-- END qf_group_loop -->
</td>
</tr>
<!-- END qf_group -->
<!-- BEGIN qf_fancygroup -->
<tr>
<td align="right" valign="top"><span<!-- BEGIN qf_fancygroup_required --> style="font-weight: bold; color: red"<!-- END qf_fancygroup_required -->>{qf_group_label}</span></td>
<td valign="top" align="left">
<table cellspacing="2">
<!-- BEGIN qf_fancygroup_loop -->
<tr>
<!-- BEGIN qf_fancygroup_element -->
<td class="green" align="right"><!-- BEGIN qf_fancygroup_element_required --><span style="color: #FF0000;">*</span><!-- END qf_fancygroup_element_required -->{qf_label}</td>
<td class="green">{qf_element}</td>
<!-- END qf_fancygroup_element -->
<!-- BEGIN qf_fancygroup_radio -->
<td colspan="2" class="green">{qf_element}</td>
<!-- END qf_fancygroup_radio -->
</tr>
<!-- END qf_fancygroup_loop -->
</table>
</td>
</tr>
<!-- END qf_fancygroup -->
<!-- BEGIN qf_green -->
<tr>
<td align="right" valign="top" class="green"><!-- BEGIN qf_green_required --><span style="color: #FF0000;">*</span><!-- END qf_green_required --><b>{qf_label}</b></td>
<td valign="top" align="left" class="green"><!-- BEGIN qf_green_error --><span style="color: #FF0000;">{qf_error}</span><br /><!-- END qf_green_error -->{qf_element}
<!-- BEGIN qf_green_label_2 --><br /><span style="font-size: 80%;">{qf_label_2}</span><!-- END qf_green_label_2 --></td>
</tr>
<!-- END qf_green -->
{qf_addblock}
<!-- END qf_main_loop -->
<!-- BEGIN qf_required_note -->
<tr>
<td>&nbsp;</td>
<td align="left" valign="top">{qf_required_note}</td>
</tr>
<!-- END qf_required_note -->
</table>
</form>
</body>
</html>

View File

@@ -1,102 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>IT static render: 2 column layout example</title>
<style type="text/css">
.errors {
font-family: sans-serif;
color : #000;
background-color : #FFF;
font-size : 12pt;
}
.label {
font-family: sans-serif;
color : Navy;
font-size : 11px;
text-align : right;
vertical-align : top;
white-space: nowrap;
}
.element {
font-family: sans-serif;
background-color : #EEE;
text-align : left;
white-space: nowrap;
}
.note {
font-family: sans-serif;
background-color : #EEE;
text-align : center;
font-size : 10pt;
color : AAA;
white-space: nowrap;
}
th {
font-family: sans-serif;
font-size : small;
color : #FFF;
background-color : #AAA;
}
.maintable {
border : thin dashed #D0D0D0;
background-color : #EEE;
}
</style>
{form_javascript}
</head>
<body>
<!-- BEGIN form_error_loop -->
<font color="red">{form_error}</font><br /><!-- END form_error_loop -->
<form {form_attributes}>
{form_session_html}
<table class="maintable" width="600" align="center">
<tr><td width="50%" valign="top"><!-- Personal info -->
<table width="100%" cellpadding="4"><tr><th colspan="2">{form_header_personal}</th></tr>
<tr>
<td class="label">{form_name_label}</td>
<td class="element"><!-- BEGIN form_name_error -->{form_name_error}<!-- END form_name_error -->
<table cellspacing="0" cellpadding="1">
<tr><td>{form_name_first_html}</td><td>{form_name_last_html}</td></tr>
<tr><td><font size="1" color="grey">{form_name_first_label}</font></td><td><font size="1" color="grey">{form_name_last_label}</font></td></tr>
</table>
</td>
</tr>
<tr><td class="label">{form_phone_label}</td><td class="element">{form_phone_html}</td></tr>
<tr><td class="label">{form_email_label}</td><td class="element">{form_email_html}</td></tr>
<tr><td colspan="2" class="note">Please, choose a 8-10 characters password.</td></tr>
<tr><td class="label">{form_pass_label}</td><td class="element">{form_pass_html}</td></tr>
</table>
</td><td width="50%" valign="top"><!-- Company info -->
<table width="100%" cellpadding="4"><tr><th colspan="2">{form_header_company_info}</th></tr>
<tr><td class="label">{form_company_label}</td><td class="element">{form_company_html}</td></tr>
<tr><td class="label" valign="top">{form_street_label}</td><td class="element">{form_street_html}</td></tr>
<tr>
<td class="label">{form_address_label}</td>
<td class="element"><!-- BEGIN form_address_error -->{form_address_error}<!-- END form_address_error -->
<table cellspacing="0" cellpadding="1">
<tr><td>{form_address_zip_html}</td><td>{form_address_city_html}</td></tr>
<tr><td><font size="1" color="grey">{form_address_zip_label}</font></td><td><font size="1" color="grey">{form_address_city_label}</font></td></tr>
</table>
</td>
</tr>
<tr><td class="label">{form_country_label}</td><td class="element">{form_country_html}</td></tr>
<tr><td class="label">{form_destination_label}</td><td class="element">{form_destination_html}</td></tr>
</table>
</td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td>{form_required_note}</td>
<td align="right">{form_reset_html}&nbsp;{form_submit_html}</td>
</tr>
<tr>
<td colspan="2" style="font-size:11px; color: navy;"><br />{form_news_html}</td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -1,4 +0,0 @@
{if:required}
<font color="red" size="1">*</font>
{end:}
{label:h}

View File

@@ -1,28 +0,0 @@
<!-- $Id: smarty-dynamic-fancygroup.tpl,v 1.1 2003/04/30 19:23:35 avb Exp $ -->
<tr>
<td valign="top" align="right">
<b{if $element.error} style="color: Red;"{/if}>{if $element.required}<font color="red">*</font>{/if}{$element.label}:</b>
</td>
<td>
<table cellspacing="2" border="0">
{foreach key=gkey item=gitem from=$element.elements}
<tr>
{if $gitem.type eq "radio"}
<td colspan="2" class="green">
{$gitem.html}
</td>
{else}
<td class="green" align="right">
{if $gitem.required}<font color="red">*</font>{/if}
{$gitem.label}
</td>
<td class="green">
{$gitem.html}
</td>
{/if}
</tr>
{/foreach}
</table>
</td>
</tr>

View File

@@ -1,9 +0,0 @@
<!-- $Id: smarty-dynamic-green.tpl,v 1.1 2003/04/30 19:23:35 avb Exp $ -->
<tr>
<td align="right" valign="top" class="green"><b>{$element.label}:</b></td>
<td valign="top" align="left" class="green">
{if $element.error}<font color="red">{$element.error}</font><br />{/if}
{$element.html}{if $element.required}<font color="red">*</font>{/if}
</td>
</tr>

View File

@@ -1,134 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id: smarty-dynamic.tpl,v 1.5 2004/08/10 10:06:42 ths Exp $ -->
<html>
<head>
<title>Smarty template for Array renderer</title>
<style type="text/css">
{literal}
body, td, th {
font-family: sans-serif;
color: Navy;
background-color : #EEE;
font-size: smaller;
white-space: nowrap;
}
.maintable {
border: thin dashed #D0D0D0;
background-color: #EEE;
}
.header {
color: #FFF;
background-color: #999;
}
.green {
background-color: #CFC;
color: black;
}
{/literal}
</style>
</head>
<body>
{$form.javascript}
<table border="0" class="maintable" align="center">
<form{$form.attributes}>{$form.hidden}
{foreach item=sec key=i from=$form.sections}
<tr>
<td class="header" colspan="2">
<b>{$sec.header}</b></td>
</tr>
{foreach item=element from=$sec.elements}
<!-- elements with alternative layout in external template file-->
{if $element.style}
{include file="smarty-dynamic-`$element.style`.tpl}
{*
NOTE: Another way ist to have smarty template code in
$element.style. In this case you can do:
{if $element.style}
{eval var=$element.style}
*}
<!-- submit or reset button (don't display on frozen forms) -->
{elseif $element.type eq "submit" or $element.type eq "reset"}
{if not $form.frozen}
<tr>
<td>&nbsp;</td>
<td align="left">{$element.html}</td>
</tr>
{/if}
<!-- normal elements -->
{else}
<tr>
{if $element.type eq "textarea"}
<td colspan="2">
{if $element.required}<font color="red">*</font>{/if}<b>{$element.label}</b><br />
{else}
<td align="right" valign="top">
{if $element.required}<font color="red">*</font>{/if}<b>{$element.label}:</b></td>
<td>
{/if}
{if $element.error}<font color="red">{$element.error}</font><br />{/if}
{if $element.type eq "group"}
{foreach key=gkey item=gitem from=$element.elements}
{$gitem.label}
{$gitem.html}{if $gitem.required}<font color="red">*</font>{/if}
{if $element.separator}{cycle values=$element.separator}{/if}
{/foreach}
{else}
{$element.html}
{/if}
<div style="font-size: 80%;">{$element.label_note}</div>
</td>
</tr>
{/if}
{/foreach}
{/foreach}
{if $form.requirednote and not $form.frozen}
<tr>
<td>&nbsp;</td>
<td valign="top">{$form.requirednote}</td>
</tr>
{/if}
</form>
</table>
&nbsp;
<p><b>Collected Errors:</b><br />
{foreach key=name item=error from=$form.errors}
<font color="red">{$error}</font> in element [{$name}]<br />
{/foreach}
</p>
&nbsp;
<p><strong>Best Practice: </strong><br />
Use only one dynamic form template like this for your <br />
Smarty driven project. You include this where <br />
to place a form with the formdata-Array rendered by <br />
SmartyDynamic QuickForm Renderer as option:</p>
<pre style="font-size: 12px;">
<strong>{ldelim}include file=form-dynamic.tpl form=$formdata{rdelim}</strong>
</pre>
&nbsp;
<p><strong>The used "Dynamic" Array </strong></p>
<pre style="font-size: 12px;">
{$dynamic_array|htmlentities}
</pre>
</body>
</html>

View File

@@ -1,156 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id: smarty-static.tpl,v 1.3 2004/10/15 20:30:56 ths Exp $ -->
<html>
<head>
<title>Smarty template for ArraySmarty renderer: 2 column layout example</title>
<style type="text/css">
{literal}
.errors {
font-family: sans-serif;
color : #000;
background-color : #FFF;
font-size : 12pt;
}
.label {
font-family: sans-serif;
color : Navy;
font-size : 11px;
text-align : right;
vertical-align : top;
white-space: nowrap;
}
.element {
font-family: sans-serif;
background-color : #EEE;
text-align : left;
white-space: nowrap;
}
.note {
font-family: sans-serif;
background-color : #EEE;
text-align : center;
font-size : 10pt;
color : AAA;
white-space: nowrap;
}
th {
font-family: sans-serif;
font-size : small;
color : #FFF;
background-color : #AAA;
}
.maintable {
border : thin dashed #D0D0D0;
background-color : #EEE;
}
{/literal}
</style>
{$form.javascript}
</head>
<body>
<form {$form.attributes}>
{$form.hidden}
<table class="maintable" width="600" align="center">
<tr>
<td width="50%" valign="top"><!-- Personal info -->
<table width="100%" cellpadding="4">
<tr><th colspan="2">{$form.header.personal}</th></tr>
<tr>
<td class="label">{$form.name.label}</td>
<td class="element">{$form.name.error}
<table cellspacing="0" cellpadding="1">
<tr>
<td>{$form.name.first.html}</td>
<td>{$form.name.last.html}</td>
</tr>
<tr>
<td><font size="1" color="grey">{$form.name.first.label}</font></td>
<td><font size="1" color="grey">{$form.name.last.label}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="label">{$form.phone.label}</td>
<td class="element">{$form.phone.html}</td>
</tr>
<tr>
<td class="label">{$form.email.label}</td>
<td class="element">{$form.email.html}</td>
</tr>
<tr><td colspan="2" class="note">{$form.pass.label_note}</td></tr>
<tr>
<td class="label">{$form.pass.label}</td>
<td class="element">{$form.pass.html}</td>
</tr>
</table>
</td>
<td width="50%" valign="top"><!-- Company info -->
<table width="100%" cellpadding="4">
<tr><th colspan="2">{$form.header.company_info}</th></tr>
<tr>
<td class="label">{$form.company.label}</td>
<td class="element">{$form.company.html}</td>
</tr>
<tr>
<td class="label" valign="top">{$form.street.label}</td>
<td class="element">{$form.street.html}</td>
</tr>
<tr>
<td class="label">{$form.address.label}</td>
<td class="element">{$form.address.error}
<table cellspacing="0" cellpadding="1">
<tr>
<td>{$form.address.zip.html}</td>
<td>{$form.address.city.html}</td>
</tr>
<tr>
<td><font size="1" color="grey">{$form.address.zip.label}</font></td>
<td><font size="1" color="grey">{$form.address.city.label}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="label">{$form.country.label}</td>
<td class="element">{$form.country.html}</td>
</tr>
<tr>
<td class="label">{$form.destination.label}</td>
<td class="element">{$form.destination.html}</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td>{$form.requirednote}</td>
<td align="right">{$form.reset.html}&nbsp;{$form.submit.html}</td>
</tr>
<tr>
<td colspan="2" style="font-size:11px; color: navy;"><br />{$form.news.html}</td>
</tr>
</table>
</form>
<br />
<b>Collected Errors:</b><br />
{foreach key=name item=error from=$form.errors}
<font color="red">{$error}</font> in element [{$name}]<br />
{/foreach}
&nbsp;
<p><strong>The used "Static" Array</strong></p>
<pre style="font-size: 12px;">
{$static_array|htmlentities}
</pre>
</body>
</html>

View File

@@ -1,30 +0,0 @@
<tr>
<td valign="top" align="right">
{if:required}<span class="error">*</span>{end:}
{if:error}<span class="error">{end:}
<b>{label:h}:</b>
{if:error}</span>{end:}
</td>
<td>
{if:error}<div class="error">{error}</div>{end:}
<table cellspacing="2" border="0">
{foreach:elements,gitem}
<tr>
{if:gitem.isType(#radio#)}
<td colspan="2" class="green">
{gitem.html:h}
</td>
{else:}
<td class="green" align="right">
{if:gitem.required}<span class="error">*</span>{end:}
{gitem.label:h}
</td>
<td class="green">
{gitem.html:h}
</td>
{end:}
</tr>
{end:}
</table>
</td>
</tr>

View File

@@ -1,10 +0,0 @@
<!-- $Id: green.html,v 1.2 2003/11/03 12:55:52 avb Exp $ -->
<tr>
<td align="right" valign="top" class="green">{if:required}<font color="red">*</font>{end:}<b>{label:h}:</b></td>
<td valign="top" align="left" class="green">
{if:error}<font color="red">{error:h}</font><br />{end:}
{html:h}
{if:label_2}<br /><span style="font-size: 75%">{label_2:h}</span>{end:}
</td>
</tr>

View File

@@ -1,89 +0,0 @@
<?php
/**
* Usage example for HTML_QuickForm, built-in validation rules.
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: rules-builtin.php,v 1.5 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
$form =& new HTML_QuickForm('builtin');
// We need an additional label below the element
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate(<<<EOT
<tr>
<td align="right" valign="top" nowrap="nowrap"><!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required --><b>{label}</b></td>
<td valign="top" align="left">
<!-- BEGIN error --><span style="color: #ff0000">{error}</span><br /><!-- END error -->{element}
<!-- BEGIN label_2 --><br/><span style="font-size: 80%">{label_2}</span><!-- END label_2 -->
</td>
</tr>
EOT
);
$form->addElement('header', null, 'Required rule');
$form->addElement('text', 'rRequired', array('Required:', 'Rule type \'required\'<br />Note: when the field is not \'required\' and is empty, other validation rules will <b>not</b> be applied to it'));
$form->addRule('rRequired', 'The field is required', 'required', null, 'client');
// RangeLength rules
$form->addElement('header', null, 'Range based rules');
$form->addElement('text', 'rMaxLength', array('Maximum length check (5):', 'Rule type \'maxlength\', $format = 5'));
$form->addElement('text', 'rMinLength', array('Minimum length check (5):', 'Rule type \'minlength\', $format = 5'));
$form->addElement('text', 'rRangeLength', array('Length range check (5-10):', 'Rule type \'rangelength\', $format = array(5, 10)'));
$form->addRule('rMaxLength', 'Should be less than or equal to 5 symbols', 'maxlength', 5, 'client');
$form->addRule('rMinLength', 'Should be more than or equal to 5 symbols', 'minlength', 5, 'client');
$form->addRule('rRangeLength', 'Should be between 5 and 10 symbols', 'rangelength', array(5,10), 'client');
// Email rule
$form->addElement('header', null, 'Email rule');
$form->addElement('text', 'rEmail', array('Email check:', 'Rule type \'email\''));
$form->addRule('rEmail', 'Should contain a valid email', 'email', null, 'client');
// RegEx rules
$form->addElement('header', null, 'Regex based rules');
$form->addElement('text', 'rRegex', array('Letters \'A\', \'B\', \'C\' only:', 'Rule type \'regex\' with $format = \'/^[ABCabc]+$/\''));
$form->addElement('text', 'rLettersOnly', array('Letters only:', 'Rule type \'lettersonly\''));
$form->addElement('text', 'rAlphaNumeric', array('Alphanumeric:', 'Rule type \'alphanumeric\''));
$form->addElement('text', 'rNumeric', array('Numeric:', 'Rule type \'numeric\''));
$form->addElement('text', 'rNoPunctuation', array('No punctuation:', 'Rule type \'nopunctuation\''));
$form->addElement('text', 'rNonZero', array('Nonzero:', 'Rule type \'nonzero\''));
$form->addRule('rRegex', 'Should contain letters A, B, C only', 'regex', '/^[ABCabc]+$/', 'client');
$form->addRule('rLettersOnly', 'Should contain letters only', 'lettersonly', null, 'client');
$form->addRule('rAlphaNumeric', 'Should be alphanumeric', 'alphanumeric', null, 'client');
$form->addRule('rNumeric', 'Should be numeric', 'numeric', null, 'client');
$form->addRule('rNoPunctuation', 'Should contain no punctuation', 'nopunctuation', null, 'client');
$form->addRule('rNonZero', 'Should be nonzero', 'nonzero', null, 'client');
// Compare rule
$form->addElement('header', null, 'Compare rule');
$form->addElement('password', 'cmpPasswd', 'Password:');
$form->addElement('password', 'cmpRepeat', array('Repeat password:', 'Rule type \'compare\', added to array(\'cmpPasswd\', \'cmpRepeat\')'));
$form->addRule(array('cmpPasswd', 'cmpRepeat'), 'The passwords do not match', 'compare', null, 'client');
// File rules
$form->addElement('header', null, 'Uploaded file rules');
$form->addElement('file', 'tstUpload', array('Upload file:', 'Rule types: \'uploadedfile\', \'maxfilesize\' with $format = 10240, \'mimetype\' with $format = \'text/xml\', filename with $format = \'/\\.xml$/\'<br />Validation for files is obviously <b>server-side only</b>'));
$form->addRule('tstUpload', 'Upload is required', 'uploadedfile');
$form->addRule('tstUpload', 'File size should be less than 10kb', 'maxfilesize', 10240);
$form->addRule('tstUpload', 'File type should be text/xml', 'mimetype', 'text/xml');
$form->addRule('tstUpload', 'File name should be *.xml', 'filename', '/\\.xml$/');
$form->addElement('header', null, 'Submit the form');
$submit[] =& $form->createElement('submit', null, 'Send');
$submit[] =& $form->createElement('checkbox', 'clientSide', null, 'use client-side validation', array('checked' => 'checked', 'onclick' => "if (this.checked) {this.form.onsubmit = oldHandler;} else {oldHandler = this.form.onsubmit; this.form.onsubmit = null;}"));
$form->addGroup($submit, null, null, '&nbsp;', false);
$form->applyFilter('__ALL__', 'trim');
$form->validate();
$form->display();
?>

View File

@@ -1,115 +0,0 @@
<?php
/**
* Usage example for HTML_QuickForm, using custom validation rules.
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version CVS: $Id: rules-custom.php,v 1.3 2007/05/29 19:12:26 avb Exp $
* @ignore
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Rule.php';
/**
* Checks that a numeric value is within range
*
* @package HTML_QuickForm
* @ignore
*/
class RuleNumericRange extends HTML_QuickForm_Rule
{
function validate($value, $options)
{
if (isset($options['min']) && floatval($value) < $options['min']) {
return false;
}
if (isset($options['max']) && floatval($value) > $options['max']) {
return false;
}
return true;
}
function getValidationScript($options = null)
{
$jsCheck = array();
if (isset($options['min'])) {
$jsCheck[] = 'Number({jsVar}) >= ' . $options['min'];
}
if (isset($options['max'])) {
$jsCheck[] = 'Number({jsVar}) <= ' . $options['max'];
}
return array('', "{jsVar} != '' && !(" . implode(' && ', $jsCheck) . ')');
} // end func getValidationScript
}
// In case you are wondering, this checks whether there are too many
// CAPITAL LETTERS in the string
function countUpper($value, $limit = null)
{
if (empty($value)) {
return false;
}
if (!isset($limit)) {
$limit = 0.5;
}
$upper = array_filter(preg_split('//', $value, -1, PREG_SPLIT_NO_EMPTY), 'ctype_upper');
return (count($upper) / strlen($value)) <= $limit;
}
// BC thingie: it expects the first param to be element name
function countUpper_old($name, $value, $limit = null)
{
if (empty($value)) {
return false;
}
if (!isset($limit)) {
$limit = 0.5;
}
$upper = array_filter(preg_split('//', $value, -1, PREG_SPLIT_NO_EMPTY), 'ctype_upper');
return (count($upper) / strlen($value)) <= $limit;
}
$form =& new HTML_QuickForm('custom');
$form->addElement('header', null, 'Custom rule class');
// registering the custom rule class
$form->registerRule('numRange', null, 'RuleNumericRange');
$form->addElement('text', 'rNumber_1_10', 'The number (1-10):');
$form->addRule('rNumber_1_10', 'Enter number from 1 to 10', 'numRange', array('min' => 1, 'max' => 10), 'client');
// adding an instance of the custom rule class without registering
$form->addElement('text', 'rNonnegative', 'Nonnegative number:');
$form->addRule('rNonnegative', 'Enter nonnegative number', new RuleNumericRange(), array('min' => 0), 'client');
// adding a classname of the custom rule class without registering
$form->addElement('text', 'rNonpositive', 'Nonpositive number:');
$form->addRule('rNonpositive', 'Enter nonpositive number', 'RuleNumericRange', array('max' => 0), 'client');
$form->addElement('header', null, 'Using callbacks');
// using callback without registering
$form->addElement('text', 'rUpper_0_5', 'Some (preferrably lowercase) text:');
$form->addRule('rUpper_0_5', 'There are too many CAPITAL LETTERS', 'callback', 'countUpper');
// register with 'callback' type
$form->registerRule('upper', 'callback', 'countUpper');
$form->addElement('text', 'rUpper_0_25', 'Some (mostly lowercase) text:');
$form->addRule('rUpper_0_25', 'There are too many CAPITAL LETTERS', 'upper', 0.25);
// BC feature: register with 'function' type
$form->registerRule('upperOld', 'function', 'countUpper_old');
$form->addElement('text', 'rUpper_0', 'Some lowercase text:');
$form->addRule('rUpper_0', 'There are CAPITAL LETTERS, this is not allowed', 'upperOld', 0);
$form->addElement('submit', null, 'Send');
$form->applyFilter(array('rUpper_0_5', 'rUpper_0_25', 'rUpper_0'), 'trim');
$form->applyFilter(array('rNumber_1_10', 'rNonnegative', 'rNonpositive'), 'floatval');
$form->validate();
$form->display();
?>

View File

@@ -1,78 +0,0 @@
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alexander Merz <alexmerz@php.net> |
// | Heino H. Gehlsen <heino@gehlsen.dk> |
// +----------------------------------------------------------------------+
//
// $Id: group.php,v 1.2 2005/01/08 20:03:30 heino Exp $
?>
<html>
<head>
<title>NNTP news.php.net</title>
</head>
<body>
<?php
require_once "Net/NNTP/Client.php";
$nntp = new Net_NNTP_Client();
$ret = $nntp->connect("news.php.net");
if( PEAR::isError($ret)) {
echo '<font color="red">No connection to newsserver!</font><br>' ;
echo $ret->getMessage();
} else {
if(isset($_GET['group'])) {
$msgdata = $nntp->selectGroup($_GET['group']);
if(PEAR::isError($msgdata)) {
echo '<font color="red">'.$msgdata->getMessage().'</font><br>' ;
} else {
$msgcount = $msgdata['last']-$msgdata['first'];
echo '<h1>'.$_GET['group'].'</h1>';
echo "<b>Message count:</b>&nbsp;".$msgcount;
echo "<br><b>Posting allowed:</b>&nbsp;";
switch( $_GET['writable']) {
case 'y' :
echo 'yes';
break;
case 'n' :
echo 'no';
break;
case 'm' :
echo 'moderated';
break;
default:
echo 'n/a';
}
echo "<hr>";
echo "<h2>last 10 messages</h2>";
$msgs = array_reverse($nntp->getOverview( $msgcount-9, $msgcount));
foreach($msgs as $msgid => $msgheader) {
echo '<a href="read.php?msgid='.urlencode($msgid).
'&group='.urlencode($_GET['group']).
'"><b>'.$msgheader["Subject"].'</b></a><br>';
echo 'from:&nbsp;'.$msgheader["From"]."<br>";
echo $msgheader["Date"].'<br><br>';
}
}
} else {
echo '<font color="red">No newsgroup choosed!</font><br>' ;
}
$nntp->quit();
}
?>
</body>
</html>

View File

@@ -1,52 +0,0 @@
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alexander Merz <alexmerz@php.net> |
// | Heino H. Gehlsen <heino@gehlsen.dk> |
// +----------------------------------------------------------------------+
//
// $Id: index.php,v 1.2.2.1 2005/01/30 15:44:44 heino Exp $
?>
<html>
<head>
<title>NNTP news.php.net</title>
</head>
<body>
<?php
require_once "Net/NNTP/Client.php";
$nntp = new Net_NNTP_Client();
$ret = $nntp->connect("news.php.net");
if( PEAR::isError($ret)) {
echo '<font color="red">No connection to newsserver!</font><br>' ;
echo $ret->getMessage();
} else {
echo "<h1>Avaible groups</h1>";
$groups = $nntp->getGroups();
$descriptions = $nntp->getDescriptions();
foreach($groups as $group) {
echo '<a href="group.php?group='.urlencode($group['group']).
'&writable='.urlencode($group['posting']).'">'.
$group['group'].'</a>' ;
$msgcount = $group['last']-$group['first'];
echo '&nbsp;('.$msgcount.' messages)<br>';
echo $descriptions[$group['group']].'<br><br>';
}
$nntp->quit();
}
?>
</body>
</html>

View File

@@ -1,64 +0,0 @@
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alexander Merz <alexmerz@php.net> |
// | Heino H. Gehlsen <heino@gehlsen.dk> |
// +----------------------------------------------------------------------+
//
// $Id: read.php,v 1.2.2.1 2005/01/13 20:38:06 heino Exp $
?>
<html>
<head>
<title>NNTP news.php.net</title>
</head>
<body>
<h1>Message</h1>
<?php
require_once "Net/NNTP/Client.php";
$nntp = new Net_NNTP_Client();
$ret = $nntp->connect("news.php.net");
if( PEAR::isError($ret)) {
echo '<font color="red">No connection to newsserver!</font><br>' ;
echo $ret->getMessage();
} else {
if(isset($_GET['msgid']) and isset($_GET['group'])){
$msgdata = $nntp->selectGroup($_GET['group']);
if(PEAR::isError($msgdata)) {
echo '<font color="red">'.$msgdata->getMessage().'</font><br>' ;
} else {
$header = $nntp->getHeaderRaw($_GET['msgid']);
echo '<hr>';
echo '<h2>Header</h2>';
echo '<pre>';
foreach( $header as $line) {
echo $line.'<br>';
}
echo '</pre>';
echo '<hr>';
echo '<h2>Body</h2>';
echo '<form><textarea wrap="off" cols="79", rows="25">'.
$nntp->getBodyRaw($_GET['msgid'], true).
'</textarea></form>';
}
} else {
echo '<font color="red">No message choosed!</font><br>' ;
}
$nntp->quit();
}
?>
</body>
</html>

View File

@@ -1,53 +0,0 @@
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
====
make sure you have enabled default extensions, and if you want faster
downloads, enable the zlib extension. You must also enable the CLI
SAPI with the --enable-cli extension directive. After this, simply run:
make install-pear
and PEAR will be automatically configured for you.
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://go-pear.org 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!
$Id: INSTALL,v 1.1 2006/09/22 03:31:36 cellog Exp $

View File

@@ -1,32 +0,0 @@
PEAR - The PEAR Installer
=========================
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.
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.
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.
Happy PHPing, we hope PEAR will be a great tool for your development work!
$Id: README,v 1.11 2006/09/22 03:31:36 cellog Exp $

View File

@@ -1,8 +0,0 @@
#!/bin/sh
(cd ..; tar czf docs/arch.tgz "{arch}")
rm -Rf "../{arch}"
rm -Rf ./html
mkdir -p ./html
phpdoc --directory ../Structures,./tutorials --target ./html --title "Structures_Graph Documentation" --output "HTML:frames" --defaultpackagename structures_graph --defaultcategoryname structures --pear
(cd ..; tar --absolute-names -xzf docs/arch.tgz)
#rm arch.tgz

View File

@@ -1,243 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Structures_Graph</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Structures_Graph</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The Structures_Graph class represents a graph data structure.</p>
<p class="description"><p>A Graph is a data structure composed by a set of nodes, connected by arcs. Graphs may either be directed or undirected. In a directed graph, arcs are directional, and can be traveled only one way. In an undirected graph, arcs are bidirectional, and can be traveled both ways.</p></p>
<ul class="tags">
<li><span class="field">copyright:</span> (c) 2004 by Sérgio Carvalho</li>
<li><span class="field">author:</span> Sérgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
</ul>
<p class="notes">
Located in <a class="field" href="_Structures_Graph_php.html">/Structures/Graph.php</a> (line <span class="field">56</span>)
</p>
<pre></pre>
</div>
</div>
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Structures_Graph</span>
<a href="#Structures_Graph" title="details" class="method-name">Structures_Graph</a>
([<span class="var-type">boolean</span>&nbsp;<span class="var-name">$directed</span> = <span class="var-default">true</span>])
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#addNode" title="details" class="method-name">addNode</a>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$newNode</span>)
</div>
<div class="method-definition">
<span class="method-result">array</span>
<a href="#getNodes" title="details" class="method-name">&amp;getNodes</a>
()
</div>
<div class="method-definition">
<span class="method-result">boolean</span>
<a href="#isDirected" title="details" class="method-name">isDirected</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#removeNode" title="details" class="method-name">removeNode</a>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$node</span>)
</div>
</div>
</div>
</div>
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodStructures_Graph" id="Structures_Graph"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Structures_Graph</span> (line <span class="line-number">76</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constructor</p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">Structures_Graph</span>
<span class="method-name">
Structures_Graph
</span>
([<span class="var-type">boolean</span>&nbsp;<span class="var-name">$directed</span> = <span class="var-default">true</span>])
</div>
<ul class="parameters">
<li>
<span class="var-type">boolean</span>
<span class="var-name">$directed</span><span class="var-description">: Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true)</span> </li>
</ul>
</div>
<a name="methodaddNode" id="addNode"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">addNode</span> (line <span class="line-number">102</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Add a Node to the Graph</p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
addNode
</span>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$newNode</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>
<span class="var-name">&$newNode</span><span class="var-description">: The node to be added.</span> </li>
</ul>
</div>
<a name="methodgetNodes" id="getNodes"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">getNodes</span> (line <span class="line-number">151</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.</p>
<ul class="tags">
<li><span class="field">return:</span> The set of nodes in this graph</li>
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">array</span>
<span class="method-name">
&amp;getNodes
</span>
()
</div>
</div>
<a name="methodisDirected" id="isDirected"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">isDirected</span> (line <span class="line-number">89</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Return true if a graph is directed</p>
<ul class="tags">
<li><span class="field">return:</span> true if the graph is directed</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">boolean</span>
<span class="method-name">
isDirected
</span>
()
</div>
</div>
<a name="methodremoveNode" id="removeNode"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">removeNode</span> (line <span class="line-number">138</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Remove a Node from the Graph</p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
<li><span class="field">todo:</span> This is unimplemented</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
removeNode
</span>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$node</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>
<span class="var-name">&$node</span><span class="var-description">: The node to be removed from the graph</span> </li>
</ul>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Structures_Graph_Manipulator_AcyclicTest</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Structures_Graph_Manipulator_AcyclicTest</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle.</p>
<p class="description"><p>The definition of an acyclic graph used in this manipulator is that of a DAG. The graph must be directed, or else it is considered cyclic, even when there are no arcs.</p></p>
<ul class="tags">
<li><span class="field">copyright:</span> (c) 2004 by Sérgio Carvalho</li>
<li><span class="field">author:</span> Sérgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
</ul>
<p class="notes">
Located in <a class="field" href="_Structures_Graph_Manipulator_AcyclicTest_php.html">/Structures/Graph/Manipulator/AcyclicTest.php</a> (line <span class="field">55</span>)
</p>
<pre></pre>
</div>
</div>
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">boolean</span>
<a href="#isAcyclic" title="details" class="method-name">isAcyclic</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
</div>
</div>
</div>
</div>
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodisAcyclic" id="isAcyclic"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">isAcyclic</span> (line <span class="line-number">126</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">isAcyclic returns true if a graph contains no cycles, false otherwise.</p>
<ul class="tags">
<li><span class="field">return:</span> true iff graph is acyclic</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">boolean</span>
<span class="method-name">
isAcyclic
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Structures_Graph_Manipulator_TopologicalSorter</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Structures_Graph_Manipulator_TopologicalSorter</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order.</p>
<p class="description"><p>A graph may only be sorted topologically iff it's a DAG. You can test it with the Structures_Graph_Manipulator_AcyclicTest.</p></p>
<ul class="tags">
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li>
<li><span class="field">copyright:</span> (c) 2004 by Sérgio Carvalho</li>
<li><span class="field">author:</span> Sérgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
</ul>
<p class="notes">
Located in <a class="field" href="_Structures_Graph_Manipulator_TopologicalSorter_php.html">/Structures/Graph/Manipulator/TopologicalSorter.php</a> (line <span class="field">58</span>)
</p>
<pre></pre>
</div>
</div>
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">array</span>
<a href="#sort" title="details" class="method-name">sort</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
</div>
</div>
</div>
</div>
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodsort" id="sort"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">sort</span> (line <span class="line-number">133</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">sort returns the graph's nodes, sorted by topological order.</p>
<p class="description"><p>The result is an array with as many entries as topological levels. Each entry in this array is an array of nodes within the given topological level.</p></p>
<ul class="tags">
<li><span class="field">return:</span> The graph's nodes, sorted by topological order.</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">array</span>
<span class="method-name">
sort
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,549 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Structures_Graph_Node</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Structures_Graph_Node</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The Structures_Graph_Node class represents a Node that can be member of a graph node set.</p>
<p class="description"><p>A graph node can contain data. Under this API, the node contains default data, and key index data. It behaves, thus, both as a regular data node, and as a dictionary (or associative array) node.</p><p>Regular data is accessed via getData and setData. Key indexed data is accessed via getMetadata and setMetadata.</p></p>
<ul class="tags">
<li><span class="field">copyright:</span> (c) 2004 by Sérgio Carvalho</li>
<li><span class="field">author:</span> Sérgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
</ul>
<p class="notes">
Located in <a class="field" href="_Structures_Graph_Node_php.html">/Structures/Graph/Node.php</a> (line <span class="field">57</span>)
</p>
<pre></pre>
</div>
</div>
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Structures_Graph_Node</span>
<a href="#Structures_Graph_Node" title="details" class="method-name">Structures_Graph_Node</a>
()
</div>
<div class="method-definition">
<span class="method-result">boolean</span>
<a href="#connectsTo" title="details" class="method-name">connectsTo</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$target</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#connectTo" title="details" class="method-name">connectTo</a>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$destinationNode</span>)
</div>
<div class="method-definition">
<span class="method-result">mixed</span>
<a href="#getData" title="details" class="method-name">&amp;getData</a>
()
</div>
<div class="method-definition">
<span class="method-result"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
<a href="#getGraph" title="details" class="method-name">&amp;getGraph</a>
()
</div>
<div class="method-definition">
<span class="method-result">mixed</span>
<a href="#getMetadata" title="details" class="method-name">&amp;getMetadata</a>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">boolean</span>&nbsp;<span class="var-name">$nullIfNonexistent</span> = <span class="var-default">false</span>])
</div>
<div class="method-definition">
<span class="method-result">array</span>
<a href="#getNeighbours" title="details" class="method-name">getNeighbours</a>
()
</div>
<div class="method-definition">
<span class="method-result">integer</span>
<a href="#inDegree" title="details" class="method-name">inDegree</a>
()
</div>
<div class="method-definition">
<span class="method-result">boolean</span>
<a href="#metadataKeyExists" title="details" class="method-name">metadataKeyExists</a>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
</div>
<div class="method-definition">
<span class="method-result">integer</span>
<a href="#outDegree" title="details" class="method-name">outDegree</a>
()
</div>
<div class="method-definition">
<span class="method-result">mixed</span>
<a href="#setData" title="details" class="method-name">setData</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setGraph" title="details" class="method-name">setGraph</a>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$graph</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setMetadata" title="details" class="method-name">setMetadata</a>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#unsetMetadata" title="details" class="method-name">unsetMetadata</a>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
</div>
</div>
</div>
</div>
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodStructures_Graph_Node" id="Structures_Graph_Node"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Structures_Graph_Node</span> (line <span class="line-number">78</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constructor</p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">Structures_Graph_Node</span>
<span class="method-name">
Structures_Graph_Node
</span>
()
</div>
</div>
<a name="methodconnectsTo" id="connectsTo"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">connectsTo</span> (line <span class="line-number">275</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Test wether this node has an arc to the target node</p>
<ul class="tags">
<li><span class="field">return:</span> True if the two nodes are connected</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">boolean</span>
<span class="method-name">
connectsTo
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$target</span>)
</div>
</div>
<a name="methodconnectTo" id="connectTo"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">connectTo</span> (line <span class="line-number">236</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Connect this node to another one.</p>
<p class="description"><p>If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.</p></p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
connectTo
</span>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$destinationNode</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
<span class="var-name">&$destinationNode</span><span class="var-description">: Node to connect to</span> </li>
</ul>
</div>
<a name="methodgetData" id="getData"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">getData</span> (line <span class="line-number">119</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node data getter.</p>
<p class="description"><p>Each graph node can contain a reference to one variable. This is the getter for that reference.</p></p>
<ul class="tags">
<li><span class="field">return:</span> Data stored in node</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">mixed</span>
<span class="method-name">
&amp;getData
</span>
()
</div>
</div>
<a name="methodgetGraph" id="getGraph"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">getGraph</span> (line <span class="line-number">90</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node graph getter</p>
<ul class="tags">
<li><span class="field">return:</span> Graph where node is stored</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
<span class="method-name">
&amp;getGraph
</span>
()
</div>
</div>
<a name="methodgetMetadata" id="getMetadata"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">getMetadata</span> (line <span class="line-number">171</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node metadata getter</p>
<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method gets the data under the given key. If the key does not exist, an error will be thrown, so testing using metadataKeyExists might be needed.</p></p>
<ul class="tags">
<li><span class="field">return:</span> Metadata Data stored in node under given key</li>
<li><span class="field">access:</span> public</li>
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Node.html#methodmetadataKeyExists">Structures_Graph_Node::metadataKeyExists()</a></li>
</ul>
<div class="method-signature">
<span class="method-result">mixed</span>
<span class="method-name">
&amp;getMetadata
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">boolean</span>&nbsp;<span class="var-name">$nullIfNonexistent</span> = <span class="var-default">false</span>])
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$key</span><span class="var-description">: Key</span> </li>
<li>
<span class="var-type">boolean</span>
<span class="var-name">$nullIfNonexistent</span><span class="var-description">: nullIfNonexistent (defaults to false).</span> </li>
</ul>
</div>
<a name="methodgetNeighbours" id="getNeighbours"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">getNeighbours</span> (line <span class="line-number">262</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Return nodes connected to this one.</p>
<ul class="tags">
<li><span class="field">return:</span> Array of nodes</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">array</span>
<span class="method-name">
getNeighbours
</span>
()
</div>
</div>
<a name="methodinDegree" id="inDegree"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">inDegree</span> (line <span class="line-number">309</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Calculate the in degree of the node.</p>
<p class="description"><p>The indegree for a node is the number of arcs entering the node. For non directed graphs, the indegree is equal to the outdegree.</p></p>
<ul class="tags">
<li><span class="field">return:</span> In degree of the node</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">integer</span>
<span class="method-name">
inDegree
</span>
()
</div>
</div>
<a name="methodmetadataKeyExists" id="metadataKeyExists"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">metadataKeyExists</span> (line <span class="line-number">151</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Test for existence of metadata under a given key.</p>
<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method tests whether a given metadata key exists for this node.</p></p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">boolean</span>
<span class="method-name">
metadataKeyExists
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$key</span><span class="var-description">: Key to test</span> </li>
</ul>
</div>
<a name="methodoutDegree" id="outDegree"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">outDegree</span> (line <span class="line-number">333</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Calculate the out degree of the node.</p>
<p class="description"><p>The outdegree for a node is the number of arcs exiting the node. For non directed graphs, the outdegree is always equal to the indegree.</p></p>
<ul class="tags">
<li><span class="field">return:</span> Out degree of the node</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">integer</span>
<span class="method-name">
outDegree
</span>
()
</div>
</div>
<a name="methodsetData" id="setData"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">setData</span> (line <span class="line-number">134</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node data setter</p>
<p class="description"><p>Each graph node can contain a reference to one variable. This is the setter for that reference.</p></p>
<ul class="tags">
<li><span class="field">return:</span> Data to store in node</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">mixed</span>
<span class="method-name">
setData
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
</div>
</div>
<a name="methodsetGraph" id="setGraph"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setGraph</span> (line <span class="line-number">104</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node graph setter. This method should not be called directly. Use Graph::addNode instead.</p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph.html#methodaddNode">Structures_Graph::addNode()</a></li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setGraph
</span>
(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$graph</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
<span class="var-name">&$graph</span><span class="var-description">: Set the graph for this node.</span> </li>
</ul>
</div>
<a name="methodsetMetadata" id="setMetadata"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">setMetadata</span> (line <span class="line-number">214</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Node metadata setter</p>
<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method stores data under the given key. If the key already exists, previously stored data is discarded.</p></p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setMetadata
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$key</span><span class="var-description">: Key</span> </li>
<li>
<span class="var-type">mixed</span>
<span class="var-name">$data</span><span class="var-description">: Data</span> </li>
</ul>
</div>
<a name="methodunsetMetadata" id="unsetMetadata"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">unsetMetadata</span> (line <span class="line-number">196</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Delete metadata by key</p>
<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method removes any data that might be stored under the provided key. If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.</p></p>
<ul class="tags">
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
unsetMetadata
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$key</span><span class="var-description">: Key</span> </li>
</ul>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,119 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page AcyclicTest.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Structures/Graph/Manipulator/AcyclicTest.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This file contains the definition of the Structures_Graph_Manipulator_AcyclicTest graph manipulator.</p>
<ul class="tags">
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a>
</td>
<td>
The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle.
</td>
</tr>
</table>
</div>
</div>
<a name="sec-includes"></a>
<div class="info-box">
<div class="info-box-title">Includes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Includes</span>
</div>
<div class="info-box-body">
<a name="_PEAR_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name">'PEAR.php'</span>)
(line <span class="line-number">35</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
(line <span class="line-number">37</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph/Node_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
(line <span class="line-number">39</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page TopologicalSorter.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Structures/Graph/Manipulator/TopologicalSorter.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This file contains the definition of the Structures_Graph_Manipulator_TopologicalSorter class.</p>
<ul class="tags">
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a>
</td>
<td>
The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order.
</td>
</tr>
</table>
</div>
</div>
<a name="sec-includes"></a>
<div class="info-box">
<div class="info-box-title">Includes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Includes</span>
</div>
<div class="info-box-body">
<a name="_PEAR_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name">'PEAR.php'</span>)
(line <span class="line-number">35</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
(line <span class="line-number">37</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph/Node_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
(line <span class="line-number">39</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph/Manipulator/AcyclicTest_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html">'Structures/Graph/Manipulator/AcyclicTest.php'</a></span>)
(line <span class="line-number">41</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page Node.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Structures/Graph/Node.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This file contains the definition of the Structures_Graph_Node class</p>
<ul class="tags">
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a>
</td>
<td>
The Structures_Graph_Node class represents a Node that can be member of a graph node set.
</td>
</tr>
</table>
</div>
</div>
<a name="sec-includes"></a>
<div class="info-box">
<div class="info-box-title">Includes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Includes</span>
</div>
<div class="info-box-body">
<a name="_PEAR_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name">'PEAR.php'</span>)
(line <span class="line-number">35</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_Structures/Graph_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
(line <span class="line-number">37</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,136 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page Graph.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Structures/Graph.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
| <a href="#sec-constants">Constants</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The Graph.php file contains the definition of the Structures_Graph class</p>
<ul class="tags">
<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-includes">Includes</a>
| <a href="#sec-constants">Constants</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a>
</td>
<td>
The Structures_Graph class represents a graph data structure.
</td>
</tr>
</table>
</div>
</div>
<a name="sec-includes"></a>
<div class="info-box">
<div class="info-box-title">Includes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Includes</span>
| <a href="#sec-constants">Constants</a>
</div>
<div class="info-box-body">
<a name="_Structures/Graph/Node_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
(line <span class="line-number">37</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Graph Node</p>
</div>
<a name="_PEAR_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name">'PEAR.php'</span>)
(line <span class="line-number">35</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">PEAR base classes</p>
</div>
</div>
</div>
<a name="sec-constants"></a>
<div class="info-box">
<div class="info-box-title">Constants</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
| <span class="disabled">Constants</span>
</div>
<div class="info-box-body">
<a name="defineSTRUCTURES_GRAPH_ERROR_GENERIC"><!-- --></a>
<div class="oddrow">
<div>
<span class="const-title">
<span class="const-name">STRUCTURES_GRAPH_ERROR_GENERIC</span> = 100
(line <span class="line-number">40</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Structures_Graph Tutorial</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<div><a name="package.database.structures_graph.tutorial"></a><div class="ref-title-box"><h1 class="ref-title">Structures_Graph Tutorial</h1>
<h2 class="ref-purpose">A first tour of graph datastructure manipulation</h2></div>
<span><a name="package.database.structures_graph.tutorial.intro"></a><h2 class="title">Introduction</h2><p>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.</p>
<p>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.</p></span>
<span><a name="package.database.structures_graph.tutorial.creation"></a><h2 class="title">Creating a Graph</h2><p>Creating a graph is done using the simple constructor:
<pre class="listing"><pre>
require_once 'Structures/Graph.php';
$directedGraph =&amp; new Structures_Graph(true);
$nonDirectedGraph =&amp; new Structures_Graph(false);
</pre></pre>
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.</p>
<p>To fill out the graph, we'll need to create some nodes, and then call Graph::addNode.
<pre class="listing"><pre>
require_once 'Structures/Graph/Node.php';
$nodeOne =&amp; new Structures_Graph_Node();
$nodeTwo =&amp; new Structures_Graph_Node();
$nodeThree =&amp; new Structures_Graph_Node();
$directedGraph-&gt;addNode(&amp;$nodeOne);
$directedGraph-&gt;addNode(&amp;$nodeTwo);
$directedGraph-&gt;addNode(&amp;$nodeThree);
</pre></pre>
and then setup the arcs:
<pre class="listing"><pre>
$nodeOne-&gt;connectTo($nodeTwo);
$nodeOne-&gt;connectTo($nodeThree);
</pre></pre>
Note that arcs can only be created after the nodes have been inserted into the graph.</p></span>
<span><a name="package.database.structures_graph.tutorial.nodesanddata"></a><h2 class="title">Associating Data</h2><p>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.
<pre class="listing"><pre>
$nodeOne-&gt;setData(&quot;Node One's Data is a String&quot;);
$nodeTwo-&gt;setData(1976);
$nodeThree-&gt;setData('Some other string');
print(&quot;NodeTwo's Data is an integer: &quot; . $nodeTwo-&gt;getData());
</pre></pre></p>
<p>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:
<pre class="listing"><pre>
$nodeOne-&gt;setMetadata('example key', &quot;Node One's Sample Metadata&quot;);
print(&quot;Metadata stored under key 'example key' in node one: &quot; . $nodeOne-&gt;getMetadata('example key'));
$nodeOne-&gt;unsetMetadata('example key');
</pre></pre></p></span>
<span><a name="package.database.structures_graph.tutorial.querying"></a><h2 class="title">Querying a Graph</h2><p>Structures_Graph provides for basic querying of the graph:
<pre class="listing"><pre>
// Nodes are able to calculate their indegree and outdegree
print(&quot;NodeOne's inDegree: &quot; . $nodeOne-&gt;inDegree());
print(&quot;NodeOne's outDegree: &quot; . $nodeOne-&gt;outDegree());
// and naturally, nodes can report on their arcs
$arcs = $nodeOne-&gt;getNeighbours();
for ($i=0;$i&lt;sizeof($arcs);$i++) {
print(&quot;NodeOne has an arc to &quot; . $arcs[$i]-&gt;getData());
}
</pre></pre></p></span></div>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<!-- Start of Class Data -->
<H2>
</H2>
<h2>Root class Structures_Graph</h2>
<ul>
<li><a href="Structures_Graph/Structures_Graph.html">Structures_Graph</a></li></ul>
<h2>Root class Structures_Graph_Manipulator_AcyclicTest</h2>
<ul>
<li><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li></ul>
<h2>Root class Structures_Graph_Manipulator_TopologicalSorter</h2>
<ul>
<li><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li></ul>
<h2>Root class Structures_Graph_Node</h2>
<ul>
<li><a href="Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></li></ul>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More