phpQuery
[ class tree: phpQuery ] [ index: phpQuery ] [ all elements ]

Class: phpQuery

Source Location: /home/bob/workspace/phpQuery/phpQuery/phpQuery.php

Class Overview


Static namespace for phpQuery functions.


Author(s):

Variables

Methods



Class Details

[line 33]
Static namespace for phpQuery functions.



Tags:

author:  Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
abstract:  


[ Top ]


Class Variables

static $active =  0

[line 101]



Tags:

access:  public

Type:   mixed


[ Top ]

static $ajaxAllowedHosts = array(
      '.'
   )

[line 71]

Hosts allowed for AJAX connections.

Dot '.' means $_SERVER['HTTP_HOST'] (if any).




Tags:

access:  public

Type:   array


[ Top ]

static $ajaxSettings = array(
      'url' => '',//TODO
      'global' => true,
      'type' => "GET",
      'timeout' => null,
      'contentType' => "application/x-www-form-urlencoded",
      'processData' => true,
//      'async' => true,
      'data' => null,
      'username' => null,
      'password' => null,
      'accepts' => array(
         'xml' => "application/xml, text/xml",
         'html' => "text/html",
         'script' => "text/javascript, application/javascript",
         'json' => "application/json, text/javascript",
         'text' => "text/plain",
         '_default' => "*/*"
      ))

[line 80]

AJAX settings.



Tags:

var:  XXX should it be static or not ?
access:  public

Type:   array


[ Top ]

static $debug =  false

[line 34]



Tags:

access:  public

Type:   mixed


[ Top ]

static $defaultCharset =  'UTF-8'

[line 45]



Tags:

access:  public

Type:   mixed


[ Top ]

static $defaultDoctype =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">'

[line 43]

Applies only to HTML.



Tags:

access:  public

Type:   unknown_type


[ Top ]

static $defaultDocumentID =  null

[line 36]



Tags:

access:  public

Type:   mixed


[ Top ]

static $documents = array()

[line 35]



Tags:

access:  public

Type:   mixed


[ Top ]

static $dumpCount =  0

[line 102]



Tags:

access:  public

Type:   mixed


[ Top ]

static $extendMethods = array()

[line 60]



Tags:

access:  public

Type:   mixed


[ Top ]

static $extendStaticMethods = array()

[line 64]



Tags:

TODO:  implement
access:  public

Type:   mixed


[ Top ]

static $lastModified =  null

[line 100]



Tags:

access:  public

Type:   mixed


[ Top ]

static $plugins = array()

[line 51]

Static namespace for plugins.



Tags:

access:  public

Type:   object


[ Top ]

static $pluginsLoaded = array()

[line 57]

List of loaded plugins.



Tags:

access:  public

Type:   unknown_type


[ Top ]

static $pluginsMethods = array()

[line 58]



Tags:

access:  public

Type:   mixed


[ Top ]

static $pluginsStaticMethods = array()

[line 59]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


static method ajax [line 583]

static Zend_Http_Client ajax( [array $options = array()], [ $xhr = null])

Make an AJAX request.



Tags:

link:  http://docs.jquery.com/Ajax/jQuery.ajax
TODO:  $options['processData']
TODO:  $options['cache']
TODO:  $options['xhr']
TODO:  $options['data'] as string
TODO:  XHR interface
access:  public


Parameters:

array   $options   See $options http://docs.jquery.com/Ajax/jQuery.ajax#toptions Additional options are: 'document' - document for global events, @see phpQuery::getDocumentID() 'referer' - implemented 'requested_with' - TODO; not implemented (X-Requested-With)
   $xhr  

[ Top ]

static method ajaxAllowHost [line 818]

static void ajaxAllowHost( $host1, [ $host2 = null], [ $host3 = null])



Tags:

access:  public


Parameters:

   $host1  
   $host2  
   $host3  

[ Top ]

static method ajaxAllowURL [line 828]

static void ajaxAllowURL( $url1, [ $url2 = null], [ $url3 = null])



Tags:

access:  public


Parameters:

   $url1  
   $url2  
   $url3  

[ Top ]

