예제 #1
0
파일: host.php 프로젝트: 453111208/bbc
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(base_routing_route $route, base_http_request $request)
 {
     if (is_null($route->getCompiled()->getHostRegex())) {
         return true;
     }
     return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
 }
예제 #2
0
파일: scheme.php 프로젝트: 453111208/bbc
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(base_routing_route $route, base_http_request $request)
 {
     if ($route->httpOnly()) {
         return !$request->secure();
     } elseif ($route->secure()) {
         return $request->secure();
     }
     return true;
 }
예제 #3
0
파일: request.php 프로젝트: 453111208/bbc
 protected static function getFacadeAccessor()
 {
     if (!static::$__request) {
         // todo: 因为没有容器的临时策略
         if (defined('WEB_MODE') && constant('WEB_MODE') === true) {
             static::$__request = base_http_request::createFromGlobals();
         } else {
             $i = 'index.php';
             $url = trim(config::get('app.url', 'http://localhost'), '/');
             $url = strpos($url, $i) === false ? $url . '/' : $url;
             $parsed_url = parse_url($url);
             $path = $parsed_url['path'];
             $_SERVER['SCRIPT_FILENAME'] = PUBLIC_DIR . '/' . $i;
             $_SERVER['SCRIPT_NAME'] = (str_contains($path, $i) ? str_replace('/' . $i, '', $path) : $path) . '/' . $i;
             static::$__request = base_http_request::create($url, 'GET', [], [], [], $_SERVER);
         }
     }
     return static::$__request;
 }
예제 #4
0
파일: uri.php 프로젝트: 453111208/bbc
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(base_routing_route $route, base_http_request $request)
 {
     $path = $request->path() == '/' ? '/' : '/' . $request->path();
     return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
 }
예제 #5
0
파일: route.php 프로젝트: 453111208/bbc
 /**
  * Extract the parameter list from the host part of the request.
  *
  * @param  request  $request
  * @param  array  $parameters
  * @return array
  */
 protected function bindHostParameters(Request $request, $parameters)
 {
     preg_match($this->compiled->getHostRegex(), $request->getHost(), $matches);
     return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters);
 }
예제 #6
0
파일: method.php 프로젝트: 453111208/bbc
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(base_routing_route $route, base_http_request $request)
 {
     return in_array($request->getMethod(), $route->methods());
 }