Exemplo n.º 1
0
 public static function all()
 {
     if (strtolower(Request::getInstance()->method()) == 'post') {
         return static::post();
     }
     if (strtolower(Request::getInstance()->method()) == 'get') {
         return static::get();
     }
     return NULL;
 }
Exemplo n.º 2
0
 public final function checkAction($action)
 {
     if ($this->global) {
         return true;
     }
     if (array_search($action, $this->get_actions) !== false && strtolower(Request::getInstance()->method()) == 'get') {
         return true;
     } elseif (array_search($action, $this->post_actions) !== false && strtolower(Request::getInstance()->method()) == 'post') {
         return true;
     } elseif (array_search($action, $this->actions) !== false) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 3
0
 /**
  * Create an absloute URL
  *
  * @param string $uri
  * @param array $params
  * @return string
  */
 public function make($uri = NULL, array $params = [])
 {
     if ($uri instanceof self) {
         return $uri;
     }
     if (!empty($params)) {
         $params = http_build_query($params);
     }
     $request = Request::getInstance();
     $scheme = $request->scheme();
     $root = $request->root();
     $uri = rtrim(ltrim($uri, '/'), '/');
     if ($uri != '') {
         $uri = "{$uri}";
     }
     return empty($params) ? "{$scheme}://{$root}{$uri}" : "{$scheme}://{$root}{$uri}?{$params}";
 }