Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Greg Aker | 741de1c | 2010-11-10 14:52:57 -0600 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.1.6 or newer |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame^] | 7 | * NOTICE OF LICENSE |
| 8 | * |
| 9 | * Licensed under the Open Software License version 3.0 |
| 10 | * |
| 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
| 18 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 19 | * @package CodeIgniter |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame^] | 20 | * @author EllisLab Dev Team |
| 21 | * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) |
| 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 23 | * @link http://codeigniter.com |
| 24 | * @since Version 1.0 |
| 25 | * @filesource |
| 26 | */ |
| 27 | |
| 28 | // ------------------------------------------------------------------------ |
| 29 | |
| 30 | /** |
| 31 | * CodeIgniter Config Class |
| 32 | * |
| 33 | * This class contains functions that enable config files to be managed |
| 34 | * |
| 35 | * @package CodeIgniter |
| 36 | * @subpackage Libraries |
| 37 | * @category Libraries |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame^] | 38 | * @author EllisLab Dev Team |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 39 | * @link http://codeigniter.com/user_guide/libraries/config.html |
| 40 | */ |
| 41 | class CI_Config { |
| 42 | |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 43 | /** |
| 44 | * List of all loaded config values |
| 45 | * |
| 46 | * @var array |
| 47 | */ |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 48 | var $config = array(); |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 49 | /** |
| 50 | * List of all loaded config files |
| 51 | * |
| 52 | * @var array |
| 53 | */ |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 54 | var $is_loaded = array(); |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 55 | /** |
| 56 | * List of paths to search when trying to load a config file |
| 57 | * |
| 58 | * @var array |
| 59 | */ |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 60 | var $_config_paths = array(APPPATH); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Constructor |
| 64 | * |
| 65 | * Sets the $config data from the primary config.php file as a class variable |
| 66 | * |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 67 | * @access public |
| 68 | * @param string the config file name |
| 69 | * @param boolean if configuration values should be loaded into their own section |
| 70 | * @param boolean true if errors should just return false, false if an error message should be displayed |
| 71 | * @return boolean if the file was successfully loaded or not |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 72 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 73 | function __construct() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 74 | { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 75 | $this->config =& get_config(); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 76 | log_message('debug', "Config Class Initialized"); |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 77 | |
| 78 | // Set the base_url automatically if none was provided |
| 79 | if ($this->config['base_url'] == '') |
| 80 | { |
Pascal Kriete | 5d5895f | 2011-02-14 13:27:07 -0500 | [diff] [blame] | 81 | if (isset($_SERVER['HTTP_HOST'])) |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 82 | { |
Phil Sturgeon | fb55238 | 2010-12-15 14:29:21 +0000 | [diff] [blame] | 83 | $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 84 | $base_url .= '://'. $_SERVER['HTTP_HOST']; |
Eric Barnes | 32dbac2 | 2011-04-26 22:51:32 -0400 | [diff] [blame] | 85 | $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | else |
| 89 | { |
| 90 | $base_url = 'http://localhost/'; |
| 91 | } |
| 92 | |
| 93 | $this->set_item('base_url', $base_url); |
| 94 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 95 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 96 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 97 | // -------------------------------------------------------------------- |
| 98 | |
| 99 | /** |
| 100 | * Load Config File |
| 101 | * |
| 102 | * @access public |
| 103 | * @param string the config file name |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 104 | * @param boolean if configuration values should be loaded into their own section |
| 105 | * @param boolean true if errors should just return false, false if an error message should be displayed |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 106 | * @return boolean if the file was loaded correctly |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 107 | */ |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 108 | function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) |
| 109 | { |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 110 | $file = ($file == '') ? 'config' : str_replace('.php', '', $file); |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 111 | $found = FALSE; |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 112 | $loaded = FALSE; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 113 | |
Pascal Kriete | 5d5895f | 2011-02-14 13:27:07 -0500 | [diff] [blame] | 114 | foreach ($this->_config_paths as $path) |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 115 | { |
| 116 | $check_locations = defined('ENVIRONMENT') |
| 117 | ? array(ENVIRONMENT.'/'.$file, $file) |
| 118 | : array($file); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 119 | |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 120 | foreach ($check_locations as $location) |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 121 | { |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 122 | $file_path = $path.'config/'.$location.'.php'; |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 123 | |
| 124 | if (in_array($file_path, $this->is_loaded, TRUE)) |
| 125 | { |
| 126 | $loaded = TRUE; |
| 127 | continue 2; |
| 128 | } |
| 129 | |
| 130 | if (file_exists($file_path)) |
| 131 | { |
| 132 | $found = TRUE; |
| 133 | break; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | if ($found === FALSE) |
| 138 | { |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 139 | continue; |
| 140 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 141 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 142 | include($file_path); |
| 143 | |
| 144 | if ( ! isset($config) OR ! is_array($config)) |
| 145 | { |
| 146 | if ($fail_gracefully === TRUE) |
| 147 | { |
| 148 | return FALSE; |
| 149 | } |
| 150 | show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); |
| 151 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 152 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 153 | if ($use_sections === TRUE) |
| 154 | { |
| 155 | if (isset($this->config[$file])) |
| 156 | { |
| 157 | $this->config[$file] = array_merge($this->config[$file], $config); |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | $this->config[$file] = $config; |
| 162 | } |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | $this->config = array_merge($this->config, $config); |
| 167 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 168 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 169 | $this->is_loaded[] = $file_path; |
| 170 | unset($config); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 171 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 172 | $loaded = TRUE; |
| 173 | log_message('debug', 'Config file loaded: '.$file_path); |
katzgrau | d127e61 | 2011-04-22 10:59:25 -0400 | [diff] [blame] | 174 | break; |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 175 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 176 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 177 | if ($loaded === FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 178 | { |
| 179 | if ($fail_gracefully === TRUE) |
| 180 | { |
| 181 | return FALSE; |
| 182 | } |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 183 | show_error('The configuration file '.$file.'.php'.' does not exist.'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 184 | } |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 185 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 186 | return TRUE; |
| 187 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 188 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 189 | // -------------------------------------------------------------------- |
| 190 | |
| 191 | /** |
| 192 | * Fetch a config file item |
| 193 | * |
| 194 | * |
| 195 | * @access public |
| 196 | * @param string the config item name |
| 197 | * @param string the index name |
| 198 | * @param bool |
| 199 | * @return string |
| 200 | */ |
| 201 | function item($item, $index = '') |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 202 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 203 | if ($index == '') |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 204 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 205 | if ( ! isset($this->config[$item])) |
| 206 | { |
| 207 | return FALSE; |
| 208 | } |
| 209 | |
| 210 | $pref = $this->config[$item]; |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | if ( ! isset($this->config[$index])) |
| 215 | { |
| 216 | return FALSE; |
| 217 | } |
| 218 | |
| 219 | if ( ! isset($this->config[$index][$item])) |
| 220 | { |
| 221 | return FALSE; |
| 222 | } |
| 223 | |
| 224 | $pref = $this->config[$index][$item]; |
| 225 | } |
| 226 | |
| 227 | return $pref; |
| 228 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 229 | |
| 230 | // -------------------------------------------------------------------- |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 231 | |
| 232 | /** |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 233 | * Fetch a config file item - adds slash after item (if item is not empty) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 234 | * |
| 235 | * @access public |
| 236 | * @param string the config item name |
| 237 | * @param bool |
| 238 | * @return string |
| 239 | */ |
| 240 | function slash_item($item) |
| 241 | { |
| 242 | if ( ! isset($this->config[$item])) |
| 243 | { |
| 244 | return FALSE; |
| 245 | } |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 246 | if( trim($this->config[$item]) == '') |
| 247 | { |
| 248 | return ''; |
| 249 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 250 | |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 251 | return rtrim($this->config[$item], '/').'/'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 252 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 253 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 254 | // -------------------------------------------------------------------- |
| 255 | |
| 256 | /** |
| 257 | * Site URL |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 258 | * Returns base_url . index_page [. uri_string] |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 259 | * |
| 260 | * @access public |
| 261 | * @param string the URI string |
| 262 | * @return string |
| 263 | */ |
| 264 | function site_url($uri = '') |
| 265 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 266 | if ($uri == '') |
| 267 | { |
Phil Sturgeon | 4df8b22 | 2010-12-15 14:23:14 +0000 | [diff] [blame] | 268 | return $this->slash_item('base_url').$this->item('index_page'); |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | if ($this->item('enable_query_strings') == FALSE) |
| 272 | { |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 273 | $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix'); |
| 274 | return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix; |
| 275 | } |
| 276 | else |
| 277 | { |
| 278 | return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri); |
| 279 | } |
| 280 | } |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 281 | |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 282 | // ------------------------------------------------------------- |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 283 | |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 284 | /** |
| 285 | * Base URL |
| 286 | * Returns base_url [. uri_string] |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 287 | * |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 288 | * @access public |
| 289 | * @param string $uri |
| 290 | * @return string |
| 291 | */ |
| 292 | function base_url($uri = '') |
| 293 | { |
| 294 | return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/'); |
| 295 | } |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 296 | |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 297 | // ------------------------------------------------------------- |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 298 | |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 299 | /** |
| 300 | * Build URI string for use in Config::site_url() and Config::base_url() |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 301 | * |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 302 | * @access protected |
| 303 | * @param $uri |
| 304 | * @return string |
| 305 | */ |
| 306 | protected function _uri_string($uri) |
| 307 | { |
| 308 | if ($this->item('enable_query_strings') == FALSE) |
| 309 | { |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 310 | if (is_array($uri)) |
| 311 | { |
| 312 | $uri = implode('/', $uri); |
| 313 | } |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 314 | $uri = trim($uri, '/'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 315 | } |
| 316 | else |
| 317 | { |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 318 | if (is_array($uri)) |
| 319 | { |
| 320 | $i = 0; |
| 321 | $str = ''; |
| 322 | foreach ($uri as $key => $val) |
| 323 | { |
| 324 | $prefix = ($i == 0) ? '' : '&'; |
| 325 | $str .= $prefix.$key.'='.$val; |
| 326 | $i++; |
| 327 | } |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 328 | $uri = $str; |
| 329 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 330 | } |
anaxamaxan@blackdog.local | d09c51a | 2011-02-02 23:00:16 -0800 | [diff] [blame] | 331 | return $uri; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 332 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 333 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 334 | // -------------------------------------------------------------------- |
David Behler | 2d2c9c6 | 2011-08-14 20:03:08 +0200 | [diff] [blame] | 335 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 336 | /** |
| 337 | * System URL |
| 338 | * |
| 339 | * @access public |
| 340 | * @return string |
| 341 | */ |
| 342 | function system_url() |
| 343 | { |
| 344 | $x = explode("/", preg_replace("|/*(.+?)/*$|", "\\1", BASEPATH)); |
| 345 | return $this->slash_item('base_url').end($x).'/'; |
| 346 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 347 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 348 | // -------------------------------------------------------------------- |
| 349 | |
| 350 | /** |
| 351 | * Set a config file item |
| 352 | * |
| 353 | * @access public |
| 354 | * @param string the config item key |
| 355 | * @param string the config item value |
| 356 | * @return void |
| 357 | */ |
| 358 | function set_item($item, $value) |
| 359 | { |
| 360 | $this->config[$item] = $value; |
| 361 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 362 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 363 | // -------------------------------------------------------------------- |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 364 | |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 365 | /** |
| 366 | * Assign to Config |
| 367 | * |
| 368 | * This function is called by the front controller (CodeIgniter.php) |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 369 | * after the Config class is instantiated. It permits config items |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 370 | * to be assigned or overriden by variables contained in the index.php file |
| 371 | * |
| 372 | * @access private |
| 373 | * @param array |
| 374 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 375 | */ |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 376 | function _assign_to_config($items = array()) |
| 377 | { |
| 378 | if (is_array($items)) |
| 379 | { |
| 380 | foreach ($items as $key => $val) |
| 381 | { |
| 382 | $this->set_item($key, $val); |
| 383 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 384 | } |
Derek Jones | 6d743e2 | 2010-03-02 13:22:03 -0600 | [diff] [blame] | 385 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | // END CI_Config class |
| 389 | |
| 390 | /* End of file Config.php */ |
katzgrau | d127e61 | 2011-04-22 10:59:25 -0400 | [diff] [blame] | 391 | /* Location: ./system/core/Config.php */ |