src/EventListener/ConfigurationNoticesListener.php
protected function canonicalCheck(Request $request)
    {
        $hostname = strtok($request->getUri(), '?');
        $canonical = strtok($this->app['canonical']->getUrl());

        if (!empty($canonical) && ($hostname != $canonical)) {
            $notice = json_encode([
                'severity' => 1,
                'notice'   => "The <code>canonical hostname</code> is set to <code>$canonical</code> in <code>config.yml</code>, but you are currently logged in using another hostname. This might cause issues with uploaded files, or links inserted in the content.",
                'info'     => sprintf(
                    "Log in on Bolt using the proper URL: <code><a href='%s'>%s</a></code>.",
                    $this->app['canonical']->getUrl(),
                    $this->app['canonical']->getUrl()
                ),
            ]);
            $this->app['logger.flash']->configuration($notice);
        }
    }
protected function canonicalCheck(Request $request)
    {
        $hostname = strtok($request->getUri(), '?');
        $canonical = strtok($this->app['canonical']->getUrl());

        if (!empty($canonical) && ($hostname != $canonical)) {
            $notice = json_encode([
                'severity' => 1,
                'notice'   => "The <code>canonical hostname</code> is set to <code>$canonical</code> in <code>config.yml</code>, but you are currently logged in using another hostname. This might cause issues with uploaded files, or links inserted in the content.",
                'info'     => sprintf(
                    "Log in on Bolt using the proper URL: <code><a href='%s'>%s</a></code>.",
                    $this->app['canonical']->getUrl(),
                    $this->app['canonical']->getUrl()
                ),
            ]);
            $this->app['logger.flash']->configuration($notice);
        }
    }
protected function canonicalCheck ( Request $ request ) { $ hostname = strtok ( $ request -> getUri ( ) , '?' ) ; $ canonical = strtok ( $ this -> app [ 'canonical' ] -> getUrl ( ) ) ; if ( ! empty ( $ canonical ) && ( $ hostname != $ canonical ) ) { $ notice = json_encode ( [ 'severity' => 1 , 'notice' => "The <code>canonical hostname</code> is set to <code>$canonical</code> in <code>config.yml</code>, but you are currently logged in using another hostname. This might cause issues with uploaded files, or links inserted in the content." , 'info' => sprintf ( "Log in on Bolt using the proper URL: <code><a href='%s'>%s</a></code>." , $ this -> app [ 'canonical' ] -> getUrl ( ) , $ this -> app [ 'canonical' ] -> getUrl ( ) ) , ] ) ; $ this -> app [ 'logger.flash' ] -> configuration ( $ notice ) ; } }
Check if the current url matches the canonical.

@param Request $request
Check if the current url matches the canonical .