Redirection - Version 2.5

Version Description

  • Fix no group created on install
  • Fix missing export key on install
  • Add 408 HTTP code, props to radenui
  • Fix imported URLs set to regex, props to alpipego
  • Fix sorting of URLs, props to JordanReiter
  • Don't cache 407s, props to rmarchant
  • Abort redirect exit if no redirection happened, props to junc
Download this release

Release Info

Developer johnny5
Plugin Icon 128x128 Redirection
Version 2.5
Comparing to
See all releases

Code changes from version 2.4.5 to 2.5

actions/random.php CHANGED
@@ -14,6 +14,7 @@ class Random_Action extends Red_Action {
14
  301 => get_status_header_desc( 301 ),
15
  302 => get_status_header_desc( 302 ),
16
  307 => get_status_header_desc( 307 ),
 
17
  );
18
  }
19
 
14
  301 => get_status_header_desc( 301 ),
15
  302 => get_status_header_desc( 302 ),
16
  307 => get_status_header_desc( 307 ),
17
+ 308 => get_status_header_desc( 308 ),
18
  );
19
  }
20
 
actions/url.php CHANGED
@@ -10,11 +10,14 @@ class Url_Action extends Red_Action {
10
  301 => get_status_header_desc( 301 ),
11
  302 => get_status_header_desc( 302 ),
12
  307 => get_status_header_desc( 307 ),
 
13
  );
14
  }
15
 
16
  function process_before( $code, $target ) {
17
- wp_redirect( $target, $code );
18
- die();
 
 
19
  }
20
  }
10
  301 => get_status_header_desc( 301 ),
11
  302 => get_status_header_desc( 302 ),
12
  307 => get_status_header_desc( 307 ),
13
+ 308 => get_status_header_desc( 308 ),
14
  );
15
  }
16
 
17
  function process_before( $code, $target ) {
18
+ $redirect = wp_redirect( $target, $code );
19
+ if ( $redirect ) {
20
+ die();
21
+ }
22
  }
23
  }
fileio/csv.php CHANGED
@@ -25,10 +25,15 @@ class Red_Csv_File extends Red_FileIO {
25
  $line->get_title(),
26
  );
27
 
28
- fputcsv( $stdout, $csv );
 
29
  }
30
  }
31
 
 
 
 
 
32
  function load( $group, $data, $filename = '' ) {
33
  $count = 0;
34
  $file = fopen( $filename, 'r' );
25
  $line->get_title(),
26
  );
27
 
28
+ $csv = array_map( array( $this, 'escape_csv' ), $csv );
29
+ fwrite( $stdout, join( $csv, ',') );
30
  }
31
  }
32
 
