public static function all() { if (strtolower(Request::getInstance()->method()) == 'post') { return static::post(); } if (strtolower(Request::getInstance()->method()) == 'get') { return static::get(); } return NULL; }
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; } }
/** * 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}"; }