Exemplo n.º 1
0
 /**
  * Implements getValues.
  *
  * @return array
  */
 public function getValues()
 {
     $id = $this->parameters->values[0];
     if ($return = Cache::get($id)) {
         return $return;
     }
     $values = $this->element_query->getElementById($this->parameters->values[0]);
     $elements = array();
     if ($values) {
         foreach ($values['controller_values']['elements'] as $value) {
             $elements[] = $this->getChildElement($value);
         }
         $classes = '';
         if (isset($values['controller_values']['wrapper_classes'])) {
             $classes = $values['controller_values']['wrapper_classes'];
         }
         $return = array('wrapper_classes' => $classes, 'elements' => $elements);
         Cache::set($id, $return);
         return $return;
     }
 }
Exemplo n.º 2
0
 /**
  * Implements getValues.
  *
  * @return array
  */
 public function getValues()
 {
     $wildcard = FALSE;
     $full_path = Headers::get('CurrentPath');
     $path = explode('/', $full_path);
     if ($path_cache = Cache::get(self::PATH_CACHE . $full_path)) {
         $path_values = $this->path_query->getPathDataById($path_cache['id']);
         return $this->setupPathValues($path_values, $path_cache['query_parameters']);
     }
     $host = Headers::get('Host');
     if ($path[0] == "") {
         array_shift($path);
     }
     $query_parameters = array();
     while (count($path)) {
         $path_query = implode('/', $path);
         $path_values = $this->path_query->getPathDataFromPath($path_query, $host, $wildcard, true);
         if ($path_values) {
             $cache = array('id' => $path_values['_id']->{'$id'}, 'query_parameters' => $query_parameters);
             Cache::set(self::PATH_CACHE . $full_path, $cache);
             return $this->setupPathValues($path_values, $query_parameters);
         }
         if ($wildcard == TRUE) {
             $query_parameters[] = array_pop($path);
         }
         $wildcard = TRUE;
     }
     // We did not find a match send to the 404, if available.
     if (isset($this->config->FourOFour)) {
         if ($this->config->FourOFour === Headers::get('CurrentPath')) {
             Messages::set('Page Error', 'Error');
         } else {
             Redirect::set($this->config->FourOFour);
         }
     }
     return;
 }