-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRouter.php
More file actions
29 lines (25 loc) · 994 Bytes
/
Copy pathRouter.php
File metadata and controls
29 lines (25 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace FeatherBB\Core\Interfaces;
use FeatherBB\Core\Url;
class Router extends SlimSugar
{
public static function pathFor($name, array $data = [], array $queryParams = [])
{
$baseUrl = Url::baseStatic();
// if (!(function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) && is_file(getcwd().'/.htaccess'))) { // If we have Apache's mod_rewrite enabled
// $baseUrl .= '/index.php';
// }
return $baseUrl . static::$slim->getContainer()['router']->pathFor($name, $data, $queryParams);
}
public static function redirect($uri, $message = null, $status = 302)
{
if (is_string($message)) {
$message = ['info', $message];
}
// Add a flash message if needed
if (is_array($message)) {
Container::get('flash')->addMessage($message[0], $message[1]);
}
return Response::withStatus($status)->withHeader('Location', $uri);
}
}