Example #1
0
 public function filter($filter)
 {
     //run through the filters
     if ($this->runFilters !== false) {
         $args = array_slice(func_get_args(), 1);
         array_unshift($args, $this->value);
         array_push($args, $this);
         $filterFn = CocoDictionary::translate($filter, 'filter');
         $this->value = call_user_func_array($filterFn, $args);
     }
     return $this;
 }
Example #2
0
 public function render()
 {
     if ($this->autoForm) {
         $this->endWrapper('form');
     }
     foreach ($this->stack as $action) {
         if ($action['action'] === 'render') {
             echo $action['instance']->render($action['args']);
         } else {
             if ($action['action'] === 'startBuffer') {
                 array_push($this->wrapperArgsStack, $action['args']);
                 ob_start();
             } else {
                 if ($action['action'] === 'endBuffer') {
                     $content = ob_get_contents();
                     ob_end_clean();
                     $args = array_pop($this->wrapperArgsStack);
                     array_unshift($args, $content);
                     $wrapperFn = CocoDictionary::translate($action['wrapper'], CocoDictionary::WRAPPER);
                     echo call_user_func_array($wrapperFn, $args);
                 }
             }
         }
     }
 }