/** * @return \phpQuery\phpQuery */ public function getQuery() { $contentType = NULL; if (isset($this->request->info['content_type'])) { $contentType = static::getContentType($this->request->info['content_type'], $contentType); } return \phpQuery\phpQuery::newDocument($this->body, $contentType); }
/** * * @link http://docs.jquery.com/Utilities/jQuery.map */ public static function map($array, $callback, $param1 = null, $param2 = null, $param3 = null) { $result = array(); $paramStructure = null; if (func_num_args() > 2) { $paramStructure = func_get_args(); $paramStructure = array_slice($paramStructure, 2); } foreach ($array as $v) { $vv = phpQuery::callbackRun($callback, array($v), $paramStructure); // $callbackArgs = $args; // foreach($args as $i => $arg) { // $callbackArgs[$i] = $arg instanceof CallbackParam // ? $v // : $arg; // } // $vv = call_user_func_array($callback, $callbackArgs); if (is_array($vv)) { foreach ($vv as $vvv) { $result[] = $vvv; } } else { if ($vv !== null) { $result[] = $vv; } } } return $result; }
/** * 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]); } } }
public function dumpTree($html = true, $title = true) { $output = $title ? 'DUMP #' . phpQuery::$dumpCount++ . " \n" : ''; $debug = phpQuery::$debug; phpQuery::$debug = false; foreach ($this->stack() as $node) { $output .= $this->__dumpTree($node); } phpQuery::$debug = $debug; print $html ? nl2br(str_replace(' ', ' ', $output)) : $output; return $this; }