This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathan Glasl
committed
May 7, 2018
1 parent
9ce82e5
commit 7332db4
Showing
31 changed files
with
449 additions
and
780 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,11 @@ | ||
mappings: | ||
MisdirectionAdmin: 'nglasl\misdirection\MisdirectionAdmin' | ||
MisdirectionAdminTestingExtension: 'nglasl\misdirection\MisdirectionAdminTestingExtension' | ||
MisdirectionFallbackExtension: 'nglasl\misdirection\MisdirectionFallbackExtension' | ||
SiteTreeMisdirectionExtension: 'nglasl\misdirection\SiteTreeMisdirectionExtension' | ||
MisdirectionTesting: 'nglasl\misdirection\MisdirectionTesting' | ||
LinkMapping: 'nglasl\misdirection\LinkMapping' | ||
MisdirectionRequestFilter: 'nglasl\misdirection\MisdirectionRequestFilter' | ||
MisdirectionService: 'nglasl\misdirection\MisdirectionService' | ||
MisdirectionFunctionalTests: 'nglasl\misdirection\tests\MisdirectionFunctionalTests' | ||
MisdirectionUnitTests: 'nglasl\misdirection\tests\MisdirectionUnitTests' |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# [misdirection](https://packagist.org/packages/nglasl/silverstripe-misdirection) | ||
|
||
_The current release is **2.2.26**_ | ||
_The current release is **3.0.0**_ | ||
|
||
> A module for SilverStripe which will allow both simple and regular expression link redirections based on customisable mappings, either hooking into a page not found or replacing the default automated URL handling. | ||
> This module allows both simple and regular expression link redirections based on customisable mappings, either hooking into a page not found or replacing the default automated URL handling. | ||
## Requirement | ||
|
||
* SilverStripe 3.1 → **3.5** | ||
* SilverStripe 3.1 → **4.0** | ||
|
||
This module does **not** require the CMS. | ||
|
||
|
@@ -24,25 +24,25 @@ This module does **not** require the CMS. | |
|
||
These allow both simple and regular expression link redirections, and can be used for legacy page redirection, vanity URLs (more below), or redirection based on specific URL patterns. | ||
|
||
![link-mapping](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-link-mapping.png) | ||
![link-mapping](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-link-mapping.png) | ||
|
||
The link mapping with the highest priority (followed by greatest specificity) will be used, and replaces the default automated URL handling out of the box. This default behaviour may be configured to only hook into a page not found: | ||
|
||
```yaml | ||
MisdirectionRequestFilter: | ||
nglasl\misdirection\MisdirectionRequestFilter: | ||
enforce_misdirection: false | ||
``` | ||
When there are multiple matches, the link mapping first created will be used. This default behaviour may be configured to prioritise the link mapping most recently created: | ||
```yaml | ||
LinkMapping: | ||
nglasl\misdirection\LinkMapping: | ||
priority: 'DESC' | ||
``` | ||
### Vanity URLs and Fallbacks | ||
![vanity-URLs-and-fallbacks](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-vanity-URLs-and-fallbacks.png) | ||
![vanity-URLs-and-fallbacks](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-vanity-URLs-and-fallbacks.png) | ||
#### Vanity URLs | ||
|
@@ -61,16 +61,16 @@ The link mappings are processed server side to prevent inefficient and problemat | |
|
||
When you want to see exactly what is happening behind the scenes for a given URL, the model admin provides a powerful testing interface! | ||
|
||
![testing](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-testing.png) | ||
![testing](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-testing.png) | ||
|
||
Once a maximum number of requests has been reached, the server will respond with a page not found. The following is the default configuration: | ||
|
||
```yaml | ||
MisdirectionRequestFilter: | ||
nglasl\misdirection\MisdirectionRequestFilter: | ||
maximum_requests: 9 | ||
``` | ||
|
||
![testing-maximum-requests](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-testing-maximum-requests.png) | ||
![testing-maximum-requests](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-testing-maximum-requests.png) | ||
|
||
#### Bypassing Misdirection | ||
|
||
|
@@ -81,16 +81,12 @@ It is possible to bypass the request filter completely by appending `?misdirecte | |
This may be completely replaced, in which case legacy URLs will no longer resolve based on page version history. | ||
|
||
```yaml | ||
MisdirectionRequestFilter: | ||
nglasl\misdirection\MisdirectionRequestFilter: | ||
replace_default: true | ||
``` | ||
|
||
When a page is moved, the appropriate link mappings are automatically created and maintained. This allows full control over which legacy URLs remain in the system. | ||
|
||
#### Historical Link Mappings | ||
|
||
To ensure the current page version history remains, `/dev/tasks/MisdirectionHistoricalLinkMappingsTask` may be used to instantiate the appropriate link mappings. However, this task is currently only supported by `MySQL`. | ||
|
||
## Maintainer Contact | ||
|
||
Nathan Glasl, [email protected] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
--- | ||
name: misdirection-extensions | ||
--- | ||
MisdirectionAdmin: | ||
nglasl\misdirection\MisdirectionAdmin: | ||
extensions: | ||
- 'MisdirectionAdminTestingExtension' | ||
SiteTree: | ||
- 'nglasl\misdirection\MisdirectionAdminTestingExtension' | ||
SilverStripe\CMS\Model\SiteTree: | ||
extensions: | ||
- 'SiteTreeMisdirectionExtension' | ||
- 'MisdirectionFallbackExtension' | ||
SiteConfig: | ||
- 'nglasl\misdirection\SiteTreeMisdirectionExtension' | ||
- 'nglasl\misdirection\MisdirectionFallbackExtension' | ||
SilverStripe\SiteConfig\SiteConfig: | ||
extensions: | ||
- 'MisdirectionFallbackExtension' | ||
- 'nglasl\misdirection\MisdirectionFallbackExtension' |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
--- | ||
name: misdirection-request-filters | ||
--- | ||
Injector: | ||
RequestProcessor: | ||
SilverStripe\Core\Injector\Injector: | ||
SilverStripe\Control\RequestProcessor: | ||
properties: | ||
filters: | ||
- '%$MisdirectionRequestFilter' | ||
- '%$nglasl\misdirection\MisdirectionRequestFilter' |
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,6 @@ | ||
--- | ||
name: misdirection-upgrade | ||
--- | ||
SilverStripe\ORM\DatabaseAdmin: | ||
classname_value_remapping: | ||
LinkMapping: 'nglasl\misdirection\LinkMapping' |
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,75 @@ | ||
|
||
/** | ||
* The misdirection specific styling. | ||
* @author Nathan Glasl <[email protected]> | ||
*/ | ||
|
||
div.misdirection-testing.admin { | ||
background: #005A93; | ||
color: white; | ||
padding: 10px; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
border-radius: 5px; | ||
} | ||
|
||
div.misdirection-testing.admin div { | ||
margin-bottom: 10px; | ||
} | ||
|
||
div.misdirection-testing.admin div.wrapper { | ||
white-space: nowrap; | ||
} | ||
|
||
div.misdirection-testing.admin input.url { | ||
display: inline-block; | ||
vertical-align: middle; | ||
} | ||
|
||
div.misdirection-testing.admin span.test.disabled { | ||
filter: Alpha(opacity = 40); | ||
opacity: 0.4; | ||
cursor: not-allowed; | ||
} | ||
|
||
div.misdirection-testing.admin div.results { | ||
overflow: hidden; | ||
margin-bottom: 0; | ||
} | ||
|
||
/* Preload the required image to avoid performance issues. */ | ||
|
||
body:after { | ||
display: none; | ||
content: url('../images/loading.gif'); | ||
} | ||
|
||
div.misdirection-testing.admin div.results.loading { | ||
min-height: 40px; | ||
background: url('../images/loading.gif') no-repeat left center; | ||
} | ||
|
||
div.misdirection-testing.admin div.result { | ||
float: left; | ||
width: 18%; | ||
margin: 10px 1% 0; | ||
} | ||
|
||
div.misdirection-testing.admin div.result:not(.no-matches) { | ||
word-wrap: break-word; | ||
} | ||
|
||
/* This is used to correct the float height issue, however will not be supported by IE8. */ | ||
|
||
div.misdirection-testing.admin div.result:nth-child(5n+1) { | ||
clear: both; | ||
} | ||
|
||
div.misdirection-testing.admin div.result div.h3 { | ||
text-decoration: underline; | ||
} | ||
|
||
div.mapped-link, | ||
div.redirect-link { | ||
width: 50%; | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.