static method ajaxSetup [line 812]

static void ajaxSetup( $options)



Tags:

access:  public


Parameters:

   $options  

[ Top ]

static method browser [line 1109]

static phpQueryObject browser( $ajaxSettings $ajaxSettings, $callback $callback, [$param1 $param1 = null], [$param2 $param2 = null], [$param3 $param3 = null])



Tags:

access:  public


Parameters:

$ajaxSettings   $ajaxSettings  
$callback   $callback  
$param1   $param1  
$param2   $param2  
$param3   $param3  

[ Top ]

static method browserGet [line 1074]

static phpQueryObject browserGet( $url $url, $callback $callback, [$param1 $param1 = null], [$param2 $param2 = null], [$param3 $param3 = null])



Tags:

access:  public


Parameters:

$url   $url  
$callback   $callback  
$param1   $param1  
$param2   $param2  
$param3   $param3  

[ Top ]

static method browserPost [line 1092]

static phpQueryObject browserPost( $url $url, $data $data, $callback $callback, [$param1 $param1 = null], [$param2 $param2 = null], [$param3 $param3 = null])



Tags:

access:  public


Parameters:

$url   $url  
$data   $data  
$callback   $callback  
$param1   $param1  
$param2   $param2  
$param3   $param3  

[ Top ]

static method callbackRun [line 985]

static unknown_type callbackRun( $callback $callback, [$params $params = array()], [$paramStructure $paramStructure = null])



Tags:

access:  public


Parameters:

$callback   $callback   Callback
$params   $params  
$paramStructure   $paramStructure  

[ Top ]

static method code [line 1131]

static string code( $type $type, $code $code)



Tags:

access:  public


Parameters:

$type   $type  
$code   $code  

[ Top ]

static method createDocumentWrapper [line 393]

static unknown createDocumentWrapper( unknown_type $html, [ $contentType = null], [ $documentID = null], unknown_type $domId)

Enter description here...



Tags:

return:  New DOM ID
todo:  support passing DOMDocument object from self::loadDocument
todo:  support PHP tags in input
access:  protected


Parameters:

unknown_type   $html  
unknown_type   $domId  
   $contentType  
   $documentID  

[ Top ]

static method debug [line 562]

static void debug( $text)



Tags:

access:  public


Parameters:

   $text  

[ Top ]

static method DOMNodeListToArray [line 543]

static void DOMNodeListToArray( $DOMNodeList)



Tags:

access:  public


Parameters:

   $DOMNodeList  

[ Top ]

static method each [line 935]

static unknown_type each( $object $object, $callback $callback, [ $param1 = null], [ $param2 = null], [ $param3 = null])



Tags:



Parameters:

$object   $object  
$callback   $callback  
   $param1  
   $param2  
   $param3  

[ Top ]

static method extend [line 426]

static unknown_type extend( string|array $target, array $source)

Extend class namespace.



Tags:

TODO:  support string $source
access:  public


Parameters:

string|array   $target  
array   $source  

[ Top ]

static method get [line 771]

static void get( $url, [ $data = null], [ $callback = null], [ $type = null])



Tags:

access:  public


Parameters:

   $url  
   $data  
   $callback  
   $type  

[ Top ]

static method getDocument [line 248]

static phpQueryObject|queryTemplatesFetch|queryTemplatesParse|queryTemplatesPickup getDocument( [unknown_type $id = null])

Returns document with id $id or last used as phpQueryObject.

$id can be retrived via getDocumentID() or getDocumentIDRef(). Chainable.




Tags:

see:  phpQuery::selectDocument()
access:  public


Parameters:

unknown_type   $id  

[ Top ]

static method getDocumentID [line 871]

static string getDocumentID( $source $source)

Returns source's document ID.



Tags:

access:  public


Parameters:

$source   $source   DOMNode|phpQueryObject

[ Top ]

static method getDOMDocument [line 894]

static string getDOMDocument( $source $source)

Get DOMDocument object related to $source.

Returns null if such document doesn't exist.




Tags:

access:  public


Parameters:

$source   $source   DOMNode|phpQueryObject|string