33
+ private function escape_csv( $item ) {
34
+ return '"'.str_replace( '"', '""', $item ).'"';
35
+ }
36
+
37
  function load( $group, $data, $filename = '' ) {
38
  $count = 0;
39
  $file = fopen( $filename, 'r' );
locale/redirection.pot CHANGED
@@ -15,219 +15,219 @@ msgstr ""
15
  "X-Poedit-SearchPathExcluded-0: *.js\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
17
 
18
- #: matches/login.php:27
19
  msgid "URL and login status"
20
  msgstr ""
21
 
22
- #: matches/login.php:36
23
  msgid "The target URL will be chosen from one of the following URLs, depending if the user is logged in or out. Leaving a URL blank means that the user is not redirected."
24
  msgstr ""
25
 
26
- #: matches/login.php:43, matches/login.php:45
27
  msgid "Logged In"
28
  msgstr ""
29
 
30
- #: matches/login.php:55, matches/login.php:57
31
  msgid "Logged Out"
32
  msgstr ""
33
 
34
- #: matches/referrer.php:28
35
  msgid "URL and referrer"
36
  msgstr ""
37
 
38
- #: matches/referrer.php:40, models/pager.php:479, models/pager.php:610
39
  msgid "Referrer"
40
  msgstr ""
41
 
42
- #: matches/referrer.php:43, view/item-edit.php:7
43
  msgid "Regex"
44
  msgstr ""
45
 
46
- #: matches/referrer.php:47, matches/referrer.php:57, matches/url.php:40, matches/user-agent.php:57
47
  msgid "HTTP Code"
48
  msgstr ""
49
 
50
- #: matches/referrer.php:65, matches/referrer.php:67, matches/user-agent.php:77, matches/user-agent.php:79
51
  msgid "Matched"
52
  msgstr ""
53
 
54
- #: matches/referrer.php:75, matches/referrer.php:77, matches/user-agent.php:87, matches/user-agent.php:89
55
  msgid "Not matched"
56
  msgstr ""
57
 
58
- #: matches/url.php:25
59
  msgid "URL only"
60
  msgstr ""
61
 
62
- #: matches/url.php:32, view/add.php:32
63
  msgid "Target URL"
64
  msgstr ""
65
 
66
- #: matches/user-agent.php:27
67
  msgid "URL and user agent"
68
  msgstr ""
69
 
70
- #: matches/user-agent.php:32
71
  msgid "FeedBurner"
72
  msgstr ""
73
 
74
- #: matches/user-agent.php:33
75
  msgid "Internet Explorer"
76
  msgstr ""
77
 
78
- #: matches/user-agent.php:34
79
  msgid "FireFox"
80
  msgstr ""
81
 
82
- #: matches/user-agent.php:35
83
  msgid "Opera"
84
  msgstr ""
85
 
86
- #: matches/user-agent.php:36
87
  msgid "Safari"
88
  msgstr ""
89
 
90
- #: matches/user-agent.php:37
91
  msgid "iPhone"
92
  msgstr ""
93
 
94
- #: matches/user-agent.php:38
95
  msgid "iPad"
96
  msgstr ""
97
 
98
- #: matches/user-agent.php:39
99
  msgid "Android"
100
  msgstr ""
101
 
102
- #: matches/user-agent.php:40
103
  msgid "Nintendo Wii"
104
  msgstr ""
105
 
106
- #: matches/user-agent.php:45
107
  msgid "User Agent"
108
  msgstr ""
109
 
110
- #: models/pager.php:27
111
  msgid "Type"
112
  msgstr ""
113
 
114
- #: models/pager.php:28
115
  msgid "URL"
116
  msgstr ""
117
 
118
- #: models/pager.php:29
119
  msgid "Hits"
120
  msgstr ""
121
 
122
- #: models/pager.php:30
123
  msgid "Last Access"
124
  msgstr ""
125
 
126
- #: models/pager.php:52, models/pager.php:252
127
  msgid "Edit"
128
  msgstr ""
129
 
130
- #: models/pager.php:53, models/pager.php:100, models/pager.php:253, models/pager.php:299, models/pager.php:497, models/pager.php:627, view/options.php:108
131
  msgid "Delete"
132
  msgstr ""
133
 
134
- #: models/pager.php:58, models/pager.php:102, models/pager.php:259, models/pager.php:301
135
  msgid "Disable"
136
  msgstr ""
137
 
138
- #: models/pager.php:60, models/pager.php:101, models/pager.php:261, models/pager.php:300
139
  msgid "Enable"
140
  msgstr ""
141
 
142
- #: models/pager.php:103
143
  msgid "Reset Hits"
144
  msgstr ""
145
 
146
- #: models/pager.php:150
147
  msgid "No group filter"
148
  msgstr ""
149
 
150
- #: models/pager.php:242, view/group-edit.php:4, view/group-list.php:30
151
  msgid "Name"
152
  msgstr ""
153
 
154
- #: models/pager.php:243, models/pager.php:709, view/submenu.php:6
155
  msgid "Redirects"
156
  msgstr ""
157
 
158
- #: models/pager.php:244, models/pager.php:708, view/group-edit.php:8
159
  msgid "Module"
160
  msgstr ""
161
 
162
- #: models/pager.php:254
163
  msgid "View Redirects"
164
  msgstr ""
165
 
166
- #: models/pager.php:278
167
  msgid "Unknown"
168
  msgstr ""
169
 
170
- #: models/pager.php:355
171
  msgid "All modules"
172
  msgstr ""
173
 
174
- #: models/pager.php:440, models/pager.php:574
175
  msgid "Add redirect"
176
  msgstr ""
177
 
178
- #: models/pager.php:477, models/pager.php:608
179
  msgid "Date"
180
  msgstr ""
181
 
182
- #: models/pager.php:478, models/pager.php:609, view/add.php:13, view/item-edit.php:4
183
  msgid "Source URL"
184
  msgstr ""
185
 
186
- #: models/pager.php:480, models/pager.php:611
187
  msgid "IP"
188
  msgstr ""
189
 
190
- #: models/pager.php:580
191
  msgid "Show only this IP"
192
  msgstr ""
193
 
194
- #: models/pager.php:719
195
  msgid "Configure"
196
  msgstr ""
197
 
198
- #: models/redirect.php:161
199
  msgid "Source and target URL must be different"
200
  msgstr ""
201
 
202
- #: models/redirect.php:167
203
  msgid "You can only redirect from a relative URL (<code>%s</code>) on this domain (<code>%s</code>)."
204
  msgstr ""
205
 
206
- #: models/redirect.php:175
207
  msgid "Invalid group when creating redirect"
208
  msgstr ""
209
 
210
- #: models/redirect.php:178
211
  msgid "Invalid source URL when creating redirect for given match type"
212
  msgstr ""
213
 
214
- #: models/redirect.php:384
215
  msgid "Redirect to URL"
216
  msgstr ""
217
 
218
- #: models/redirect.php:385
219
  msgid "Redirect to random post"
220
  msgstr ""
221
 
222
- #: models/redirect.php:386
223
  msgid "Pass-through"
224
  msgstr ""
225
 
226
- #: models/redirect.php:387
227
  msgid "Error (404)"
228
  msgstr ""
229
 
230
- #: models/redirect.php:388
231
  msgid "Do nothing"
232
  msgstr ""
233
 
@@ -287,69 +287,69 @@ msgstr ""
287
  msgid "For use with Nginx server. Requires manual configuration. The redirect happens without loading WordPress. No tracking of hits. This is an experimental module."
288
  msgstr ""
289
 
290
- #: modules/wordpress.php:127
291
  msgid "WordPress"
292
  msgstr ""
293
 
294
- #: modules/wordpress.php:131
295
  msgid "WordPress-powered redirects. This requires no further configuration, and you can track hits."
296
  msgstr ""
297
 
298
- #: redirection-admin.php:133
299
  msgid "Settings"
300
  msgstr ""
301
 
302
- #: redirection-admin.php:145
303
  msgid "Log entries"
304
  msgstr ""
305
 
306
- #: redirection-admin.php:156, redirection-admin.php:156
307
  msgid "Redirection"
308
  msgstr ""
309
 
310
- #: redirection-admin.php:223, redirection-admin.php:239
311
  msgid "Your options were updated"
312
  msgstr ""
313
 
314
- #: redirection-admin.php:248
315
  msgid "Redirection data has been deleted and the plugin disabled"
316
  msgstr ""
317
 
318
- #: redirection-admin.php:255
319
  msgid "%d redirection was successfully imported"
320
  msgid_plural "%d redirections were successfully imported"
321
  msgstr[0] ""
322
  msgstr[1] ""
323
 
324
- #: redirection-admin.php:257
325
  msgid "No items were imported"
326
  msgstr ""
327
 
328
- #: redirection-admin.php:269, redirection-admin.php:289
329
  msgid "Your logs have been deleted"
330
  msgstr ""
331
 
332
- #: redirection-admin.php:303
333
  msgid "Your group was added successfully"
334
  msgstr ""
335
 
336
- #: redirection-admin.php:306
337
  msgid "Please specify a group name"
338
  msgstr ""
339
 
340
- #: redirection-admin.php:482
341
  msgid "Sorry, but your redirection was not created"
342
  msgstr ""
343
 
344
- #: redirection-admin.php:488
345
  msgid "Invalid module"
346
  msgstr ""
347
 
348
- #: redirection-admin.php:504
349
  msgid "Download"
350
  msgstr ""
351
 
352
- #: redirection-admin.php:505, view/group-edit.php:22, view/item-edit.php:33, view/module-edit.php:13
353
  msgid "Cancel"
354
  msgstr ""
355
 
15
  "X-Poedit-SearchPathExcluded-0: *.js\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
17
 
18
+ #: matches/login.php:7
19
  msgid "URL and login status"
20
  msgstr ""
21
 
22
+ #: matches/login.php:16
23
  msgid "The target URL will be chosen from one of the following URLs, depending if the user is logged in or out. Leaving a URL blank means that the user is not redirected."
24
  msgstr ""
25
 
26
+ #: matches/login.php:23, matches/login.php:25
27
  msgid "Logged In"
28
  msgstr ""
29
 
30
+ #: matches/login.php:35, matches/login.php:37
31
  msgid "Logged Out"
32
  msgstr ""
33
 
34
+ #: matches/referrer.php:8
35
  msgid "URL and referrer"
36
  msgstr ""
37
 
38
+ #: matches/referrer.php:21, models/pager.php:480, models/pager.php:611
39
  msgid "Referrer"
40
  msgstr ""
41
 
42
+ #: matches/referrer.php:24, view/item-edit.php:7
43
  msgid "Regex"
44
  msgstr ""
45
 
46
+ #: matches/referrer.php:28, matches/referrer.php:38, matches/url.php:20, matches/user-agent.php:38
47
  msgid "HTTP Code"
48
  msgstr ""
49
 
50
+ #: matches/referrer.php:46, matches/referrer.php:48, matches/user-agent.php:58, matches/user-agent.php:60
51
  msgid "Matched"
52
  msgstr ""
53
 
54
+ #: matches/referrer.php:56, matches/referrer.php:58, matches/user-agent.php:68, matches/user-agent.php:70
55
  msgid "Not matched"
56
  msgstr ""
57
 
58
+ #: matches/url.php:5
59
  msgid "URL only"
60
  msgstr ""
61
 
62
+ #: matches/url.php:12, view/add.php:32
63
  msgid "Target URL"
64
  msgstr ""
65
 
66
+ #: matches/user-agent.php:7
67
  msgid "URL and user agent"
68
  msgstr ""
69
 
70
+ #: matches/user-agent.php:12
71
  msgid "FeedBurner"
72
  msgstr ""
73
 
74
+ #: matches/user-agent.php:13
75
  msgid "Internet Explorer"
76
  msgstr ""
77
 
78
+ #: matches/user-agent.php:14
79
  msgid "FireFox"
80
  msgstr ""
81
 
82
+ #: matches/user-agent.php:15
83
  msgid "Opera"
84
  msgstr ""
85
 
86
+ #: matches/user-agent.php:16
87
  msgid "Safari"
88
  msgstr ""
89
 
90
+ #: matches/user-agent.php:17
91
  msgid "iPhone"
92
  msgstr ""
93
 
94
+ #: matches/user-agent.php:18
95
  msgid "iPad"
96
  msgstr ""
97
 
98
+ #: matches/user-agent.php:19
99
  msgid "Android"
100
  msgstr ""
101
 
102
+ #: matches/user-agent.php:20
103
  msgid "Nintendo Wii"
104
  msgstr ""
105
 
106
+ #: matches/user-agent.php:25
107
  msgid "User Agent"
108
  msgstr ""
109
 
110
+ #: models/pager.php:28
111
  msgid "Type"
112
  msgstr ""
113
 
114
+ #: models/pager.php:29
115
  msgid "URL"
116
  msgstr ""
117
 
118
+ #: models/pager.php:30
119
  msgid "Hits"
120
  msgstr ""
121
 
122
+ #: models/pager.php:31
123
  msgid "Last Access"
124
  msgstr ""
125
 
126
+ #: models/pager.php:53, models/pager.php:253
127
  msgid "Edit"
128
  msgstr ""
129
 
130
+ #: models/pager.php:54, models/pager.php:101, models/pager.php:254, models/pager.php:300, models/pager.php:498, models/pager.php:628, view/options.php:108
131
  msgid "Delete"
132
  msgstr ""
133
 
134
+ #: models/pager.php:59, models/pager.php:103, models/pager.php:260, models/pager.php:302
135
  msgid "Disable"
136
  msgstr ""
137
 
138
+ #: models/pager.php:61, models/pager.php:102, models/pager.php:262, models/pager.php:301
139
  msgid "Enable"
140
  msgstr ""
141
 
142
+ #: models/pager.php:104
143
  msgid "Reset Hits"
144
  msgstr ""
145
 
146
+ #: models/pager.php:151
147
  msgid "No group filter"
148
  msgstr ""
149
 
150
+ #: models/pager.php:243, view/group-edit.php:4, view/group-list.php:30
151
  msgid "Name"
152
  msgstr ""
153
 
154
+ #: models/pager.php:244, models/pager.php:710, view/submenu.php:6
155
  msgid "Redirects"
156
  msgstr ""
157
 
158
+ #: models/pager.php:245, models/pager.php:709, view/group-edit.php:8
159
  msgid "Module"
160
  msgstr ""
161
 
162
+ #: models/pager.php:255
163
  msgid "View Redirects"
164
  msgstr ""
165
 
166
+ #: models/pager.php:279
167
  msgid "Unknown"
168
  msgstr ""
169
 
170
+ #: models/pager.php:356
171
  msgid "All modules"
172
  msgstr ""
173
 
174
+ #: models/pager.php:441, models/pager.php:575
175
  msgid "Add redirect"
176
  msgstr ""
177
 
178
+ #: models/pager.php:478, models/pager.php:609
179
  msgid "Date"
180
  msgstr ""
181
 
182
+ #: models/pager.php:479, models/pager.php:610, view/add.php:13, view/item-edit.php:4
183
  msgid "Source URL"
184
  msgstr ""
185
 
186
+ #: models/pager.php:481, models/pager.php:612
187
  msgid "IP"
188
  msgstr ""
189
 
190
+ #: models/pager.php:581
191
  msgid "Show only this IP"
192
  msgstr ""
193
 
194
+ #: models/pager.php:720
195
  msgid "Configure"
196
  msgstr ""
197
 
198
+ #: models/redirect.php:160
199
  msgid "Source and target URL must be different"
200
  msgstr ""
201
 
202
+ #: models/redirect.php:166
203
  msgid "You can only redirect from a relative URL (<code>%s</code>) on this domain (<code>%s</code>)."
204
  msgstr ""
205
 
206
+ #: models/redirect.php:174
207
  msgid "Invalid group when creating redirect"
208
  msgstr ""
209
 
210
+ #: models/redirect.php:177
211
  msgid "Invalid source URL when creating redirect for given match type"
212
  msgstr ""
213
 
214
+ #: models/redirect.php:394
215
  msgid "Redirect to URL"
216
  msgstr ""
217
 
218
+ #: models/redirect.php:395
219
  msgid "Redirect to random post"
220
  msgstr ""
221
 
222
+ #: models/redirect.php:396
223
  msgid "Pass-through"
224
  msgstr ""
225
 
226
+ #: models/redirect.php:397
227
  msgid "Error (404)"
228
  msgstr ""
229
 
230
+ #: models/redirect.php:398
231
  msgid "Do nothing"
232
  msgstr ""
233
 
287
  msgid "For use with Nginx server. Requires manual configuration. The redirect happens without loading WordPress. No tracking of hits. This is an experimental module."
288
  msgstr ""
289
 
290
+ #: modules/wordpress.php:133
291
  msgid "WordPress"
292
  msgstr ""
293
 
294
+ #: modules/wordpress.php:137
295
  msgid "WordPress-powered redirects. This requires no further configuration, and you can track hits."
296
  msgstr ""
297
 
298
+ #: redirection-admin.php:139
299
  msgid "Settings"
300
  msgstr ""
301
 
302
+ #: redirection-admin.php:151
303
  msgid "Log entries"
304
  msgstr ""
305
 
306
+ #: redirection-admin.php:162, redirection-admin.php:162
307
  msgid "Redirection"
308
  msgstr ""
309
 
310
+ #: redirection-admin.php:229, redirection-admin.php:245
311
  msgid "Your options were updated"
312
  msgstr ""
313
 
314
+ #: redirection-admin.php:254
315
  msgid "Redirection data has been deleted and the plugin disabled"
316
  msgstr ""
317
 
318
+ #: redirection-admin.php:261
319
  msgid "%d redirection was successfully imported"
320
  msgid_plural "%d redirections were successfully imported"
321
  msgstr[0] ""
322
  msgstr[1] ""
323
 
324
+ #: redirection-admin.php:263
325
  msgid "No items were imported"
326
  msgstr ""
327
 
328
+ #: redirection-admin.php:275, redirection-admin.php:295
329
  msgid "Your logs have been deleted"
330
  msgstr ""
331
 
332
+ #: redirection-admin.php:309
333
  msgid "Your group was added successfully"
334
  msgstr ""
335
 
336
+ #: redirection-admin.php:312
337
  msgid "Please specify a group name"
338
  msgstr ""
339
 
340
+ #: redirection-admin.php:488
341
  msgid "Sorry, but your redirection was not created"
342
  msgstr ""
343
 
344
+ #: redirection-admin.php:494
345
  msgid "Invalid module"
346
  msgstr ""
347
 
348
+ #: redirection-admin.php:510
349
  msgid "Download"
350
  msgstr ""
351
 
352
+ #: redirection-admin.php:511, view/group-edit.php:22, view/item-edit.php:33, view/module-edit.php:13
353
  msgid "Cancel"
354
  msgstr ""
355
 
matches/referrer.php CHANGED
@@ -13,6 +13,7 @@ class Referrer_Match extends Red_Match {
13
  301 => get_status_header_desc( 301 ),
14
  302 => get_status_header_desc( 302 ),
15
  307 => get_status_header_desc( 307 ),
 
16
  );
17
 
18
  ?>
13
  301 => get_status_header_desc( 301 ),
14
  302 => get_status_header_desc( 302 ),
15
  307 => get_status_header_desc( 307 ),
16
+ 308 => get_status_header_desc( 308 ),
17
  );
