Skip to content
This repository was archived by the owner on Jan 10, 2021. It is now read-only.

Commit 7332db4

Browse files
author
Nathan Glasl
committed
SS4.
1 parent 9ce82e5 commit 7332db4

31 files changed

+449
-780
lines changed

.upgrade.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
mappings:
2+
MisdirectionAdmin: 'nglasl\misdirection\MisdirectionAdmin'
3+
MisdirectionAdminTestingExtension: 'nglasl\misdirection\MisdirectionAdminTestingExtension'
4+
MisdirectionFallbackExtension: 'nglasl\misdirection\MisdirectionFallbackExtension'
5+
SiteTreeMisdirectionExtension: 'nglasl\misdirection\SiteTreeMisdirectionExtension'
6+
MisdirectionTesting: 'nglasl\misdirection\MisdirectionTesting'
7+
LinkMapping: 'nglasl\misdirection\LinkMapping'
8+
MisdirectionRequestFilter: 'nglasl\misdirection\MisdirectionRequestFilter'
9+
MisdirectionService: 'nglasl\misdirection\MisdirectionService'
10+
MisdirectionFunctionalTests: 'nglasl\misdirection\tests\MisdirectionFunctionalTests'
11+
MisdirectionUnitTests: 'nglasl\misdirection\tests\MisdirectionUnitTests'

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# [misdirection](https://packagist.org/packages/nglasl/silverstripe-misdirection)
22

3-
_The current release is **2.2.26**_
3+
_The current release is **3.0.0**_
44

5-
> 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.
5+
> 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.
66
77
## Requirement
88

9-
* SilverStripe 3.1 → **3.5**
9+
* SilverStripe 3.1 → **4.0**
1010

1111
This module does **not** require the CMS.
1212

@@ -24,25 +24,25 @@ This module does **not** require the CMS.
2424

2525
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.
2626

27-
![link-mapping](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-link-mapping.png)
27+
![link-mapping](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-link-mapping.png)
2828

2929
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:
3030

3131
```yaml
32-
MisdirectionRequestFilter:
32+
nglasl\misdirection\MisdirectionRequestFilter:
3333
enforce_misdirection: false
3434
```
3535
3636
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:
3737
3838
```yaml
39-
LinkMapping:
39+
nglasl\misdirection\LinkMapping:
4040
priority: 'DESC'
4141
```
4242
4343
### Vanity URLs and Fallbacks
4444
45-
![vanity-URLs-and-fallbacks](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-vanity-URLs-and-fallbacks.png)
45+
![vanity-URLs-and-fallbacks](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-vanity-URLs-and-fallbacks.png)
4646
4747
#### Vanity URLs
4848
@@ -61,16 +61,16 @@ The link mappings are processed server side to prevent inefficient and problemat
6161

6262
When you want to see exactly what is happening behind the scenes for a given URL, the model admin provides a powerful testing interface!
6363

64-
![testing](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-testing.png)
64+
![testing](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-testing.png)
6565

6666
Once a maximum number of requests has been reached, the server will respond with a page not found. The following is the default configuration:
6767

6868
```yaml
69-
MisdirectionRequestFilter:
69+
nglasl\misdirection\MisdirectionRequestFilter:
7070
maximum_requests: 9
7171
```
7272

