ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
XPath.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class 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 }
if($format !==null) $name
Definition: metadata.php:146
static filterAttrName($name, $allow=self::EXTENDED_ALPHANUMERIC)
Filter an attribute name for save inclusion in an XPath query.
Definition: XPath.php:40
static filterAttrValue($value, $quotes=self::ALL_QUOTES)
Filter an attribute value for save inclusion in an XPath query.
Definition: XPath.php:25