[ Top ]

static method getJSON [line 798]

static void getJSON( $url, [ $data = null], [ $callback = null])



Tags:

access:  public


Parameters:

   $url  
   $data  
   $callback  

[ Top ]

static method grep [line 1039]

static unknown_type grep( $array $array, $callback $callback, [$invert $invert = false])



Tags:



Parameters:

$array   $array  
$callback   $callback  
$invert   $invert  

[ Top ]

static method httpData [line 749]

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



Tags:

access:  protected


Parameters:

   $data  
   $type  
   $options  

[ Top ]

static method inArray [line 925]

static void inArray( $value, $array)



Tags:

access:  public


Parameters:

   $value  
   $array  

[ Top ]

static method isFunction [line 1058]

static unknown_type isFunction( $function $function)



Tags:

TODO:  there are problems with non-static methods, second parameter pass it but doesnt verify is method is really callable
access:  public


Parameters:

$function   $function  

[ Top ]

static method isMarkup [line 559]

static Bool isMarkup( String $input)

Checks if $input is HTML string, which has to start with '<'.



Tags:

deprecated:  
todo:  still used ?
access:  public


Parameters:

String   $input  

[ Top ]

static method loadDocument [line 380]

static phpQueryObject|queryTemplatesFetch|queryTemplatesParse|queryTemplatesPick loadDocument( $document $document)

Reuses existing DOMDocument object.

Chainable.




Tags:

return:  up
access:  public


Parameters:

$document   $document   DOMDocument

[ Top ]

static method makeArray [line 911]

static unknown_type makeArray( $obj)



Tags:



Parameters:

   $obj  

[ Top ]

static method map [line 953]

static void map( $array, $callback, [ $param1 = null], [ $param2 = null], [ $param3 = null])



Tags:

link:  http://docs.jquery.com/Utilities/jQuery.map
access:  public


Parameters:

   $array  
   $callback  
   $param1  
   $param2  
   $param3  

[ Top ]

static method markupToPHP [line 314]

static string markupToPHP( string|phpQueryObject $content)

Converts document markup containing PHP code generated by phpQuery::php() into valid (executable) PHP code syntax.



Tags:

return:  PHP code.
access:  public


Parameters:

string|phpQueryObject   $content  

[ Top ]

static method merge [line 1015]

static void merge( array $one, array $two)

Merge 2 phpQuery objects.



Tags:

todo:  node lists, phpQueryObject
access:  public


Parameters:

array   $one  
array   $two  

[ Top ]

static method newDocument [line 263]

static phpQueryObject|queryTemplatesFetch|queryTemplatesParse|queryTemplatesPickup newDocument( [unknown_type $markup = null], [ $contentType = null])

Creates new document from markup.

Chainable.




Tags:

TODO:  support DOMDocument
access:  public


Parameters:

unknown_type   $markup  
   $contentType  

[ Top ]

static method newDocumentFile [line 354]

static phpQueryObject|queryTemplatesFetch|queryTemplatesParse|queryTemplatesPickup newDocumentFile( string $file, [ $contentType = null])

Creates new document from file $file.

Chainable.




Tags:

access:  public


Parameters:

string   $file   URLs allowed. See File wrapper page at php.net for more supported sources.
   $contentType  

[ Top ]

static method newDocumentFileHTML [line 360]

