1 | <?php |
||
18 | class SparkPlug |
||
19 | { |
||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $globals = []; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $server = []; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $path = ''; |
||
34 | |||
35 | /** |
||
36 | * @param array $globals |
||
37 | * @param array $server |
||
38 | * @param string $path |
||
39 | */ |
||
40 | 3 | public function __construct(array &$globals, array $server, $path = '') |
|
52 | |||
53 | /** |
||
54 | * Gets an instance of CodeIgniter. |
||
55 | * |
||
56 | * @return CodeIgniter |
||
57 | */ |
||
58 | 3 | public function getCodeIgniter() |
|
75 | |||
76 | /** |
||
77 | * Loads the Common and the Base Controller class. |
||
78 | * |
||
79 | * @return void |
||
80 | */ |
||
81 | 3 | protected function loadClasses() |
|
89 | |||
90 | /** |
||
91 | * Loads the framework constants. |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | 3 | protected function loadConstants() |
|
109 | |||
110 | /** |
||
111 | * Sets up important charset-related stuff. |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | 3 | protected function setCharSet() |
|
116 | { |
||
117 | 3 | $charset = strtoupper(config_item('charset')); |
|
118 | |||
119 | 3 | ini_set('default_charset', $charset); |
|
120 | |||
121 | 3 | if ( ! extension_loaded('mbstring')) { |
|
122 | define('MB_ENABLED', FALSE); |
||
123 | } |
||
124 | |||
125 | 3 | if ( ! defined('MB_ENABLED')) { |
|
126 | 3 | define('MB_ENABLED', TRUE); |
|
127 | 3 | } |
|
128 | |||
129 | // mbstring.internal_encoding is deprecated starting with PHP 5.6 |
||
130 | // and it's usage triggers E_DEPRECATED messages. |
||
131 | |||
132 | 3 | if ( ! is_php('5.6') && ! ini_get('mbstring.internal_encoding')) { |
|
133 | 2 | ini_set('mbstring.internal_encoding', $charset); |
|
134 | 2 | } |
|
135 | |||
136 | // This is required for mb_convert_encoding() to strip invalid |
||
137 | // characters. That's utilized by CI_Utf8, but it's also done for |
||
138 | // consistency with iconv. |
||
139 | 3 | mb_substitute_character('none'); |
|
140 | |||
141 | // There's an ICONV_IMPL constant, but the PHP manual says that using |
||
142 | // iconv's predefined constants is "strongly discouraged". |
||
143 | 3 | if ( ! defined('ICONV_ENABLED')) { |
|
144 | 3 | $isEnabled = extension_loaded('iconv') ? TRUE: FALSE; |
|
145 | |||
146 | 3 | define('ICONV_ENABLED', $isEnabled); |
|
147 | 3 | } |
|
148 | |||
149 | // iconv.internal_encoding is deprecated starting with PHP 5.6 |
||
150 | // and it's usage triggers E_DEPRECATED messages. |
||
151 | 3 | if ( ! is_php('5.6') && ! ini_get('iconv.internal_encoding')) { |
|
152 | ini_set('iconv.internal_encoding', $charset); |
||
153 | } |
||
154 | |||
155 | 3 | if (is_php('5.6')) { |
|
156 | 1 | ini_set('php.internal_encoding', $charset); |
|
157 | 1 | } |
|
158 | 3 | } |
|
159 | |||
160 | /** |
||
161 | * Sets up the current environment. |
||
162 | * |
||
163 | * @return void |
||
164 | */ |
||
165 | 3 | protected function setEnvironment() |
|
175 | |||
176 | /** |
||
177 | * Sets up the APPPATH, VENDOR, and BASEPATH constants. |
||
178 | * |
||
179 | * @return void |
||
180 | */ |
||
181 | 3 | protected function setPaths() |
|
223 | } |
||
224 |