Skip to content

Commit

Permalink
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
jdfm committed Oct 31, 2012
2 parents a9a1d25 + f2b19fe commit 3ccc386
Show file tree
Hide file tree
Showing 52 changed files with 1,399 additions and 1,104 deletions.
11 changes: 6 additions & 5 deletions application/config/config.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@
| URI string. The default setting of 'AUTO' works for most servers. | URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors: | If your links do not seem to work, try one of the other delicious flavors:
| |
| 'AUTO' Default - auto detects | 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO | 'CLI' or 'argv' Uses $_SERVER['argv'] (for php-cli only)
| 'QUERY_STRING' Uses the QUERY_STRING | 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'REQUEST_URI' Uses the REQUEST_URI | 'PATH_INFO' Uses $_SERVER['PATH_INFO']
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO | 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'ORIG_PATH_INFO' Uses $_SERVER['ORIG_PATH_INFO']
| |
*/ */
$config['uri_protocol'] = 'AUTO'; $config['uri_protocol'] = 'AUTO';
Expand Down
4 changes: 2 additions & 2 deletions application/config/routes.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
| |
| $route['404_override'] = 'errors/page_missing'; | $route['404_override'] = 'errors/page_missing';
| |
| This route will tell the Router what URI segments to use if those provided | This route will tell the Router which controller/method to use if those
| in the URL cannot be matched to a valid route. | provided in the URL cannot be matched to a valid route.
| |
*/ */


Expand Down
32 changes: 18 additions & 14 deletions system/core/Benchmark.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/ */


/** /**
* CodeIgniter Benchmark Class * Benchmark Class
* *
* This class enables you to mark points and calculate the time difference * This class enables you to mark points and calculate the time difference
* between them. Memory consumption can also be displayed. * between them. Memory consumption can also be displayed.
Expand All @@ -40,21 +40,19 @@
class CI_Benchmark { class CI_Benchmark {


/** /**
* List of all benchmark markers and when they were added * List of all benchmark markers
* *
* @var array * @var array
*/ */
public $marker = array(); public $marker = array();

// --------------------------------------------------------------------


/** /**
* Set a benchmark marker * Set a benchmark marker
* *
* Multiple calls to this function can be made so that several * Multiple calls to this function can be made so that several
* execution points can be timed * execution points can be timed.
* *
* @param string $name name of the marker * @param string $name Marker name
* @return void * @return void
*/ */
public function mark($name) public function mark($name)
Expand All @@ -65,17 +63,22 @@ public function mark($name)
// -------------------------------------------------------------------- // --------------------------------------------------------------------


