VERSION
VERSION
The version string for this version of QueryPath.
Standard releases will be of the following form:
Examples:
- 2.0
- 2.1.1
- 2.0-alpha1
Developer releases will always be of the form dev-
HTML_STUB
This is a stub HTML 4.01 document.
Using QueryPath::XHTML_STUB is preferred.
This is primarily for generating legacy HTML content. Modern web applications should use QueryPath::XHTML_STUB.
Use this stub with the HTML familiy of methods (QueryPath::Query::html(), QueryPath::Query::writeHTML(), QueryPath::Query::innerHTML()).
XHTML_STUB
This is a stub XHTML document.
Since XHTML is an XML format, you should use XML functions with this document fragment. For example, you should use \xml(), \innerXML(), and \writeXML().
This can be passed into qp() to begin a new basic HTML document.
Example:
withHTML5(mixed $source = NULL, string $selector = NULL, array $options = array()) : \QueryPath
Parse HTML5 documents.
This uses HTML5-PHP to parse the document. In actuality, this parser does a fine job with pre-HTML5 documents in most cases, though really old HTML (like 2.0) may have some substantial quirks.
Supported Options Any options supported by HTML5-PHP are allowed here. Additionally, the following options have meaning to QueryPath.
mixed | $source | A document as an HTML string, or a path/URL. For compatibility with existing functions, a DOMDocument, SimpleXMLElement, DOMNode or array of DOMNodes will be passed through as well. However, these types are not validated in any way. |
string | $selector | A CSS3 selector. |
array | $options | An associative array of options, which is passed on into HTML5-PHP. Note that the standard QueryPath options may be ignored for this function, since it uses a different parser. |
enable(mixed $extensionNames)
Enable one or more extensions.
Extensions provide additional features to QueryPath. To enable and extension, you can use this method.
In this example, we enable the QPTPL extension:
mixed | $extensionNames | The name of an extension or an array of extension names. QueryPath assumes that these are extension class names, and attempts to register these as QueryPath extensions. |
encodeDataURL(mixed $data, string $mime = 'application/octet-stream', resource $context = NULL) : \An
A static function for transforming data into a Data URL.
This can be used to create Data URLs for injection into CSS, JavaScript, or other non-XML/HTML content. If you are working with QP objects, you may want to use dataURL() instead.
mixed | $data | The contents to inject as the data. The value can be any one of the following:
|
string | $mime | The MIME type of the document. |
resource | $context | A valid context. Use this only if you need to pass a stream context. This is only necessary if $data is a URL. (See {@link stream_context_create()}). |
encoded data URL.