Example #1
0
 /**
  * Sets default option values for this instance
  *
  * @param  boolean $allowWhiteSpace
  * @return void
  */
 public function __construct($options = false)
 {
     if ($options instanceof Config) {
         $options = $options->toArray();
     } elseif (!is_array($options)) {
         $options = func_get_args();
         $temp = array();
         if (!empty($options)) {
             $temp['allowwhitespace'] = array_shift($options);
         }
         if (!empty($options)) {
             $temp['locale'] = array_shift($options);
         }
         $options = $temp;
     }
     if (null === self::$unicodeEnabled) {
         self::$unicodeEnabled = @preg_match('/\\pL/u', 'a') ? true : false;
     }
     if (array_key_exists('allowwhitespace', $options)) {
         $this->setAllowWhiteSpace($options['allowwhitespace']);
     }
     if (!array_key_exists('locale', $options)) {
         $options['locale'] = null;
     }
     $this->setLocale($options['locale']);
 }
Example #2
0
 /**
  * Sets default option values for this instance
  *
  * @param  boolean $allowWhiteSpace
  * @return void
  */
 public function __construct($allowWhiteSpace = false)
 {
     if ($allowWhiteSpace instanceof \Zend\Config\Config) {
         $allowWhiteSpace = $allowWhiteSpace->toArray();
     } else {
         if (is_array($allowWhiteSpace)) {
             if (array_key_exists('allowwhitespace', $allowWhiteSpace)) {
                 $allowWhiteSpace = $allowWhiteSpace['allowwhitespace'];
             } else {
                 $allowWhiteSpace = false;
             }
         }
     }
     $this->allowWhiteSpace = (bool) $allowWhiteSpace;
     if (null === self::$_unicodeEnabled) {
         self::$_unicodeEnabled = @preg_match('/\\pL/u', 'a') ? true : false;
     }
     if (null === self::$_meansEnglishAlphabet) {
         $this->_locale = new Locale('auto');
         self::$_meansEnglishAlphabet = in_array($this->_locale->getLanguage(), array('ja', 'ko', 'zh'));
     }
 }