Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / I18n / Filter / Alpha.php
blob91654515c37b2010914cf9db7cdd81da03655d76
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\I18n\Filter;
12 use Locale;
14 class Alpha extends Alnum
16 /**
17 * Defined by Zend\Filter\FilterInterface
19 * Returns the string $value, removing all but alphabetic characters
21 * @param string $value
22 * @return string
24 public function filter($value)
26 $whiteSpace = $this->options['allow_white_space'] ? '\s' : '';
27 $language = Locale::getPrimaryLanguage($this->getLocale());
29 if (!static::hasPcreUnicodeSupport()) {
30 // POSIX named classes are not supported, use alternative [a-zA-Z] match
31 $pattern = '/[^a-zA-Z' . $whiteSpace . ']/';
32 } elseif ($language == 'ja' || $language == 'ko' || $language == 'zh') {
33 // Use english alphabet
34 $pattern = '/[^a-zA-Z' . $whiteSpace . ']/u';
35 } else {
36 // Use native language alphabet
37 $pattern = '/[^\p{L}' . $whiteSpace . ']/u';
40 return preg_replace($pattern, '', (string) $value);