Classes
JArrayHelper
JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.
JBuffer
Generic Buffer stream handler
This class provides a generic buffer stream. It can be used to store/retrieve/manipulate
string buffers with the standard PHP filesystem I/O methods.
« More » JDate
JDate is a class that stores a date and provides logic to manipulate and render that date in a variety of formats.
JSimpleCrypt
JSimpleCrypt is a very simple encryption algorithm for encrypting/decrypting strings
This class allows for simple but smart objects with get and set methods
and an internal error handler.
« More » JSimpleXML
SimpleXML implementation.
The XML Parser extension (expat) is required to use JSimpleXML.
The class provides a pure PHP4 implementation of the PHP5
interface SimpleXML. As with PHP5's SimpleXML it is what it says:
simple. Nevertheless, it is an easy way to deal with XML data,
especially for read only access.
Because it's not possible to use the PHP5 ArrayIterator interface
with PHP4 there are some differences between this implementation
and that of PHP5:
The access to the root node has to be explicit in
JSimpleXML, not implicit as with PHP5. Write
$xml->document->node instead of $xml->node
You cannot access CDATA using array syntax. Use the method data() instead
You cannot access attributes directly with array syntax. Use attributes()
to read them.
Comments are ignored.
Last and least, this is not as fast as PHP5 SimpleXML--it is pure PHP4.
Example:
<code>
:simple.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document>
<node>
<child gender="m">Tom Foo</child>
<child gender="f">Tamara Bar</child>
<node>
</document>
---
// read and write a document
$xml = new JSimpleXML;
$xml->loadFile('simple.xml');
print $xml->document->toString();
// access a given node's CDATA
print $xml->root->node->child[0]->data(); // Tom Foo
// access attributes
$attr = $xml->root->node->child[1]->attributes();
print $attr['gender']; // f
// access children
foreach($xml->root->node->children() as $child) {
print $child->data();
}
</code>
Note: JSimpleXML cannot be used to access sophisticated XML doctypes
using datatype ANY (e.g. XHTML). With a DOM implementation you can
handle this.
« More » JSimpleXMLElement
SimpleXML Element
This object stores all of the direct children of itself in the $children array.
They are also stored by type as arrays. So, if, for example, this tag had 2 <font>
tags as children, there would be a class member called $font created as an array.
$font[0] would be the first font tag, and $font[1] would be the second.
To loop through all of the direct children of this object, the $children member
should be used.
To loop through all of the direct children of a specific tag for this object, it
is probably easier to use the arrays of the specific tag names, as explained above.
« More »