/** * Forwarder to fDOMXPath's prepare method allowing for easy and secure * placeholder replacement comparable to sql's prepared statements * . * @param string $xpath String containing xpath with :placeholder markup * @param array $valueMap Array containing keys (:placeholder) and value pairs to be quoted * * @return string */ public function prepareQuery($xpath, array $valueMap) { if (is_null($this->xp)) { $this->getDOMXPath(); } return $this->xp->prepare($xpath, $valueMap); }
private function buildQuery(fDOMXPath $xp, array $values = NULL) { $backup = $this->values; if (count($values) > 0) { foreach ($values as $k => $v) { $this->bind($k, $v); } } $query = $xp->prepare($this->query, $this->values); $this->values = $backup; return $query; }