/** * Enter description here... * * @param unknown_type $html * @param unknown_type $domId * @return unknown New DOM ID * @todo support PHP tags in input * @todo support passing DOMDocument object from self::loadDocument */ protected static function createDocumentWrapper($html, $contentType = null, $documentID = null) { if (function_exists('domxml_open_mem')) { throw new Exception("Old PHP4 DOM XML extension detected. pQuery won't work until this extension is enabled."); } // $id = $documentID // ? $documentID // : md5(microtime()); $document = null; if ($html instanceof DOMDOCUMENT) { if (self::getDocumentID($html)) { // document already exists in pQuery::$documents, make a copy $document = clone $html; } else { // new document, add it to pQuery::$documents $wrapper = new DOMDocumentWrapper($html, $contentType, $documentID); } } else { $wrapper = new DOMDocumentWrapper($html, $contentType, $documentID); } // $wrapper->id = $id; // bind document pQuery::$documents[$wrapper->id] = $wrapper; // remember last loaded document pQuery::selectDocument($wrapper->id); return $wrapper->id; }