18
 
19
  ?>
models/database.php CHANGED
@@ -94,7 +94,7 @@ class RE_Database {
94
  }
95
 
96
  // Groups
97
- if ( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_groups" ) === 0 ) {
98
  $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Redirections' ), 'module_id' => 1, 'position' => 0 ) );
99
  $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Modified Posts' ), 'module_id' => 1, 'position' => 1 ) );
100
 
94
  }
95
 
96
  // Groups
97
+ if ( intval( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_groups", 10 ) ) === 0 ) {
98
  $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Redirections' ), 'module_id' => 1, 'position' => 0 ) );
99
  $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Modified Posts' ), 'module_id' => 1, 'position' => 1 ) );
100
 
models/htaccess.php CHANGED
@@ -110,10 +110,10 @@ class Red_Htaccess {
110
  return sprintf( '%s [L]', $this->encode2nd( $data ), $code );
111
  }
112
 
113
- private function action_error( $data, $code, $regex) {
114
- if ( $code === '410' )
115
- return '/ [G,L]';
116
- return '/ [F,L]';
117
  }
118
 
119
  private function action_url( $data, $code, $regex ) {
110
  return sprintf( '%s [L]', $this->encode2nd( $data ), $code );
111
  }
112
 
113
+ private function action_error( $data, $code, $regex ) {
114
+ if ( $code === 410 )
115
+ return '/ [G]';
116
+ return '/ [F]';
117
  }
118
 
119
  private function action_url( $data, $code, $regex ) {
models/redirect.php CHANGED
@@ -100,7 +100,7 @@ class Red_Item {
100
  if ( $first['position'] === $second['position'] )
101
  return 0;
102
 
103
- return $first['position'] < $second['position'];
104
  }
105
 
106
  static function reduce_sorted_items( $item ) {
@@ -176,7 +176,7 @@ class Red_Item {
176
  if ( ! $matcher )
177
  return new WP_Error( 'redirect-add', __( 'Invalid source URL when creating redirect for given match type', 'redirection' ) );
178
 
179
- $regex = ( isset( $details['regex'] ) && $details['regex'] !== false ) ? 1 : 0;
180
  $position = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group_id ) );
181
 
182
  $action = $details['red_action'];
100
  if ( $first['position'] === $second['position'] )
101
  return 0;
102
 
103
+ return ($first['position'] < $second['position']) ? -1 : 1;
104
  }
105
 
106
  static function reduce_sorted_items( $item ) {
176
  if ( ! $matcher )
177
  return new WP_Error( 'redirect-add', __( 'Invalid source URL when creating redirect for given match type', 'redirection' ) );
178
 
179
+ $regex = ( isset( $details['regex'] ) && (bool) $details['regex'] !== false ) ? 1 : 0;
180
  $position = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group_id ) );
181
 
182
  $action = $details['red_action'];
modules/wordpress.php CHANGED
@@ -102,7 +102,12 @@ class WordPress_Module extends Red_Module {
102
  }
103
  }
