protected function checkExpression(DOMNode $node, $expr, Tag $tag)
	{
		$this->checkContext($node);

		if (preg_match('/^\\$(\\w+)$/', $expr, $m))
		{
			// Either this expression came from a variable that is considered safe, or it's a
			// stylesheet parameters, which are considered safe by default
			$this->checkVariable($node, $tag, $m[1]);
		}
		elseif (preg_match('/^@[-\\w]+(?:\\s*\\|\\s*@[-\\w]+)*$/', $expr))
		{
			$this->checkAttributeExpression($node, $tag, $expr);
		}
		elseif (!$this->isExpressionSafe($expr))
		{
			throw new UnsafeTemplateException("Cannot assess the safety of expression '" . $expr . "'", $node);
		}
	}
protected function checkExpression(DOMNode $node, $expr, Tag $tag)
	{
		$this->checkContext($node);

		if (preg_match('/^\\$(\\w+)$/', $expr, $m))
		{
			// Either this expression came from a variable that is considered safe, or it's a
			// stylesheet parameters, which are considered safe by default
			$this->checkVariable($node, $tag, $m[1]);
		}
		elseif (preg_match('/^@[-\\w]+(?:\\s*\\|\\s*@[-\\w]+)*$/', $expr))
		{
			$this->checkAttributeExpression($node, $tag, $expr);
		}
		elseif (!$this->isExpressionSafe($expr))
		{
			throw new UnsafeTemplateException("Cannot assess the safety of expression '" . $expr . "'", $node);
		}
	}
protected function checkExpression ( DOMNode $ node , $ expr , Tag $ tag ) { $ this -> checkContext ( $ node ) ; if ( preg_match ( '/^\\$(\\w+)$/' , $ expr , $ m ) ) { // Either this expression came from a variable that is considered safe, or it's a // stylesheet parameters, which are considered safe by default $ this -> checkVariable ( $ node , $ tag , $ m [ 1 ] ) ; } elseif ( preg_match ( '/^@[-\\w]+(?:\\s*\\|\\s*@[-\\w]+)*$/' , $ expr ) ) { $ this -> checkAttributeExpression ( $ node , $ tag , $ expr ) ; } elseif ( ! $ this -> isExpressionSafe ( $ expr ) ) { throw new UnsafeTemplateException ( "Cannot assess the safety of expression '" . $ expr . "'" , $ node ) ; } }
Test the safety of an XPath expression

@param  DOMNode $node Source node
@param  string  $expr XPath expression
@param  Tag     $tag  Source tag
@return void
Test the safety of an XPath expression