73-
![testing-maximum-requests](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/images/misdirection-testing-maximum-requests.png)
73+
![testing-maximum-requests](https://raw.githubusercontent.com/nglasl/silverstripe-misdirection/master/client/images/misdirection-testing-maximum-requests.png)
7474

7575
#### Bypassing Misdirection
7676

@@ -81,16 +81,12 @@ It is possible to bypass the request filter completely by appending `?misdirecte
8181
This may be completely replaced, in which case legacy URLs will no longer resolve based on page version history.
8282

8383
```yaml
84-
MisdirectionRequestFilter:
84+
nglasl\misdirection\MisdirectionRequestFilter:
8585
replace_default: true
8686
```
8787

8888
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.
8989

90-
#### Historical Link Mappings
91-
92-
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`.
93-
9490
## Maintainer Contact
9591

9692
Nathan Glasl, nathan@symbiote.com.au

_config.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

_config/extensions.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
name: misdirection-extensions
33
---
4-
MisdirectionAdmin:
4+
nglasl\misdirection\MisdirectionAdmin:
55
extensions:
6-
- 'MisdirectionAdminTestingExtension'
7-
SiteTree:
6+
- 'nglasl\misdirection\MisdirectionAdminTestingExtension'
7+
SilverStripe\CMS\Model\SiteTree:
88
extensions:
9-
- 'SiteTreeMisdirectionExtension'
10-
- 'MisdirectionFallbackExtension'
11-
SiteConfig:
9+
- 'nglasl\misdirection\SiteTreeMisdirectionExtension'
10+
- 'nglasl\misdirection\MisdirectionFallbackExtension'
11+
SilverStripe\SiteConfig\SiteConfig:
1212
extensions:
13-
- 'MisdirectionFallbackExtension'
13+
- 'nglasl\misdirection\MisdirectionFallbackExtension'

_config/request-filters.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: misdirection-request-filters
33
---
4-
Injector:
5-
RequestProcessor:
4+
SilverStripe\Core\Injector\Injector:
5+
SilverStripe\Control\RequestProcessor:
66
properties:
77
filters:
8-
- '%$MisdirectionRequestFilter'
8+
- '%$nglasl\misdirection\MisdirectionRequestFilter'

_config/upgrade.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: misdirection-upgrade
3+
---
4+
SilverStripe\ORM\DatabaseAdmin:
5+
classname_value_remapping:
6+
LinkMapping: 'nglasl\misdirection\LinkMapping'

client/css/misdirection.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
/**
3+
* The misdirection specific styling.
4+
* @author Nathan Glasl <nathan@symbiote.com.au>
5+
*/
6+
7+
div.misdirection-testing.admin {
8+
background: #005A93;
9+
color: white;
10+
padding: 10px;
11+
-moz-border-radius: 5px;
12+
-webkit-border-radius: 5px;
13+
border-radius: 5px;
14+
}
15+
16+
div.misdirection-testing.admin div {
17+
margin-bottom: 10px;
18+
}
19+
20+
div.misdirection-testing.admin div.wrapper {
21+
white-space: nowrap;
22+
}
23+
24+
div.misdirection-testing.admin input.url {
25+
display: inline-block;
26+
vertical-align: middle;
27+
}
28+
29+
div.misdirection-testing.admin span.test.disabled {
30+
filter: Alpha(opacity = 40);
31+
opacity: 0.4;
32+
cursor: not-allowed;
33+
}
34+
35+
div.misdirection-testing.admin div.results {
36+
overflow: hidden;
37+
margin-bottom: 0;
38+
}
39+
40+
/* Preload the required image to avoid performance issues. */
41+
42+
body:after {
43+
display: none;
44+
content: url('../images/loading.gif');
45+
}
46+
47+
div.misdirection-testing.admin div.results.loading {
48+
min-height: 40px;
49+
background: url('../images/loading.gif') no-repeat left center;
50+
}
51+
52+
div.misdirection-testing.admin div.result {
53+
float: left;
54+
width: 18%;
55+
margin: 10px 1% 0;
56+
}
57+
58+
div.misdirection-testing.admin div.result:not(.no-matches) {
59+
word-wrap: break-word;
60+
}
61+
62+
/* This is used to correct the float height issue, however will not be supported by IE8. */
63+
64+
div.misdirection-testing.admin div.result:nth-child(5n+1) {
65+
clear: both;
66+
}
67+
68+
div.misdirection-testing.admin div.result div.h3 {
69+
text-decoration: underline;
70+
}
71+
72+
div.mapped-link,
73+
div.redirect-link {
74+
width: 50%;
75+
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)