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(); } }
function url($uri = NULL, array $params = []) { return URL::getInstance()->make($uri, $params); }
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>"; }
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; }