ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
XPath.php
Go to the documentation of this file.
1<?php
2
4
5class XPath
6{
7 const ALPHANUMERIC = '\w\d';
8 const NUMERIC = '\d';
9 const LETTERS = '\w';
10 const EXTENDED_ALPHANUMERIC = '\w\d\s\-_:\.';
11
12 const SINGLE_QUOTE = '\'';
13 const DOUBLE_QUOTE = '"';
14 const ALL_QUOTES = '[\'"]';
15
16
25 public static function filterAttrValue($value, $quotes = self::ALL_QUOTES)
26 {
27 return preg_replace('#'.$quotes.'#', '', $value);
28 }
29
30
40 public static function filterAttrName($name, $allow = self::EXTENDED_ALPHANUMERIC)
41 {
42 return preg_replace('#[^'.$allow.']#', '', $name);
43 }
44}
An exception for terminatinating execution or to throw for unit testing.
static filterAttrValue($value, $quotes=self::ALL_QUOTES)
Filter an attribute value for save inclusion in an XPath query.
Definition: XPath.php:25
static filterAttrName($name, $allow=self::EXTENDED_ALPHANUMERIC)
Filter an attribute name for save inclusion in an XPath query.
Definition: XPath.php:40