This repository was archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Implemented blacklist to exclude paths from seo routing
- Loading branch information
Showing
4 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
namespace Yeebase\SEO\Routing; | ||
|
||
/** | ||
* This file is part of the Yeebase.SEO.Routing package. | ||
* | ||
* (c) 2018 yeebase media GmbH | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
use Neos\Flow\Annotations as Flow; | ||
use Psr\Http\Message\UriInterface; | ||
|
||
trait BlacklistTrait | ||
{ | ||
/** | ||
* @Flow\InjectConfiguration(package="Yeebase.SEO.Routing", path="blacklist") | ||
* @var array | ||
*/ | ||
protected $blacklist; | ||
|
||
/** | ||
* @param UriInterface $uri | ||
* @return bool | ||
*/ | ||
protected function matchesBlacklist(UriInterface $uri): bool | ||
{ | ||
$path = $uri->getPath(); | ||
foreach ($this->blacklist as $rawPattern => $active) { | ||
$pattern = '/' . str_replace('/', '\/', $rawPattern) . '/'; | ||
if ($active === true && preg_match($pattern, $path) === 1) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ Yeebase: | |
redirect: | ||
enable: TRUE | ||
statusCode: 303 | ||
blacklist: | ||
'/neos/.*': TRUE | ||
|
||
Neos: | ||
Flow: | ||
|