protected function handleFilter($filterCall, $params, $locals)
 {
     list($filtererName, $method) = ActionUtils::parseActionDatasource($filterCall, true);
     $filterer = $this->FilterManager->getFiltererByName($filtererName);
     $filterResult = $filterer->handleFilter($filtererName, $method, $params, $locals, array_merge($this->globals, $this->getConstants()));
     if (!$filterer->isAllowTemplateCode()) {
         $filterResult = preg_replace("/\\%([A-Za-z#][A-Za-z0-9\\-\\_\\:\\.\\[\\]\\=\\#\\~]+)\\%/", '%$1%', str_replace(array('{%', '%}'), array('{%', '%}'), $filterResult));
     }
     return $filterResult;
 }
 /**
  * Invokes the datasource specified by {@link $datasource}.
  *
  * The {@link $datasource} can be split into controller and datasource
  * through ActionUtils::parseActionDatasource().
  *
  * @param string $datasource The datasource to invoke
  * @param array  $data       The data for the datasource
  * @param array  &$locals    The locals for the datasource
  *
  * @return mixed The data returned from the datasource (usually an array)
  */
 public function invokeDatasource($datasource, array &$preloadedData, array &$templateVariables)
 {
     list($controllerName, $datasource) = ActionUtils::parseActionDatasource($datasource);
     $controller = $this->getControllerByName($controllerName);
     $data = $controller->handleDatasource($controllerName, $datasource, $preloadedData, $templateVariables)->getData();
     return $data;
 }
Ejemplo n.º 3
0
 public function setControls($params)
 {
     $cvars = array('view', 'view_page', 'view_handler', 'view_paging', 'view_nodebug', 'view_nocache', 'view_pushcache', 'view_rss_link', 'action', 'action_nonce', 'action_success_view', 'action_form_view', 'action_continue_view', 'action_new_view', 'action_cancel_view', 'action_confirm_delete_view', 'action_datasource', 'action_buffer');
     foreach ($params as $name => $value) {
         //			if(in_array($name, $cvars)) {
         $this->controls[$name] = $value;
         //			}
         if (substr($name, 0, 2) == 'b_') {
             if (substr($name, -2) == '_x' || substr($name, -2) == '_y') {
                 $name = substr($name, 0, -2);
             }
             $this->controls['action_button'] = substr($name, 2);
         }
         if (substr($name, 0, 2) == 'a_') {
             if (substr($name, -2) == '_x' || substr($name, -2) == '_y') {
                 $name = substr($name, 0, -2);
             }
             $this->controls['action_button'] = 'save';
             $this->controls['action_override_method'] = substr($name, 2);
         }
     }
     if (isset($this->controls['view_pushcache'])) {
         $_SERVER['REQUEST_URI'] = preg_replace('/\\?view_pushcache=([^\\&]+)\\&/', '?', $_SERVER['REQUEST_URI']);
         $_SERVER['REQUEST_URI'] = preg_replace('/\\?view_pushcache=([^\\&]+)/', '', $_SERVER['REQUEST_URI']);
         unset($_GET['view_pushcache']);
     }
     if (isset($this->controls['action_button'])) {
         $this->controls['action_executing'] = true;
         $this->controls['view_nocache'] = true;
     }
     if (isset($this->controls['action'])) {
         try {
             list($elem, $method) = ActionUtils::parseActionDatasource($this->controls['action']);
             $this->controls['action'] = ActionUtils::createActionDatasource($elem, $method);
             $this->controls['action_element'] = $elem;
             $this->controls['action_method'] = $method;
         } catch (ActionDatasourceException $ae) {
             unset($this->controls['action']);
             unset($this->controls['action_element']);
             unset($this->controls['action_method']);
         }
     }
     return $this;
 }