Example #1
0
 public function makeStringAction()
 {
     if (strpos($this->action, '@') !== false) {
         $this->type = self::CONTROLLER_ACTION;
         $explode = explode('@', $this->action);
         $explodeBak = $explode;
         $class = array_shift($explode);
         $method = array_shift($explode);
         $this->controller = $class;
         $this->method = $method;
         preg_match_all('/{(\\w*)}/', $this->uri, $params);
         $params = $params[1];
         $this->fullUri = $this->uri == '/' ? '/' : "/" . $this->uri . "/";
     } else {
         $this->type = self::CONTROLLER;
         $this->controller = $this->action;
         $this->fullUri = "/{$this->uri}/{action}/*/";
         $uri = URL::getInstance()->uri();
         $this->method = URL::getInstance()->controllerAction();
         $this->parameters = URL::getInstance()->params();
     }
 }
Example #2
0
 function url($uri = NULL, array $params = [])
 {
     return URL::getInstance()->make($uri, $params);
 }
Example #3
0
 public function pagelink($number)
 {
     $active = (Input::get('page') ?: 1) == $number ? 'class="active"' : '';
     $link = url(URL::getInstance()->uri(), array_merge(URL::getInstance()->inputs(), ['page' => $number]));
     return "<li><a href=\"{$link}\" {$active}>{$number}</a></li>";
 }
Example #4
0
 public function getParameters(Route $action)
 {
     $uri = URL::getInstance()->uri();
     $pattern = str_replace('/', '\\/', ltrim(rtrim($action->fullUri(), '/'), '/'));
     preg_match("/{$pattern}/", $uri, $matches);
     array_shift($matches);
     return $matches;
 }