104
  }
105
-
 
 
 
 
 
106
  status_header( $status );
107
  return $url;
108
  }
102
  }
103
  }
104
  }
105
+ elseif ( $status == 307) {
106
+ status_header( $status );
107
+ header( "Cache-Control: no-cache, must-revalidate, max-age=0" );
108
+ header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" );
109
+ return $url;
110
+ }
111
  status_header( $status );
112
  return $url;
113
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: johnny5
3
  Donate link: http://urbangiraffe.com/about/
4
  Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
5
- Requires at least: 4.1
6
- Tested up to: 4.6
7
- Stable tag: 2.4.5
8
 
9
  Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
10
 
@@ -97,6 +97,15 @@ The plugin works in a similar manner to how WordPress handles permalinks and sho
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
 
 
100
  = 2.4.5 =
101
  * Ensure cleanup code runs even if plugin was updated
102
  * Extra sanitization of Apache & Nginx files, props to Ed Shirey
2
  Contributors: johnny5
3
  Donate link: http://urbangiraffe.com/about/
4
  Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
5
+ Requires at least: 4.2
6
+ Tested up to: 4.7
7
+ Stable tag: 2.5
8
 
9
  Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 2.5 =
101
+ * Fix no group created on install
102
+ * Fix missing export key on install
103
+ * Add 408 HTTP code, props to radenui
104
+ * Fix imported URLs set to regex, props to alpipego
105
+ * Fix sorting of URLs, props to JordanReiter
106
+ * Don't cache 407s, props to rmarchant
107
+ * Abort redirect exit if no redirection happened, props to junc
108
+
109
  = 2.4.5 =
