예제 #1
0
 /**
  * Resolve resource uri.
  *
  * @param string $uri
  * @return string
  */
 protected function resolveUri($uri)
 {
     if (!$this->isLocal($uri)) {
         //External or non resolved uri
         return $uri;
     }
     return $this->httpConfig->basePath() . ltrim($uri, '/') . '?' . $this->fileHash($uri);
 }
예제 #2
0
파일: Vault.php 프로젝트: milky-ashes/albus
 /**
  * Get vault specific uri.
  *
  * @param string      $target Target controller and action in a form of "controller::action" or
  *                            "controller:action" or "controller".
  * @param array|mixed $parameters
  * @return UriInterface
  * @throws VaultException
  */
 public function uri($target, $parameters = [])
 {
     $target = str_replace('::', ':', $target);
     $controller = $action = '';
     if (strpos($target, ':') !== false) {
         list($controller, $action) = explode(':', $target);
     } else {
         $controller = $target;
         if (!empty($parameters)) {
             throw new VaultException("Unable to generate uri with empty controller action and not empty parameters.");
         }
     }
     if (!isset($this->config->controllers()[$controller])) {
         throw new VaultException("Unable to generate uri, undefined controller '{$controller}'.");
     }
     $parameters['controller'] = $controller;
     $parameters['action'] = $action;
     return $this->route->uri($parameters, $this->httpConfig->basePath());
 }
예제 #3
0
 /**
  * Application base path.
  *
  * @return string
  */
 public function basePath()
 {
     return $this->config->basePath();
 }
예제 #4
0
 /**
  * @param Request     $request
  * @param string|null $hash
  * @return string
  */
 protected function cookieHeader(Request $request, $hash)
 {
     return Cookie::create($this->cookie, $hash, $this->getLifetime(), $this->httpConfig->basePath(), $this->httpConfig->cookiesDomain($request->getUri()))->createHeader();
 }
예제 #5
0
 /**
  * Generate session cookie.
  *
  * @param UriInterface $uri Incoming uri.
  * @param string       $sessionID
  * @return Cookie
  */
 private function sessionCookie(UriInterface $uri, $sessionID)
 {
     return Cookie::create($this->config->sessionCookie(), $sessionID, $this->config->sessionLifetime(), $this->httpConfig->basePath(), $this->httpConfig->cookiesDomain($uri));
 }
예제 #6
0
파일: CsrfFilter.php 프로젝트: vvval/spiral
 /**
  * Generate CSRF cookie.
  *
  * @param UriInterface $uri Incoming uri.
  * @param string       $token
  * @return Cookie
  */
 protected function tokenCookie(UriInterface $uri, $token)
 {
     return Cookie::create($this->httpConfig->csrfCookie(), $token, $this->httpConfig->csrfLifetime(), $this->httpConfig->basePath(), $this->httpConfig->cookiesDomain($uri));
 }