forked from pixelfear/EE-fourofour
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpi.fourofour.php
More file actions
70 lines (56 loc) · 1.44 KB
/
pi.fourofour.php
File metadata and controls
70 lines (56 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Four O Four Plugin
*
* @package ExpressionEngine
* @subpackage Addons
* @category Plugin
* @author Jason Varga
* @link http://jvdesigns.com.au
*/
$plugin_info = array(
'pi_name' => 'Four O Four',
'pi_version' => '1.0',
'pi_author' => 'Jason Varga',
'pi_author_url' => 'http://jvdesigns.com.au',
'pi_description'=> 'Performs a 301 redirect to your 404 page.',
'pi_usage' => Fourofour::usage()
);
class Fourofour {
public $return_data;
/**
* Constructor
*/
public function __construct()
{
$this->EE =& get_instance();
$this->EE->TMPL->template_type = 'cp_asset';
}
public function redirect()
{
$page = config_item('site_404');
$this->EE->output->set_status_header(301);
$this->EE->output->set_header('Location: ' . $page);
}
public function page()
{
$this->EE->output->set_status_header(404);
}
// ----------------------------------------------------------------
/**
* Plugin Usage
*/
public static function usage()
{
ob_start();
?>
To perform a 301 redirect to your 404 page, replace your {redirect="404"} tag with {exp:fourofour:redirect}.
On your 404 page, you need to enforce 404 headers by adding {exp:fourofour:page}.
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
}
/* End of file pi.fourofour.php */
/* Location: /system/expressionengine/third_party/fourofour/pi.fourofour.php */