Ejemplo n.º 1
0
 /**
  * Sanitize an array
  *
  * @param	mixed	Array to be sanitized
  * @return	array
  */
 public function sanitize($arr)
 {
     settype($arr, 'array');
     foreach ($arr as &$var) {
         $var = $this->_filter->sanitize($var);
     }
     return $arr;
 }
Ejemplo n.º 2
0
 /**
  * Allow for filter chaining 
  *
  * @param  string   $method    The function name
  * @param  array    $arguments The function arguments
  * @return mixed The result of the function
  * @throws BadMethodCallException   If method could not be found
  */
 public function __call($method, $arguments)
 {
     //Call the method on the filter if it exists
     if ($this->_last instanceof KFilterInterface) {
         $methods = $this->_last->getMethods();
         if (isset($methods[$method])) {
             call_user_func_array(array($this->_last, $method), $arguments);
             return $this;
         }
     }
     //Create a new filter based on the method name
     $filter = $this->getObject('filter.factory')->createFilter($method, $arguments);
     $this->addFilter($filter);
     return $this;
 }