getDocumentID() public static method

Returns source's document ID.
public static getDocumentID ( $source ) : string
$source DOMNode|phpQueryObject
return string
Example #1
0
 /**
  * @see  HtmlComponent
  */
 public function Render()
 {
     // $template =
     $htmltag = $this->getTag();
     $template = WebApplication::getApplication()->getTemplate(get_class($this));
     $qid = \phpQuery::getDocumentID($htmltag);
     $doc = \phpQuery::newDocumentHTML($template);
     $htmltag->replaceWith($doc['body']->html());
     //$htmltag->html($doc['body']->html());
     \phpQuery::selectDocument($qid);
     $this->beforeRender();
     parent::RenderImpl();
     $this->afterRender();
 }
Example #2
0
 /**
  * Enter description here...
  *
  * @param DOMNode|phpQueryObject|string $document
  * @param unknown_type $type
  * @param unknown_type $callback
  *
  * @TODO namespace events
  * @TODO support more than event in $type (space-separated)
  */
 public static function remove($document, $node, $type = null, $callback = null)
 {
     $documentID = phpQuery::getDocumentID($document);
     $eventNode = self::getNode($documentID, $node);
     if (is_object($eventNode) && isset($eventNode->eventHandlers[$type])) {
         if ($callback) {
             foreach ($eventNode->eventHandlers[$type] as $k => $handler) {
                 if ($handler['callback'] == $callback) {
                     unset($eventNode->eventHandlers[$type][$k]);
                 }
             }
         } else {
             unset($eventNode->eventHandlers[$type]);
         }
     }
 }
Example #3
0
 /**
  * Clean up some messes
  */
 function __destruct()
 {
     if ($this->browser->parserType == 'phpquery') {
         $id = phpQuery::getDocumentID($this->parser);
         phpQuery::unloadDocuments($id);
     }
 }