Exemplo n.º 1
0
 /**
  * Detect the criteria type. Try to detect it if not explicitly defined.
  * 
  * @param array		$definition		Criteria definition
  * @param array		$options		Criteria options
  * @return string					Type. 
  */
 public function type()
 {
     if (isset($this->_options['type'])) {
         return $this->_options['type'];
     }
     if (empty($this->_data['in']) && empty($this->_data['value'])) {
         return 'match_all';
     }
     if (isset($this->_data['in']) && is_string($this->_data['in']) && isset($this->_data['value'])) {
         if (is_string($this->_data['value'])) {
             if (preg_match('/^[a-z0-9 ]+$/i', $this->_data['value']) && !preg_match('/(AND|OR)/', $this->_data['value'])) {
                 return 'term';
             }
         }
     }
     return parent::type();
 }