Пример #1
0
 public static function getRequestPaths(\Slim\Http\Request $request)
 {
     $basePath = $request->getRootUri();
     if ($basePath === '' || substr($basePath, -1) != '/') {
         $basePath .= '/';
     }
     $host = $request->getHost();
     $protocol = $request->getScheme();
     $requestUri = $request->getRootUri() . $request->getResourceUri();
     return array('basePath' => $basePath, 'host' => $host, 'protocol' => $protocol, 'fullBasePath' => $protocol . '://' . $host . $basePath, 'requestUri' => $requestUri, 'fullUri' => $protocol . '://' . $host . $requestUri);
 }
Пример #2
0
 /**
  * Default Not Found handler
  */
 protected function defaultNotFound()
 {
     echo self::generateTemplateMarkup('404 Page Not Found', '<p>The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.</p><a href="' . $this->request->getRootUri() . '/">Visit the Home Page</a>');
 }
Пример #3
0
 /**
  * @param string $path
  * @return string
  */
 public function asset($path)
 {
     return preg_replace('#/+#', '/', sprintf('%s%s', dirname($this->request->getRootUri()), $path));
 }