eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator::isUriPrefixExcluded PHP Method

isUriPrefixExcluded() public method

Checks if passed URI has an excluded prefix, when a root location is defined.
public isUriPrefixExcluded ( string $uri ) : boolean
$uri string
return boolean
    public function isUriPrefixExcluded($uri)
    {
        foreach ($this->excludedUriPrefixes as $excludedPrefix) {
            $excludedPrefix = '/' . trim($excludedPrefix, '/');
            if (mb_stripos($uri, $excludedPrefix) === 0) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  * Returns true of false on comparing $urlAlias->path and $path with case sensitivity.
  *
  * Used to determine if redirect is needed because requested path is case-different
  * from the stored one.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\URLAlias $loadedUrlAlias
  * @param string $requestedPath
  * @param string $pathPrefix
  *
  * @return bool
  */
 protected function needsCaseRedirect(URLAlias $loadedUrlAlias, $requestedPath, $pathPrefix)
 {
     // If requested path is excluded from tree root jail, compare it to loaded UrlAlias directly.
     if ($this->generator->isUriPrefixExcluded($requestedPath)) {
         return strcmp($loadedUrlAlias->path, $requestedPath) !== 0;
     }
     // Compare loaded UrlAlias with requested path, prefixed with configured path prefix.
     return strcmp($loadedUrlAlias->path, $pathPrefix . ($pathPrefix === '/' ? trim($requestedPath, '/') : rtrim($requestedPath, '/'))) !== 0;
 }
All Usage Examples Of eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator::isUriPrefixExcluded