|
|
@ -2,14 +2,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace Engelsystem\Routing;
|
|
|
|
namespace Engelsystem\Routing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Provides urls when webserver rewriting is disabled.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* The urls have the form <app url>/index.php?p=<path>&<parameters>
|
|
|
|
|
|
|
|
*/
|
|
|
|
class LegacyUrlGenerator extends UrlGenerator
|
|
|
|
class LegacyUrlGenerator extends UrlGenerator
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param string $path
|
|
|
|
* @param string $path
|
|
|
|
* @param array $parameters
|
|
|
|
* @param array $parameters
|
|
|
|
* @return string
|
|
|
|
* @return string urls in the form <app url>/index.php?p=<path>&<parameters>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function to($path, $parameters = [])
|
|
|
|
public function link_to($path, $parameters = [])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$page = ltrim($path, '/');
|
|
|
|
$page = ltrim($path, '/');
|
|
|
|
if (!empty($page)) {
|
|
|
|
if (!empty($page)) {
|
|
|
@ -17,7 +22,7 @@ class LegacyUrlGenerator extends UrlGenerator
|
|
|
|
$parameters = array_merge(['p' => $page], $parameters);
|
|
|
|
$parameters = array_merge(['p' => $page], $parameters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$uri = parent::to('index.php', $parameters);
|
|
|
|
$uri = parent::link_to('index.php', $parameters);
|
|
|
|
$uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
|
|
|
|
$uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
|
|
|
|
|
|
|
|
|
|
|
|
return $uri;
|
|
|
|
return $uri;
|
|
|
|