110
  * Ensure cleanup code runs even if plugin was updated
111
  * Extra sanitization of Apache & Nginx files, props to Ed Shirey
redirection-admin.php CHANGED
@@ -46,6 +46,8 @@ class Redirection_Admin {
46
  public static function plugin_activated() {
47
  Redirection_Admin::update();
48
  Red_Flusher::schedule();
 
 
49
  }
50
 
51
  public static function plugin_deactivated() {
@@ -57,6 +59,8 @@ class Redirection_Admin {
57
 
58
  $db = new RE_Database();
59
  $db->remove( REDIRECTION_FILE );
 
 
60
  }
61
 
62
  private function render( $template, $template_vars = array() ) {
46
  public static function plugin_activated() {
47
  Redirection_Admin::update();
48
  Red_Flusher::schedule();
49
+
50
+ update_option( 'redirection_options', red_get_options() );
51
  }
52
 
53
  public static function plugin_deactivated() {
59
 
60
  $db = new RE_Database();
61
  $db->remove( REDIRECTION_FILE );
62
+
63
+ delete_option( 'redirection_options' );
64
  }
65
 
66
  private function render( $template, $template_vars = array() ) {
redirection.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Redirection
4
  Plugin URI: http://urbangiraffe.com/plugins/redirection/
5
  Description: Manage all your 301 redirects and monitor 404 errors
6
- Version: 2.4.5
7
  Author: John Godley
8
  Author URI: http://urbangiraffe.com
9
  Text Domain: redirection
3
  Plugin Name: Redirection
4
  Plugin URI: http://urbangiraffe.com/plugins/redirection/
5
  Description: Manage all your 301 redirects and monitor 404 errors
6
+ Version: 2.5
7
  Author: John Godley
8
  Author URI: http://urbangiraffe.com
9
  Text Domain: redirection
view/item-list.php CHANGED
@@ -2,7 +2,7 @@
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
 
5
- <h2><?php _e( 'Redirections', 'redirection' ); ?>:</h2>
6
 
7
  <?php $this->render( 'submenu', array( 'options' => $options ) ); ?>
8
 
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
 
5
+ <h2><?php _e( 'Redirections', 'redirection' ); ?></h2>
6
 
7
  <?php $this->render( 'submenu', array( 'options' => $options ) ); ?>
8