PHP Class phpQuery, microweber

Afficher le fichier Open project: microweber/microweber Class Usage Examples

Méthodes publiques

Свойство Type Description
$active
$ajaxAllowedHosts array Dot '.' means $_SERVER['HTTP_HOST'] (if any).
$ajaxSettings array AJAX settings.
$debug
$defaultCharset
$defaultDoctype unknown_type Applies only to HTML.
$defaultDocumentID
$documents
$dumpCount
$extendMethods
$extendStaticMethods
$lastModified
$mbstringSupport boolean XXX: Workaround for mbstring problems.
$plugins object Static namespace for plugins.
$pluginsLoaded unknown_type List of loaded plugins.
$pluginsMethods
$pluginsStaticMethods

Méthodes publiques

Méthode Description
DOMNodeListToArray ( $DOMNodeList )
__callStatic ( $method, $params )
__destruct ( ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery | QueryTemplatesPhpQuery | false Multi-purpose function.
_markupToPHPCallback ( $m )
_phpToMarkupCallback ( $php, $charset = 'utf-8' )
ajax ( $options = [], $xhr = null ) : Zend_Http_Client Make an AJAX request.
ajaxAllowHost ( $host1, $host2 = null, $host3 = null )
ajaxAllowURL ( $url1, $url2 = null, $url3 = null )
ajaxSetup ( $options )
browser ( $ajaxSettings, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
browserGet ( $url, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
browserPost ( $url, $data, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
callbackRun ( $callback, $params = [], $paramStructure = null ) : unknown_type
code ( $type, $code ) : string
data ( $node, $name, $data, $documentID = null )
debug ( $text )
each ( $object, $callback, $param1 = null, $param2 = null, $param3 = null ) : unknown_type
extend ( string | array $target, array $source ) : unknown_type Extend class namespace.
get ( $url, $data = null, $callback = null, $type = null )
getDOMDocument ( $source ) : string Get DOMDocument object related to $source.
getDocument ( unknown_type $id = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Returns document with id $id or last used as phpQueryObject.
getDocumentID ( $source ) : string Returns source's document ID.
getJSON ( $url, $data = null, $callback = null )
grep ( $array, $callback, $invert = false ) : unknown_type
inArray ( $value, $array )
isFunction ( $function ) : unknown_type
isMarkup ( string $input ) : boolean Checks if $input is HTML string, which has to start with '<'.
loadDocument ( $document ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Reuses existing DOMDocument object.
makeArray ( $obj ) : unknown_type
map ( $array, $callback, $param1 = null, $param2 = null, $param3 = null )
markupToPHP ( string | phpQueryObject $content ) : string Converts document markup containing PHP code generated by phpQuery::php() into valid (executable) PHP code syntax.
merge ( array $one, array $two ) Merge 2 phpQuery objects.
newDocument ( unknown_type $markup = null, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentFile ( string $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from file $file.
newDocumentFileHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentFilePHP ( $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentFileXHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentFileXML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentPHP ( unknown_type $markup = null, $contentType = 'text/html' ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentXHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
newDocumentXML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery Creates new document from markup.
param ( array | phpQuery $data ) Enter description here.
parseJSON ( string $json ) : mixed Parses JSON into proper PHP type.
php ( $code ) : string
phpToMarkup ( $php, $charset = 'utf-8' )
plugin ( string $class, string $file = null ) Extend phpQuery with $class from $file.
post ( $url, $data = null, $callback = null, $type = null )
pq ( $arg1, $context = null )
removeData ( $node, $name, $documentID )
selectDocument ( unknown_type $id ) Sets default document to $id. Document has to be loaded prior to using this method.
toJSON ( mixed $data ) : string Returns JSON representation of $data.
trim ( $str )
unique ( $array )
unloadDocuments ( $id = null ) Unloades all or specified document from memory.
unsafePHPTags ( phpQuery | string $content ) : string Parses phpQuery object or HTML result against PHP tags and makes them active.

Méthodes protégées

Méthode Description
createDocumentWrapper ( unknown_type $html, $contentType = null, $documentID = null ) : unknown Enter description here.
dataRemoveNode ( $node, $documentID )
dataSetupNode ( $node, $documentID )
httpData ( $data, $type, $options )

Method Details

DOMNodeListToArray() public static méthode

public static DOMNodeListToArray ( $DOMNodeList )

__callStatic() public static méthode

public static __callStatic ( $method, $params )

__destruct() public méthode

Use pq() as shortcut. In below examples, $pq is any result of pq(); function. 1. Import markup into existing document (without any attaching): - Import into selected document: pq('
') // DOESNT accept text nodes at beginning of input string ! - Import into document with ID from $pq->getDocumentID(): pq('
', $pq->getDocumentID()) - Import into same document as DOMNode belongs to: pq('
', DOMNode) - Import into document from phpQuery object: pq('
', $pq) 2. Run query: - Run query on last selected document: pq('div.myClass') - Run query on document with ID from $pq->getDocumentID(): pq('div.myClass', $pq->getDocumentID()) - Run query on same document as DOMNode belongs to and use node(s)as root for query: pq('div.myClass', DOMNode) - Run query on document from phpQuery object and use object's stack as root node(s) for query: pq('div.myClass', $pq)
public __destruct ( ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery | QueryTemplatesPhpQuery | false
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery | QueryTemplatesPhpQuery | false phpQuery object or false in case of error.

_markupToPHPCallback() public static méthode

public static _markupToPHPCallback ( $m )

_phpToMarkupCallback() public static méthode

public static _phpToMarkupCallback ( $php, $charset = 'utf-8' )

ajax() public static méthode

Make an AJAX request.
public static ajax ( $options = [], $xhr = null ) : Zend_Http_Client
Résultat Zend_Http_Client

ajaxAllowHost() public static méthode

public static ajaxAllowHost ( $host1, $host2 = null, $host3 = null )

ajaxAllowURL() public static méthode

public static ajaxAllowURL ( $url1, $url2 = null, $url3 = null )

ajaxSetup() public static méthode

public static ajaxSetup ( $options )

browser() public static méthode

public static browser ( $ajaxSettings, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$ajaxSettings
$callback
$param1
$param2
$param3
Résultat phpQueryObject

browserGet() public static méthode

public static browserGet ( $url, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$url
$callback
$param1
$param2
$param3
Résultat phpQueryObject

browserPost() public static méthode

public static browserPost ( $url, $data, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$url
$data
$callback
$param1
$param2
$param3
Résultat phpQueryObject

callbackRun() public static méthode

public static callbackRun ( $callback, $params = [], $paramStructure = null ) : unknown_type
$callback Callback
$params
$paramStructure
Résultat unknown_type

code() public static méthode

public static code ( $type, $code ) : string
$type
$code
Résultat string

createDocumentWrapper() protected static méthode

..
protected static createDocumentWrapper ( unknown_type $html, $contentType = null, $documentID = null ) : unknown
$html unknown_type
Résultat unknown New DOM ID

data() public static méthode

public static data ( $node, $name, $data, $documentID = null )

dataRemoveNode() protected static méthode

protected static dataRemoveNode ( $node, $documentID )

dataSetupNode() protected static méthode

protected static dataSetupNode ( $node, $documentID )

debug() public static méthode

public static debug ( $text )

each() public static méthode

public static each ( $object, $callback, $param1 = null, $param2 = null, $param3 = null ) : unknown_type
$object
$callback
Résultat unknown_type

extend() public static méthode

Extend class namespace.
public static extend ( string | array $target, array $source ) : unknown_type
$target string | array
$source array
Résultat unknown_type

get() public static méthode

public static get ( $url, $data = null, $callback = null, $type = null )

getDOMDocument() public static méthode

Returns null if such document doesn't exist.
public static getDOMDocument ( $source ) : string
$source DOMNode|phpQueryObject|string
Résultat string

getDocument() public static méthode

$id can be retrived via getDocumentID() or getDocumentIDRef(). Chainable.
See also: phpQuery::selectDocument()
public static getDocument ( unknown_type $id = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$id unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

getDocumentID() public static méthode

Returns source's document ID.
public static getDocumentID ( $source ) : string
$source DOMNode|phpQueryObject
Résultat string

getJSON() public static méthode

public static getJSON ( $url, $data = null, $callback = null )

grep() public static méthode

public static grep ( $array, $callback, $invert = false ) : unknown_type
$array
$callback
$invert
Résultat unknown_type

httpData() protected static méthode

protected static httpData ( $data, $type, $options )

inArray() public static méthode

public static inArray ( $value, $array )

isFunction() public static méthode

public static isFunction ( $function ) : unknown_type
$function
Résultat unknown_type

isMarkup() public static méthode

Checks if $input is HTML string, which has to start with '<'.
Deprecation:
public static isMarkup ( string $input ) : boolean
$input string
Résultat boolean

loadDocument() public static méthode

Chainable.
public static loadDocument ( $document ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$document DOMDocument
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

makeArray() public static méthode

public static makeArray ( $obj ) : unknown_type
Résultat unknown_type

map() public static méthode

public static map ( $array, $callback, $param1 = null, $param2 = null, $param3 = null )

markupToPHP() public static méthode

Converts document markup containing PHP code generated by phpQuery::php() into valid (executable) PHP code syntax.
public static markupToPHP ( string | phpQueryObject $content ) : string
$content string | phpQueryObject
Résultat string PHP code.

merge() public static méthode

Merge 2 phpQuery objects.
public static merge ( array $one, array $two )
$one array
$two array

newDocument() public static méthode

Chainable.
public static newDocument ( unknown_type $markup = null, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFile() public static méthode

Chainable.
public static newDocumentFile ( string $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$file string URLs allowed. See File wrapper page at php.net for more supported sources.
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileHTML() public static méthode

Chainable.
public static newDocumentFileHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFilePHP() public static méthode

Chainable.
public static newDocumentFilePHP ( $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileXHTML() public static méthode

Chainable.
public static newDocumentFileXHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileXML() public static méthode

Chainable.
public static newDocumentFileXML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentHTML() public static méthode

Chainable.
public static newDocumentHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentPHP() public static méthode

Chainable.
public static newDocumentPHP ( unknown_type $markup = null, $contentType = 'text/html' ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentXHTML() public static méthode

Chainable.
public static newDocumentXHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentXML() public static méthode

Chainable.
public static newDocumentXML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Résultat phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

param() public static méthode

..
public static param ( array | phpQuery $data )
$data array | phpQuery

parseJSON() public static méthode

Parses JSON into proper PHP type.
public static parseJSON ( string $json ) : mixed
$json string
Résultat mixed

php() public static méthode

public static php ( $code ) : string
$code
Résultat string

phpToMarkup() public static méthode

public static phpToMarkup ( $php, $charset = 'utf-8' )

plugin() public static méthode

Extend phpQuery with $class from $file.
public static plugin ( string $class, string $file = null )
$class string Extending class name. Real class name can be prepended phpQuery_.
$file string Filename to include. Defaults to "{$class}.php".

post() public static méthode

public static post ( $url, $data = null, $callback = null, $type = null )

pq() public static méthode

public static pq ( $arg1, $context = null )

removeData() public static méthode

public static removeData ( $node, $name, $documentID )

selectDocument() public static méthode

$id can be retrived via getDocumentID() or getDocumentIDRef().
public static selectDocument ( unknown_type $id )
$id unknown_type

toJSON() public static méthode

Returns JSON representation of $data.
public static toJSON ( mixed $data ) : string
$data mixed
Résultat string

trim() public static méthode

public static trim ( $str )

unique() public static méthode

public static unique ( $array )

unloadDocuments() public static méthode

Unloades all or specified document from memory.
public static unloadDocuments ( $id = null )

unsafePHPTags() public static méthode

Parses phpQuery object or HTML result against PHP tags and makes them active.
Deprecation:
public static unsafePHPTags ( phpQuery | string $content ) : string
$content phpQuery | string
Résultat string

Property Details

$active public_oe static_oe property

public static $active

$ajaxAllowedHosts public_oe static_oe property

Dot '.' means $_SERVER['HTTP_HOST'] (if any).
public static array $ajaxAllowedHosts
Résultat array

$ajaxSettings public_oe static_oe property

AJAX settings.
public static array $ajaxSettings
Résultat array

$debug public_oe static_oe property

public static $debug

$defaultCharset public_oe static_oe property

public static $defaultCharset

$defaultDoctype public_oe static_oe property

Applies only to HTML.
public static unknown_type $defaultDoctype
Résultat unknown_type

$defaultDocumentID public_oe static_oe property

public static $defaultDocumentID

$documents public_oe static_oe property

public static $documents

$dumpCount public_oe static_oe property

public static $dumpCount

$extendMethods public_oe static_oe property

public static $extendMethods

$extendStaticMethods public_oe static_oe property

public static $extendStaticMethods

$lastModified public_oe static_oe property

public static $lastModified

$mbstringSupport public_oe static_oe property

XXX: Workaround for mbstring problems.
public static bool $mbstringSupport
Résultat boolean

$plugins public_oe static_oe property

Static namespace for plugins.
public static object $plugins
Résultat object

$pluginsLoaded public_oe static_oe property

List of loaded plugins.
public static unknown_type $pluginsLoaded
Résultat unknown_type

$pluginsMethods public_oe static_oe property

public static $pluginsMethods

$pluginsStaticMethods public_oe static_oe property

public static $pluginsStaticMethods