Example #1
1
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route $route
  * @param  \Illuminate\Http\Request $request
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     if (is_null($route->getCompiled()->getHostRegex())) {
         return true;
     }
     return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
 }
Example #2
0
 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route $route
  * @param  \Illuminate\Http\Request $request
  *
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     $regex = $route->getCompiled()->getRegex();
     if (str_contains($request->getRequestUri(), '/wp-admin')) {
         return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
     }
     $path = $request->path() == '/' ? '/' : '/' . $request->path();
     return preg_match($regex, rawurldecode($path));
 }
 /**
  * Validate a given rule against a route and request.
  *
  * @param  LaravelRoute   $route   illuminate route
  * @param  LaravelRequest $request illuminate request
  *
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     $path = $request->path() == '/' ? '/' : '/' . $request->path();
     $firstSegment = $request->segment(1);
     if ($firstSegment === null) {
         return true;
     } else {
         return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
     }
 }
Example #4
0
 public function matches(Route $route, Request $request)
 {
     $path = $request->path() == '/' ? '/' : '/' . $request->path();
     return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
 }
 /**
  * canReview
  *
  * @param Route   $route   laravel route
  * @param Request $request laravel request
  *
  * @return bool
  */
 private function canReview(Route $route, Request $request)
 {
     if (!is_null($route->getCompiled()->getHostRegex())) {
         return false;
     }
     $firstSegment = $request->segment(1);
     if ($firstSegment === null) {
         return true;
     }
     $uri = $route->uri();
     if (strpos($uri, '{') === false) {
         return false;
     }
     $actions = $route->getAction();
     if (isset($actions['module'])) {
         return true;
     }
     return false;
 }
 /**
  * canReview
  *
  * @param Route   $route   laravel route
  * @param Request $request laravel request
  *
  * @return bool
  */
 private function canReview(Route $route, Request $request)
 {
     if (!is_null($route->getCompiled()->getHostRegex())) {
         return false;
     }
     $uri = $route->uri();
     if (strpos($uri, '{instanceGroup') !== 0) {
         return false;
     }
     $actions = $route->getAction();
     if (isset($actions['module'])) {
         return true;
     }
     return false;
 }
 /**
  * Transform route into string route identity
  *
  * @param Illuminate\Routing\Route $route
  * @return string formatted '<route_methods> <route_regex>'
  */
 protected function getRouteIdentity(Route $route)
 {
     $route->bind($this->app['request']);
     $regex = $route->getCompiled()->getRegex();
     $methods = implode('|', $route->getMethods());
     return $methods . ' ' . $regex;
 }