static void newDocumentFileHTML( $file, [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $file  
   $charset  

[ Top ]

static method newDocumentFilePHP [line 369]

static void newDocumentFilePHP( $file, [ $contentType = null])



Tags:

access:  public


Parameters:

   $file  
   $contentType  

[ Top ]

static method newDocumentFileXHTML [line 366]

static void newDocumentFileXHTML( $file, [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $file  
   $charset  

[ Top ]

static method newDocumentFileXML [line 363]

static void newDocumentFileXML( $file, [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $file  
   $charset  

[ Top ]

static method newDocumentHTML [line 269]

static void newDocumentHTML( [ $markup = null], [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $markup  
   $charset  

[ Top ]

static method newDocumentPHP [line 280]

static void newDocumentPHP( [ $markup = null], [ $contentType = "text/html;charset=utf-8"])



Tags:

access:  public


Parameters:

   $markup  
   $contentType  

[ Top ]

static method newDocumentXHTML [line 277]

static void newDocumentXHTML( [ $markup = null], [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $markup  
   $charset  

[ Top ]

static method newDocumentXML [line 274]

static void newDocumentXML( [ $markup = null], [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $markup  
   $charset  

[ Top ]

static method param [line 768]

static void param( array|phpQuery $data)

Enter description here...



Tags:

access:  public


Parameters:

array|phpQuery   $data  

[ Top ]

static method parseJSON [line 855]

static mixed parseJSON( string $json)

Parses JSON into proper PHP type.



Tags:

access:  public


Parameters:

string   $json  

[ Top ]

static method php [line 1122]

static string php( $code $code)



Tags:

access:  public


Parameters:

$code   $code  

[ Top ]

static method phpToMarkup [line 284]

static void phpToMarkup( $php, [ $charset = 'utf-8'])



Tags:

access:  public


Parameters:

   $php  
   $charset  

[ Top ]

static method plugin [line 463]

static void plugin( string $class, [string $file = null])

Extend phpQuery with $class from $file.



Tags:

access:  public


Parameters:

string   $class   Extending class name. Real class name can be prepended phpQuery_.
string   $file   Filename to include. Defaults to "{$class}.php".

[ Top ]

static method post [line 785]

static void post( $url, [ $data = null], [ $callback = null], [ $type = null])



Tags:

access:  public


Parameters:

   $url  
   $data  
   $callback  
   $type  

[ Top ]

static method pq [line 136]

static phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery|QueryTemplatesPhpQuery|false pq( string|DOMNode|DOMNodeList|array $arg1, [string|phpQueryObject|DOMNode $context = null])

Multi-purpose function.

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('<div/>') // DOESNT accept text nodes at beginning of input string !
  • Import into document with ID from $pq->getDocumentID(): pq('<div/>', $pq->getDocumentID())
  • Import into same document as DOMNode belongs to: pq('<div/>', DOMNode)
  • Import into document from phpQuery object: pq('<div/>', $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)




Tags:

return:  phpQuery object or false in case of error.
access:  public


Parameters:

string|DOMNode|DOMNodeList|array   $arg1   HTML markup, CSS Selector, DOMNode or array of DOMNodes
string|phpQueryObject|DOMNode   $context   DOM ID from $pq->getDocumentID(), phpQuery object (determines also query root) or DOMNode (determines also query root)

[ Top ]

static method selectDocument [line 234]

static void selectDocument( unknown_type $id)

Sets default document to $id. Document has to be loaded prior to using this method.

$id can be retrived via getDocumentID() or getDocumentIDRef().




Tags:

access:  public


Parameters:

unknown_type   $id  

[ Top ]

static method toJSON [line 842]

static string toJSON( mixed $data)

Returns JSON representation of $data.



Tags:

access:  public


Parameters:

mixed   $data  

[ Top ]

static method trim [line 1061]

static void trim( $str)



Tags:

access:  public


Parameters:

   $str  

[ Top ]

static method unique [line 1048]

static void unique( $array)



Tags:

access:  public


Parameters:

   $array  

[ Top ]

static method unloadDocuments [line 523]

static void unloadDocuments( [ $id = null], mixed $documentID)

Unloades all or specified document from memory.



Tags:

access:  public


Parameters:

mixed   $documentID   @see phpQuery::getDocumentID() for supported types.
   $id  

[ Top ]

static method unsafePHPTags [line 540]

static string unsafePHPTags( phpQuery|string $content)

Parses phpQuery object or HTML result against PHP tags and makes them active.



Tags:

deprecated:  
access:  public


Parameters:

phpQuery|string   $content  

[ Top ]

static method __callStatic [line 1135]

static void __callStatic( $method, $params)



Tags:

access:  public


Parameters:

   $method  
   $params  

[ Top ]


Documentation generated on Sat, 07 Mar 2009 12:07:58 +0100 by phpDocumentor 1.4.2