function __construct($uri) { parent::__construct($uri); $this->type = "search"; }
} else { $offset = 0; } if ($_REQUEST['format']) { $format = $_REQUEST['format']; } else { if ($_REQUEST['relation']) { $format = $config["entities"][$_REQUEST['relation']]["record_types"][0]; } else { $format = $config["entities"][$_REQUEST['resource']]["record_types"][0]; } } if ($search) { $j = new JangleSearch($request_uri); } else { $j = new JangleFeed($request_uri); } if ($_REQUEST["id"]) { if ($_REQUEST["relation"]) { if ($_REQUEST["category"]) { $entries = $resources->relationFindByFilter($_REQUEST["id"], $_REQUEST["relation"], $_REQUEST["category"], $offset, $format); $j->setTotalResults($resources->relationFilterCount($_REQUEST["id"], $_REQUEST["relation"], $_REQUEST["category"])); $j->addCategory($_REQUEST['category']); } else { $entries = $resources->relationFind($_REQUEST["id"], $_REQUEST["relation"], $offset, $format); if (count($entries) == 0) { header("HTTP/1.1 404 Not Found"); exit; } $j->setTotalResults($resources->relationCount($_REQUEST["id"], $_REQUEST["relation"])); }
function toXML() { $xml = parent::toXML(); $doc = new DOMDocument(); $doc->loadXML($xml); foreach ($doc->getElementsByTagName("feed") as $root) { $osNamespace = $doc->createAttribute("xmlns:opensearch"); $root->appendChild($osNamespace); $osNamespaceValue = $doc->createTextNode("http://a9.com/-/spec/opensearch/1.1/"); $osNamespace->appendChild($osNamespaceValue); $totalResults = $doc->createElement("opensearch:totalResults", $this->totalResults); $root->appendChild($totalResults); $startIndex = $doc->createElement("opensearch:startIndex", $this->offset); $root->appendChild($startIndex); $itemsPerPage = $doc->createElement("opensearch:itemsPerPage", count($this->data)); $root->appendChild($itemsPerPage); $query = $doc->createElement("opensearch:Query"); $root->appendChild($query); $role = $doc->createAttribute("role"); $query->appendChild($role); $role->appendChild($doc->createTextNode("request")); $terms = $doc->createAttribute("searchTerms"); $query->appendChild($terms); $terms->appendChild($doc->createTextNode($this->query)); $si = $doc->createAttribute("startIndex"); $query->appendChild($si); $si->appendChild($doc->createTextNode("0")); } return $doc->saveXML(); }