TYPO3 CMS  TYPO3_6-2
AlphabeticFilter.php
Go to the documentation of this file.
1 <?php
3 
23 
29  protected $allowWhiteSpace;
30 
36  public function __construct($arguments = array()) {
37  $this->setAllowWhiteSpace($arguments['allowWhiteSpace']);
38  }
39 
46  public function setAllowWhiteSpace($allowWhiteSpace = TRUE) {
47  $this->allowWhiteSpace = (bool) $allowWhiteSpace;
48  }
49 
58  public function filter($value) {
59  $whiteSpace = $this->allowWhiteSpace ? '\\s' : '';
60  $pattern = '/[^\pL' . $whiteSpace . ']/u';
61  return preg_replace($pattern, '', (string) $value);
62  }
63 
64 }