Esempio n. 1
0
 private function filter()
 {
     $input = Filter::run(strip_tags(parent::getVar('input')));
     $find = array(' ', '#', '?', '&', '.', '!', '"', '§', '$', '%', '(', ')', '=', '*', '+', '~', '-', ':', ';', '>');
     $input = str_replace($find, '', $input);
     echo $input;
 }
Esempio n. 2
0
 public function testrunArrayClassStaticMethod()
 {
     Filter::register('test_filter2', array('TestFilterClass', 'testArrayFilter'));
     $testvalues = array('testvalue1', 'testvalue2');
     $temp = Filter::run('test_filter2', array($testvalues));
     $this->assertEquals(3, sizeof($temp));
     $this->assertEquals('testvalue3', $temp[2]);
 }
Esempio n. 3
0
 public static function make($results, $filters)
 {
     $filter = new Filter($results, $filters);
     $filter->run();
     return $filter->getResults();
 }
Esempio n. 4
0
 public function data()
 {
     $data = array();
     if (property_exists($this->info, 'filters')) {
         foreach ($this->info->filters as $filter) {
             // Make the params to pass to the filter
             $params = array();
             // See if the filter has params available
             if (property_exists($filter, 'params')) {
                 foreach ($filter->params as $param) {
                     if (property_exists($param, 'pageParam')) {
                         $params[dash($param->filterParam)] = $this->params[$param->pageParam];
                     }
                     // If we're basing this off a filter, param the ID
                     if (property_exists($param, 'fromFilter')) {
                         $value = $data[dash($param->fromFilter)];
                         // If the previous filter returned a group of records
                         if (is_array($value)) {
                             $ids = array();
                             foreach ($value as $record) {
                                 $ids[] = $record->id;
                             }
                             $params[dash($param->filterParam)] = $ids;
                         } else {
                             $params[dash($param->filterParam)] = $value->id;
                         }
                     }
                 }
             }
             // Initialize a filter
             $filter = new Filter($filter->name);
             $data[$filter->varName()] = $filter->run($params);
         }
     }
     return $data;
 }