Пример #1
0
 /**
  * @Todo this is dirty!
  * @param $key
  * @param $value
  * @return string
  * @deprecated use @see $this->_escape_field
  */
 function _normalize_value($key, $value)
 {
     if ($this->collection && ($field = $this->collection->field($key))) {
         switch ($field['type']) {
             case 'datetime':
             case 'unixtime':
             case 'timestamp':
                 $value = strtotime($value);
                 break;
             case 'numeric':
             case 'relation':
                 $value = intval($value);
                 break;
             case 'text':
             default:
                 $value = $this->_escape($value);
                 break;
         }
     } else {
         throw new collection_filter_exception('_normalize_value : ' . $key);
     }
     return $value;
 }