/** /**
* Elapsed time
*
* Calculates the time difference between two marked points. * Calculates the time difference between two marked points.
* *
* If the first parameter is empty this function instead returns the * If the first parameter is empty this function instead returns the
* {elapsed_time} pseudo-variable. This permits the full system * {elapsed_time} pseudo-variable. This permits the full system
* execution time to be shown in a template. The output class will * execution time to be shown in a template. The output class will
* swap the real value for this variable. * swap the real value for this variable.
* *
* @param string a particular marked point * @param string $point1 A particular marked point
* @param string a particular marked point * @param string $point2 A particular marked point
* @param integer the number of decimal places * @param int $decimals Number of decimal places
* @return mixed *
* @return string Calculated elapsed time on success,
* an '{elapsed_string}' if $point1 is empty
* or an empty string if $point1 is not found.
*/ */
public function elapsed_time($point1 = '', $point2 = '', $decimals = 4) public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
{ {
Expand All @@ -102,12 +105,13 @@ public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
/** /**
* Memory Usage * Memory Usage
* *
* This function returns the {memory_usage} pseudo-variable. * Simply returns the {memory_usage} marker.
*
* This permits it to be put it anywhere in a template * This permits it to be put it anywhere in a template
* without the memory being calculated until the end. * without the memory being calculated until the end.
* The output class will swap the real value for this variable. * The output class will swap the real value for this variable.
* *
* @return string * @return string '{memory_usage}'
*/ */
public function memory_usage() public function memory_usage()
{ {
Expand Down
8 changes: 5 additions & 3 deletions system/core/CodeIgniter.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@
$CFG =& load_class('Config', 'core'); $CFG =& load_class('Config', 'core');


// Do we have any manually set config items in the index.php file? // Do we have any manually set config items in the index.php file?
if (isset($assign_to_config)) if (isset($assign_to_config) && is_array($assign_to_config))
{ {
$CFG->_assign_to_config($assign_to_config); foreach ($assign_to_config as $key => $value)
{
$CFG->set_item($key, $value);
}
} }


/* /*
Expand Down Expand Up @@ -229,7 +232,6 @@ function &get_instance()
return CI_Controller::get_instance(); return CI_Controller::get_instance();
} }



if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
{ {
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'; require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
Expand Down
80 changes: 34 additions & 46 deletions system/core/Config.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/ */


/** /**
* CodeIgniter Config Class * Config Class
* *
* This class contains functions that enable config files to be managed * This class contains functions that enable config files to be managed
* *
Expand All @@ -41,29 +41,31 @@ class CI_Config {
/** /**
* List of all loaded config values * List of all loaded config values
* *
* @var array * @var array
*/ */
public $config = array(); public $config = array();


/** /**
* List of all loaded config files * List of all loaded config files
* *
* @var array * @var array
*/ */
public $is_loaded = array(); public $is_loaded = array();


/** /**
* List of paths to search when trying to load a config file. * List of paths to search when trying to load a config file.
* This must be public as it's used by the Loader class.
* *
* @var array * @used-by CI_Loader
* @var array
*/ */
public $_config_paths = array(APPPATH); public $_config_paths = array(APPPATH);


/** /**
* Constructor * Class constructor
* *
* Sets the $config data from the primary config.php file as a class variable * Sets the $config data from the primary config.php file as a class variable.
*
* @return void
*/ */
public function __construct() public function __construct()
{ {
Expand Down Expand Up @@ -93,10 +95,10 @@ public function __construct()
/** /**
* Load Config File * Load Config File
* *
* @param string the config file name * @param string $file Configuration file name
* @param bool if configuration values should be loaded into their own section * @param bool $use_sections Whether configuration values should be loaded into their own section
* @param bool true if errors should just return false, false if an error message should be displayed * @param bool $fail_gracefully Whether to just return FALSE or display an error message
* @return bool if the file was loaded correctly * @return bool TRUE if the file was loaded correctly or FALSE on failure
*/ */
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{ {
Expand Down Expand Up @@ -183,9 +185,9 @@ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE
/** /**
* Fetch a config file item * Fetch a config file item
* *
* @param string the config item name * @param string $item Config item name
* @param string the index name * @param string $index Index name
* @return string * @return string|bool The configuration item or FALSE on failure
*/ */
public function item($item, $index = '') public function item($item, $index = '')
{ {
Expand All @@ -200,10 +202,10 @@ public function item($item, $index = '')
// -------------------------------------------------------------------- // --------------------------------------------------------------------


/** /**
* Fetch a config file item - adds slash after item (if item is not empty) * Fetch a config file item with slash appended (if not empty)
* *
* @param string the config item name * @param string $item Config item name
* @return string * @return string|bool The configuration item or FALSE on failure
*/ */
public function slash_item($item) public function slash_item($item)
{ {
Expand All @@ -223,9 +225,12 @@ public function slash_item($item)


/** /**
* Site URL * Site URL
*
* Returns base_url . index_page [. uri_string] * Returns base_url . index_page [. uri_string]
* *
* @param mixed the URI string or an array of segments * @uses CI_Config::_uri_string()
*
* @param string|string[] $uri URI string or an array of segments
* @return string * @return string
*/ */
public function site_url($uri = '') public function site_url($uri = '')
Expand Down Expand Up @@ -264,9 +269,12 @@ public function site_url($uri = '')


/** /**
* Base URL * Base URL
*
* Returns base_url [. uri_string] * Returns base_url [. uri_string]
* *
* @param string $uri * @uses CI_Config::_uri_string()
*
* @param string|string[] $uri URI string or an array of segments
* @return string * @return string
*/ */
public function base_url($uri = '') public function base_url($uri = '')
Expand All @@ -277,9 +285,12 @@ public function base_url($uri = '')
// ------------------------------------------------------------- // -------------------------------------------------------------


/** /**
* Build URI string for use in Config::site_url() and Config::base_url() * Build URI string
*
* @used-by CI_Config::site_url()
* @used-by CI_Config::base_url()
* *
* @param mixed $uri * @param string|string[] $uri URI string or an array of segments
* @return string * @return string
*/ */
protected function _uri_string($uri) protected function _uri_string($uri)
Expand Down Expand Up @@ -318,38 +329,15 @@ public function system_url()
/** /**
* Set a config file item * Set a config file item
* *
* @param string the config item key * @param string $item Config item key
* @param string the config item value * @param string $value Config item value
* @return void * @return void
*/ */
public function set_item($item, $value) public function set_item($item, $value)
{ {
$this->config[$item] = $value; $this->config[$item] = $value;
} }


// --------------------------------------------------------------------

/**
* Assign to Config
*
* This function is called by the front controller (CodeIgniter.php)
* after the Config class is instantiated. It permits config items
* to be assigned or overriden by variables contained in the index.php file
*
* @param array
* @return void
*/
public function _assign_to_config($items = array())
{
if (is_array($items))
{
foreach ($items as $key => $val)
{
$this->set_item($key, $val);
}
}
}

} }


/* End of file Config.php */ /* End of file Config.php */
Expand Down
11 changes: 6 additions & 5 deletions system/core/Controller.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/ */


/** /**
* CodeIgniter Application Controller Class * Application Controller Class
* *
* This class object is the super class that every library in * This class object is the super class that every library in
* CodeIgniter will be assigned to. * CodeIgniter will be assigned to.
Expand All @@ -40,15 +40,14 @@
class CI_Controller { class CI_Controller {


/** /**
* Reference to the global CI instance * Reference to the CI singleton
* *
* @static
* @var object * @var object
*/ */
private static $instance; private static $instance;


/** /**
* Set up controller properties and methods * Class constructor
* *
* @return void * @return void
*/ */
Expand All @@ -69,8 +68,10 @@ public function __construct()
log_message('debug', 'Controller Class Initialized'); log_message('debug', 'Controller Class Initialized');
} }


// --------------------------------------------------------------------

/** /**
* Return the CI object * Get the CI singleton
* *
* @static * @static
* @return object * @return object
Expand Down
Loading

0 comments on commit 3ccc386

Please sign in to comment.