Back to PhocacartPath class

Method getRightPathLink

public static
(mixed $link)

Method getRightPathLink - Source code

public static function getRightPathLink($link)
{
    $app = CMSApplication::getInstance('site');
    $router = $app->getRouter();
    $uri = $router->build($link);
    $uriS = $uri->toString();
    $pos = strpos($uriS, 'administrator');
    if ($pos === false) {
        $uriL = str_replace(Uri::root(true), '', $uriS);
        $uriL = ltrim($uriL, '/');
        $formatLink = Uri::root(false) . $uriL;
        //$formatLink = $uriS;
    } else {
        $formatLink = Uri::root(false) . str_replace(Uri::root(true) . '/administrator/', '', $uri->toString());
    }
    return $formatLink;
}