PHP Класс phpQuery, microweber

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
createDocumentWrapper ( unknown_type $html, $contentType = null, $documentID = null ) : unknown Enter description here.
dataRemoveNode ( $node, $documentID )
dataSetupNode ( $node, $documentID )
httpData ( $data, $type, $options )

Описание методов

DOMNodeListToArray() публичный статический Метод

public static DOMNodeListToArray ( $DOMNodeList )

__callStatic() публичный статический Метод

public static __callStatic ( $method, $params )

__destruct() публичный Метод

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
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery | QueryTemplatesPhpQuery | false phpQuery object or false in case of error.

_markupToPHPCallback() публичный статический Метод

public static _markupToPHPCallback ( $m )

_phpToMarkupCallback() публичный статический Метод

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

ajax() публичный статический Метод

Make an AJAX request.
public static ajax ( $options = [], $xhr = null ) : Zend_Http_Client
Результат Zend_Http_Client

ajaxAllowHost() публичный статический Метод

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

ajaxAllowURL() публичный статический Метод

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

ajaxSetup() публичный статический Метод

public static ajaxSetup ( $options )

browser() публичный статический Метод

public static browser ( $ajaxSettings, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$ajaxSettings
$callback
$param1
$param2
$param3
Результат phpQueryObject

browserGet() публичный статический Метод

public static browserGet ( $url, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$url
$callback
$param1
$param2
$param3
Результат phpQueryObject

browserPost() публичный статический Метод

public static browserPost ( $url, $data, $callback, $param1 = null, $param2 = null, $param3 = null ) : phpQueryObject
$url
$data
$callback
$param1
$param2
$param3
Результат phpQueryObject

callbackRun() публичный статический Метод

public static callbackRun ( $callback, $params = [], $paramStructure = null ) : unknown_type
$callback Callback
$params
$paramStructure
Результат unknown_type

code() публичный статический Метод

public static code ( $type, $code ) : string
$type
$code
Результат string

createDocumentWrapper() защищенный статический Метод

..
protected static createDocumentWrapper ( unknown_type $html, $contentType = null, $documentID = null ) : unknown
$html unknown_type
Результат unknown New DOM ID

data() публичный статический Метод

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

dataRemoveNode() защищенный статический Метод

protected static dataRemoveNode ( $node, $documentID )

dataSetupNode() защищенный статический Метод

protected static dataSetupNode ( $node, $documentID )

debug() публичный статический Метод

public static debug ( $text )

each() публичный статический Метод

public static each ( $object, $callback, $param1 = null, $param2 = null, $param3 = null ) : unknown_type
$object
$callback
Результат unknown_type

extend() публичный статический Метод

Extend class namespace.
public static extend ( string | array $target, array $source ) : unknown_type
$target string | array
$source array
Результат unknown_type

get() публичный статический Метод

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

getDOMDocument() публичный статический Метод

Returns null if such document doesn't exist.
public static getDOMDocument ( $source ) : string
$source DOMNode|phpQueryObject|string
Результат string

getDocument() публичный статический Метод

$id can be retrived via getDocumentID() or getDocumentIDRef(). Chainable.
См. также: phpQuery::selectDocument()
public static getDocument ( unknown_type $id = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$id unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

getDocumentID() публичный статический Метод

Returns source's document ID.
public static getDocumentID ( $source ) : string
$source DOMNode|phpQueryObject
Результат string

getJSON() публичный статический Метод

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

grep() публичный статический Метод

public static grep ( $array, $callback, $invert = false ) : unknown_type
$array
$callback
$invert
Результат unknown_type

httpData() защищенный статический Метод

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

inArray() публичный статический Метод

public static inArray ( $value, $array )

isFunction() публичный статический Метод

public static isFunction ( $function ) : unknown_type
$function
Результат unknown_type

isMarkup() публичный статический Метод

Checks if $input is HTML string, which has to start with '<'.
Устаревший:
public static isMarkup ( string $input ) : boolean
$input string
Результат boolean

loadDocument() публичный статический Метод

Chainable.
public static loadDocument ( $document ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$document DOMDocument
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

makeArray() публичный статический Метод

public static makeArray ( $obj ) : unknown_type
Результат unknown_type

map() публичный статический Метод

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

markupToPHP() публичный статический Метод

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
Результат string PHP code.

merge() публичный статический Метод

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

newDocument() публичный статический Метод

Chainable.
public static newDocument ( unknown_type $markup = null, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFile() публичный статический Метод

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.
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileHTML() публичный статический Метод

Chainable.
public static newDocumentFileHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFilePHP() публичный статический Метод

Chainable.
public static newDocumentFilePHP ( $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileXHTML() публичный статический Метод

Chainable.
public static newDocumentFileXHTML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentFileXML() публичный статический Метод

Chainable.
public static newDocumentFileXML ( $file, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentHTML() публичный статический Метод

Chainable.
public static newDocumentHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentPHP() публичный статический Метод

Chainable.
public static newDocumentPHP ( unknown_type $markup = null, $contentType = 'text/html' ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentXHTML() публичный статический Метод

Chainable.
public static newDocumentXHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

newDocumentXML() публичный статический Метод

Chainable.
public static newDocumentXML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
Результат phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery

param() публичный статический Метод

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

parseJSON() публичный статический Метод

Parses JSON into proper PHP type.
public static parseJSON ( string $json ) : mixed
$json string
Результат mixed

php() публичный статический Метод

public static php ( $code ) : string
$code
Результат string

phpToMarkup() публичный статический Метод

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

plugin() публичный статический Метод

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 post ( $url, $data = null, $callback = null, $type = null )

pq() публичный статический Метод

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

removeData() публичный статический Метод

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

selectDocument() публичный статический Метод

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

toJSON() публичный статический Метод

Returns JSON representation of $data.
public static toJSON ( mixed $data ) : string
$data mixed
Результат string

trim() публичный статический Метод

public static trim ( $str )

unique() публичный статический Метод

public static unique ( $array )

unloadDocuments() публичный статический Метод

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

unsafePHPTags() публичный статический Метод

Parses phpQuery object or HTML result against PHP tags and makes them active.
Устаревший:
public static unsafePHPTags ( phpQuery | string $content ) : string
$content phpQuery | string
Результат string

Описание свойств

$active публичное статическое свойство

public static $active

$ajaxAllowedHosts публичное статическое свойство

Dot '.' means $_SERVER['HTTP_HOST'] (if any).
public static array $ajaxAllowedHosts
Результат array

$ajaxSettings публичное статическое свойство

AJAX settings.
public static array $ajaxSettings
Результат array

$debug публичное статическое свойство

public static $debug

$defaultCharset публичное статическое свойство

public static $defaultCharset

$defaultDoctype публичное статическое свойство

Applies only to HTML.
public static unknown_type $defaultDoctype
Результат unknown_type

$defaultDocumentID публичное статическое свойство

public static $defaultDocumentID

$documents публичное статическое свойство

public static $documents

$dumpCount публичное статическое свойство

public static $dumpCount

$extendMethods публичное статическое свойство

public static $extendMethods

$extendStaticMethods публичное статическое свойство

public static $extendStaticMethods

$lastModified публичное статическое свойство

public static $lastModified

$mbstringSupport публичное статическое свойство

XXX: Workaround for mbstring problems.
public static bool $mbstringSupport
Результат boolean

$plugins публичное статическое свойство

Static namespace for plugins.
public static object $plugins
Результат object

$pluginsLoaded публичное статическое свойство

List of loaded plugins.
public static unknown_type $pluginsLoaded
Результат unknown_type

$pluginsMethods публичное статическое свойство

public static $pluginsMethods

$pluginsStaticMethods публичное статическое свойство

public static $pluginsStaticMethods