Files
Phraseanet/lib/classes/thesaurus/xpath.class.php
Romain Neutron 4c5b7eb658 V 3.5 RC 1
2011-12-05 00:23:28 +01:00

49 lines
928 B
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class thesaurus_xpath extends DOMXPath
{
/**
*
* @var array
*/
protected static $r = array();
/**
*
* @param string $xquery
* @param DOMNode $context_node
* @param string $context_path
* @return DOMNodeList
*/
public function cache_query($xquery, DOMNode $context_node=NULL, $context_path='')
{
$context_path .= $xquery;
if (!array_key_exists($context_path, self::$r))
{
self::$r[$context_path] = $context_node ?
parent::query($xquery, $context_node) : parent::query($xquery);
}
return(self::$r[$context_path]);
}
}