forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Controller.php
executable file
·125 lines (117 loc) · 2.68 KB
/
Controller.php
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
/**
* CodeIgniter Application Controller Class
*
* This class object is the base class that connects each controller to the core object
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller {
/**
* Reference to CodeIgniter object
*
* @var object
* @access protected
*/
protected $CI;
/**
* Constructor
*
* @param object parent reference
*/
public function __construct(CodeIgniter $CI)
{
// Attach parent reference
$this->CI =& $CI;
$CI->log_message('debug', get_class($this).' Controller Class Initialized');
}
/**
* Show 404
*
* This function exits Controller operation and informs the user that the
* requested page could not be found. It is mainly for use inside _remap().
*
* @param string requested page
* @param boolean FALSE to skip logging
* @return void
*/
public function show_404($page = '', $log_error = TRUE)
{
// Just throw the exception - CodeIgniter will catch it
$log_msg = ($page && $log_error) ? '404 Page Not Found --> '.$page : '';
throw new CI_Show_error('The page you requested was not found.', '404 Page Not Found', 404, $log_msg,
'error_404');
}
/**
* End operation
*
* This function exits Controller operation and goes directly to
* the final hooks and output display in CodeIgniter.
*
* @return void
*/
public function end_run()
{
// Just throw the exception - CodeIgniter will catch it
throw new CI_End_run();
}
/**
* Get magic method
*
* Exposes core object members
*
* @param string member name
* @return mixed
*/
public function __get($key)
{
if (isset($this->CI->$key))
{
return $this->CI->$key;
}
}
/**
* Isset magic method
*
* Tests core object member existence
*
* @param string member name
* @return boolean
*/
public function __isset($key)
{
return isset($this->CI->$key);
}
/**
* Get instance
*
* Returns reference to core object
*
* @return object Core instance
*/
public static function &instance()
{
// Return core instance
return CodeIgniter::instance();
}
}
// END Controller class
/* End of file Controller.php */
/* Location: ./system/core/Controller.php */