summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rwxr-xr-xsystem/core/Benchmark.php6
-rwxr-xr-xsystem/core/CodeIgniter.php2
-rw-r--r--system/core/Common.php6
-rwxr-xr-xsystem/core/Config.php27
-rw-r--r--system/core/Controller.php7
-rwxr-xr-xsystem/core/Exceptions.php12
-rwxr-xr-xsystem/core/Hooks.php6
-rwxr-xr-xsystem/core/Input.php31
-rw-r--r--system/core/Loader.php35
-rwxr-xr-xsystem/core/Model.php3
-rwxr-xr-xsystem/core/Output.php18
-rwxr-xr-xsystem/core/Router.php30
-rwxr-xr-xsystem/core/Security.php29
-rwxr-xr-xsystem/core/URI.php67
-rw-r--r--system/core/Utf8.php4
15 files changed, 143 insertions, 140 deletions
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index c17e95a19..bb630f40b 100755
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -25,13 +25,11 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Benchmark Class
*
* 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.
*
* @package CodeIgniter
* @subpackage Libraries
@@ -119,4 +117,4 @@ class CI_Benchmark {
}
/* End of file Benchmark.php */
-/* Location: ./system/core/Benchmark.php */
+/* Location: ./system/core/Benchmark.php */ \ No newline at end of file
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 349f9f2d0..00db6e13a 100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -31,7 +31,7 @@
* Loads the base classes and executes the request.
*
* @package CodeIgniter
- * @subpackage codeigniter
+ * @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
diff --git a/system/core/Common.php b/system/core/Common.php
index 78aa6e874..8b897776f 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -31,7 +31,7 @@
* Loads the base classes and executes the request.
*
* @package CodeIgniter
- * @subpackage codeigniter
+ * @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
@@ -57,7 +57,7 @@ if ( ! function_exists('is_php'))
if ( ! isset($_is_php[$version]))
{
- $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE;
+ $_is_php[$version] = (version_compare(PHP_VERSION, $version) >= 0);
}
return $_is_php[$version];
@@ -506,7 +506,7 @@ if ( ! function_exists('_exception_handler'))
$_error->show_php_error($severity, $message, $filepath, $line);
}
- // Should we log the error? No? We're done...
+ // Should we log the error? No? We're done...
if (config_item('log_threshold') == 0)
{
return;
diff --git a/system/core/Config.php b/system/core/Config.php
index 9cebe6c86..c07ffa591 100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Config Class
*
@@ -46,14 +44,14 @@ class CI_Config {
* @var array
*/
public $config = array();
-
+
/**
* List of all loaded config files
*
* @var array
*/
public $is_loaded = array();
-
+
/**
* List of paths to search when trying to load a config file.
* This must be public as it's used by the Loader class.
@@ -77,9 +75,9 @@ class CI_Config {
{
if (isset($_SERVER['HTTP_HOST']))
{
- $base_url = ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
- $base_url .= '://'. $_SERVER['HTTP_HOST']
- . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
+ $base_url = ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http';
+ $base_url .= '://'.$_SERVER['HTTP_HOST']
+ .str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
else
{
@@ -96,9 +94,9 @@ class CI_Config {
* Load Config File
*
* @param string the config file name
- * @param boolean if configuration values should be loaded into their own section
- * @param boolean true if errors should just return false, false if an error message should be displayed
- * @return boolean if the file was loaded correctly
+ * @param bool if 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
+ * @return bool if the file was loaded correctly
*/
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
@@ -254,8 +252,8 @@ class CI_Config {
* Base URL
* Returns base_url [. uri_string]
*
- * @param string $uri
- * @return string
+ * @param string $uri
+ * @return string
*/
public function base_url($uri = '')
{
@@ -267,8 +265,8 @@ class CI_Config {
/**
* Build URI string for use in Config::site_url() and Config::base_url()
*
- * @param mixed $uri
- * @return string
+ * @param mixed $uri
+ * @return string
*/
protected function _uri_string($uri)
{
@@ -345,6 +343,7 @@ class CI_Config {
}
}
}
+
}
/* End of file Config.php */
diff --git a/system/core/Controller.php b/system/core/Controller.php
index 1f69146d0..491414807 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -48,6 +48,8 @@ class CI_Controller {
/**
* Set up controller properties and methods
+ *
+ * @return void
*/
public function __construct()
{
@@ -67,14 +69,15 @@ class CI_Controller {
}
/**
- * Return the CI object
+ * Return the CI object
*
- * @return object
+ * @return object
*/
public static function &get_instance()
{
return self::$instance;
}
+
}
/* End of file Controller.php */
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 2e9f0c766..965a717ad 100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -65,6 +65,8 @@ class CI_Exceptions {
/**
* Initialize execption class
+ *
+ * @return void
*/
public function __construct()
{
@@ -87,7 +89,7 @@ class CI_Exceptions {
*/
public function log_exception($severity, $message, $filepath, $line)
{
- $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
+ $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
@@ -127,14 +129,14 @@ class CI_Exceptions {
* @param string the heading
* @param string the message
* @param string the template name
- * @param int the status code
+ * @param int the status code
* @return string
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
set_status_header($status_code);
- $message = '<p>'.implode('</p><p>', ( ! is_array($message)) ? array($message) : $message).'</p>';
+ $message = '<p>'.implode('</p><p>', is_array($message) ? $message : array($message)).'</p>';
if (ob_get_level() > $this->ob_level + 1)
{
@@ -160,7 +162,7 @@ class CI_Exceptions {
*/
public function show_php_error($severity, $message, $filepath, $line)
{
- $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
+ $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
$filepath = str_replace('\\', '/', $filepath);
// For safety reasons we do not show the full file path
@@ -175,7 +177,7 @@ class CI_Exceptions {
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/'.'error_php.php');
+ include(APPPATH.'errors/error_php.php');
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index b42ecbe20..5bbb0009a 100755
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -44,14 +44,14 @@ class CI_Hooks {
* @var bool
*/
public $enabled = FALSE;
-
+
/**
* List of all hooks set in config/hooks.php
*
* @var array
*/
public $hooks = array();
-
+
/**
* Determines wether hook is in progress, used to prevent infinte loops
*
@@ -152,7 +152,7 @@ class CI_Hooks {
// If the script being called happens to have the same
// hook call within it a loop can happen
- if ($this->in_progress == TRUE)
+ if ($this->in_progress === TRUE)
{
return;
}
diff --git a/system/core/Input.php b/system/core/Input.php
index fc2a550bc..e916ac66d 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -44,28 +44,28 @@ class CI_Input {
* @var string
*/
public $ip_address = FALSE;
-
+
/**
* user agent (web browser) being used by the current user
*
* @var string
*/
public $user_agent = FALSE;
-
+
/**
* If FALSE, then $_GET will be set to an empty array
*
* @var bool
*/
protected $_allow_get_array = TRUE;
-
+
/**
* If TRUE, then newlines are standardized
*
* @var bool
*/
protected $_standardize_newlines = TRUE;
-
+
/**
* Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered
* Set automatically based on config setting
@@ -73,7 +73,7 @@ class CI_Input {
* @var bool
*/
protected $_enable_xss = FALSE;
-
+
/**
* Enables a CSRF cookie token to be set.
* Set automatically based on config setting
@@ -81,7 +81,7 @@ class CI_Input {
* @var bool
*/
protected $_enable_csrf = FALSE;
-
+
/**
* List of all HTTP request headers
*
@@ -94,6 +94,8 @@ class CI_Input {
*
* Sets whether to globally enable the XSS processing
* and whether to allow the $_GET array
+ *
+ * @return void
*/
public function __construct()
{
@@ -438,15 +440,7 @@ class CI_Input {
// This is effectively the same as register_globals = off
foreach (array($_GET, $_POST, $_COOKIE) as $global)
{
- if ( ! is_array($global))
- {
- if ( ! in_array($global, $protected))
- {
- global $$global;
- $$global = NULL;
- }
- }
- else
+ if (is_array($global))
{
foreach ($global as $key => $val)
{
@@ -457,6 +451,11 @@ class CI_Input {
}
}
}
+ elseif ( ! in_array($global, $protected))
+ {
+ global $$global;
+ $$global = NULL;
+ }
}
// Is $_GET data allowed? If not we'll set the $_GET to an empty array
@@ -605,7 +604,7 @@ class CI_Input {
* In Apache, you can simply call apache_request_headers(), however for
* people running other webservers the function is undefined.
*
- * @param bool XSS cleaning
+ * @param bool XSS cleaning
* @return array
*/
public function request_headers($xss_clean = FALSE)
diff --git a/system/core/Loader.php b/system/core/Loader.php
index bf7f6cb02..3eb09e6ab 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -32,8 +32,8 @@
*
* @package CodeIgniter
* @subpackage Libraries
- * @author EllisLab Dev Team
* @category Loader
+ * @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/loader.html
*/
class CI_Loader {
@@ -45,77 +45,77 @@ class CI_Loader {
* @var int
*/
protected $_ci_ob_level;
-
+
/**
* List of paths to load views from
*
* @var array
*/
protected $_ci_view_paths = array();
-
+
/**
* List of paths to load libraries from
*
* @var array
*/
protected $_ci_library_paths = array();
-
+
/**
* List of paths to load models from
*
* @var array
*/
protected $_ci_model_paths = array();
-
+
/**
* List of paths to load helpers from
*
* @var array
*/
protected $_ci_helper_paths = array();
-
+
/**
* List of loaded base classes
*
* @var array
*/
protected $_base_classes = array(); // Set by the controller class
-
+
/**
* List of cached variables
*
* @var array
*/
protected $_ci_cached_vars = array();
-
+
/**
* List of loaded classes
*
* @var array
*/
protected $_ci_classes = array();
-
+
/**
* List of loaded files
*
* @var array
*/
protected $_ci_loaded_files = array();
-
+
/**
* List of loaded models
*
* @var array
*/
protected $_ci_models = array();
-
+
/**
* List of loaded helpers
*
* @var array
*/
protected $_ci_helpers = array();
-
+
/**
* List of class name mappings
*
@@ -130,6 +130,8 @@ class CI_Loader {
* Constructor
*
* Sets the path to the view files and gets the initial output buffering level
+ *
+ * @return void
*/
public function __construct()
{
@@ -178,12 +180,7 @@ class CI_Loader {
*/
public function is_loaded($class)
{
- if (isset($this->_ci_classes[$class]))
- {
- return $this->_ci_classes[$class];
- }
-
- return FALSE;
+ return isset($this->_ci_classes[$class]) ? $this->_ci_classes[$class] : FALSE;
}
// --------------------------------------------------------------------
@@ -1263,4 +1260,4 @@ class CI_Loader {
}
/* End of file Loader.php */
-/* Location: ./system/core/Loader.php */
+/* Location: ./system/core/Loader.php */ \ No newline at end of file
diff --git a/system/core/Model.php b/system/core/Model.php
index 7c9971970..9bc9f879f 100755
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -38,6 +38,8 @@ class CI_Model {
/**
* Initialize CI_Model Class
+ *
+ * @return void
*/
public function __construct()
{
@@ -57,6 +59,7 @@ class CI_Model {
$CI =& get_instance();
return $CI->$key;
}
+
}
/* End of file Model.php */
diff --git a/system/core/Output.php b/system/core/Output.php
index 513c657a6..c8feb4e67 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -44,49 +44,49 @@ class CI_Output {
* @var string
*/
public $final_output;
-
+
/**
* Cache expiration time
*
* @var int
*/
public $cache_expiration = 0;
-
+
/**
* List of server headers
*
* @var array
*/
public $headers = array();
-
+
/**
* List of mime types
*
* @var array
*/
public $mime_types = array();
-
+
/**
* Determines wether profiler is enabled
*
* @var book
*/
public $enable_profiler = FALSE;
-
+
/**
* Determines if output compression is enabled
*
* @var bool
*/
protected $_zlib_oc = FALSE;
-
+
/**
* List of profiler sections
*
* @var array
*/
protected $_profiler_sections = array();
-
+
/**
* Whether or not to parse variables like {elapsed_time} and {memory_usage}
*
@@ -96,6 +96,8 @@ class CI_Output {
/**
* Set up Output class
+ *
+ * @return void
*/
public function __construct()
{
@@ -177,7 +179,7 @@ class CI_Output {
*
* Lets you set a server header which will be outputted with the final display.
*
- * Note: If a file is cached, headers will not be sent. We need to figure out
+ * Note: If a file is cached, headers will not be sent. We need to figure out
* how to permit header data to be saved with the cache data...
*
* @param string
diff --git a/system/core/Router.php b/system/core/Router.php
index fe9909b06..5ea13797b 100755
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -32,8 +32,8 @@
*
* @package CodeIgniter
* @subpackage Libraries
- * @author EllisLab Dev Team
* @category Libraries
+ * @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/general/routing.html
*/
class CI_Router {
@@ -44,42 +44,42 @@ class CI_Router {
* @var object
*/
public $config;
-
+
/**
* List of routes
*
* @var array
*/
public $routes = array();
-
+
/**
* List of error routes
*
* @var array
*/
public $error_routes = array();
-
+
/**
* Current class name
*
* @var string
*/
- public $class = '';
-
+ public $class = '';
+
/**
* Current method name
*
* @var string
*/
public $method = 'index';
-
+
/**
* Sub-directory that contains the requested controller class
*
* @var string
*/
public $directory = '';
-
+
/**
* Default controller (and method if specific)
*
@@ -91,6 +91,8 @@ class CI_Router {
* Constructor
*
* Runs the route mapping function.
+ *
+ * @return void
*/
public function __construct()
{
@@ -242,12 +244,9 @@ class CI_Router {
$segments[1] = 'index';
}
- // This is being routed to a file in a sub directory
- $this->directory and array_unshift($segments, trim($this->directory, '/'));
-
// Update our "routed" segment array to contain the segments.
// Note: If there is no custom routing, this array will be
- // identical to $this->uri->segments
+ // identical to $this->uri->segments
$this->uri->rsegments = $segments;
}
@@ -436,12 +435,7 @@ class CI_Router {
*/
public function fetch_method()
{
- if ($this->method == $this->fetch_class())
- {
- return 'index';
- }
-
- return $this->method;
+ return ($this->method == $this->fetch_class()) ? 'index' : $this->method;
}
// --------------------------------------------------------------------
diff --git a/system/core/Security.php b/system/core/Security.php
index 974e2e428..81b6602ae 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -95,15 +95,18 @@ class CI_Security {
*
* @var array
*/
- protected $_never_allowed_regex = array(
+ protected $_never_allowed_regex = array(
'javascript\s*:',
'expression\s*(\(|&\#40;)', // CSS and IE
'vbscript\s*:', // IE, surprise!
- 'Redirect\s+302'
+ 'Redirect\s+302',
+ "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?"
);
/**
* Initialize security class
+ *
+ * @return void
*/
public function __construct()
{
@@ -200,11 +203,11 @@ class CI_Security {
}
setcookie(
- $this->_csrf_cookie_name,
- $this->_csrf_hash,
- $expire,
- config_item('cookie_path'),
- config_item('cookie_domain'),
+ $this->_csrf_cookie_name,
+ $this->_csrf_hash,
+ $expire,
+ config_item('cookie_path'),
+ config_item('cookie_domain'),
$secure_cookie,
config_item('cookie_httponly')
);
@@ -365,10 +368,11 @@ class CI_Security {
* These words are compacted back to their correct state.
*/
$words = array(
- 'javascript', 'expression', 'vbscript', 'script',
+ 'javascript', 'expression', 'vbscript', 'script', 'base64',
'applet', 'alert', 'document', 'write', 'cookie', 'window'
);
+
foreach ($words as $word)
{
$word = implode('\s*', str_split($word)).'\s*';
@@ -605,10 +609,11 @@ class CI_Security {
$attribs = array();
// find occurrences of illegal attribute strings without quotes
- preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s]*)/is', $str, $matches, PREG_SET_ORDER);
+ preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', $str, $matches, PREG_SET_ORDER);
foreach ($matches as $attr)
{
+
$attribs[] = preg_quote($attr[0], '/');
}
@@ -623,7 +628,7 @@ class CI_Security {
// replace illegal attribute strings that are inside an html tag
if (count($attribs) > 0)
{
- $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z\-])('.implode('|', $attribs).')([\s><])([><]*)/i', '<$1$2$4$5', $str, -1, $count);
+ $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)('.implode('|', $attribs).')(.*?)([\s><])([><]*)/i', '<$1 $3$5$6$7', $str, -1, $count);
}
} while ($count);
@@ -664,7 +669,7 @@ class CI_Security {
protected function _js_link_removal($match)
{
return str_replace($match[1],
- preg_replace('#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si',
+ preg_replace('#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|<script|<xss|data\s*:)#si',
'',
$this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]))
),
@@ -804,7 +809,7 @@ class CI_Security {
foreach ($this->_never_allowed_regex as $regex)
{
- $str = preg_replace('#'.$regex.'#i', '[removed]', $str);
+ $str = preg_replace('#'.$regex.'#is', '[removed]', $str);
}
return $str;
diff --git a/system/core/URI.php b/system/core/URI.php
index 705575a0c..e66cb6dc5 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -22,6 +22,7 @@
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
+ * @filesource
*/
/**
@@ -43,21 +44,21 @@ class CI_URI {
* @var array
*/
public $keyval = array();
-
+
/**
* Current uri string
*
* @var string
*/
public $uri_string;
-
+
/**
* List of uri segments
*
* @var array
*/
public $segments = array();
-
+
/**
* Re-indexed list of uri segments
* Starts at 1 instead of 0
@@ -72,6 +73,8 @@ class CI_URI {
* Simply globalizes the $RTR object. The front
* loads the Router class early on so it's not available
* normally as other classes are.
+ *
+ * @return void
*/
public function __construct()
{
@@ -148,7 +151,7 @@ class CI_URI {
return;
}
- $path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
+ $path = isset($_SERVER[$uri]) ? $_SERVER[$uri] : @getenv($uri);
$this->_set_uri_string($path);
}
@@ -181,7 +184,7 @@ class CI_URI {
*/
protected function _detect_uri()
{
- if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME']))
+ if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']))
{
return '';
}
@@ -227,20 +230,19 @@ class CI_URI {
}
// --------------------------------------------------------------------
-
+
/**
* Is cli Request?
*
* Duplicate of function from the Input class to test to see if a request was made from the command line
*
- * @return boolean
+ * @return bool
*/
protected function _is_cli_request()
{
- return (php_sapi_name() == 'cli') OR defined('STDIN');
+ return (php_sapi_name() === 'cli') OR defined('STDIN');
}
-
// --------------------------------------------------------------------
/**
@@ -253,7 +255,7 @@ class CI_URI {
protected function _parse_cli_args()
{
$args = array_slice($_SERVER['argv'], 1);
- return $args ? '/' . implode('/', $args) : '';
+ return $args ? '/'.implode('/', $args) : '';
}
// --------------------------------------------------------------------
@@ -327,7 +329,7 @@ class CI_URI {
}
// --------------------------------------------------------------------
-
+
/**
* Re-index Segments
*
@@ -355,13 +357,13 @@ class CI_URI {
*
* This function returns the URI segment based on the number provided.
*
- * @param integer
+ * @param int
* @param bool
* @return string
*/
public function segment($n, $no_result = FALSE)
{
- return ( ! isset($this->segments[$n])) ? $no_result : $this->segments[$n];
+ return isset($this->segments[$n]) ? $this->segments[$n] : $no_result;
}
// --------------------------------------------------------------------
@@ -370,16 +372,16 @@ class CI_URI {
* Fetch a URI "routed" Segment
*
* This function returns the re-routed URI segment (assuming routing rules are used)
- * based on the number provided. If there is no routing this function returns the
+ * based on the number provided. If there is no routing this function returns the
* same result as $this->segment()
*
- * @param integer
+ * @param int
* @param bool
* @return string
*/
public function rsegment($n, $no_result = FALSE)
{
- return ( ! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n];
+ return isset($this->rsegments[$n]) ? $this->rsegments[$n] : $no_result;
}
// --------------------------------------------------------------------
@@ -400,7 +402,7 @@ class CI_URI {
* gender => male
* )
*
- * @param integer the starting segment number
+ * @param int the starting segment number
* @param array an array of default values
* @return array
*/
@@ -408,13 +410,13 @@ class CI_URI {
{
return $this->_uri_to_assoc($n, $default, 'segment');
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Identical to above only it uses the re-routed segment array
*
- * @param integer the starting segment number
+ * @param int the starting segment number
* @param array an array of default values
* @return array
*/
@@ -428,7 +430,7 @@ class CI_URI {
/**
* Generate a key value pair from the URI string or Re-routed URI string
*
- * @param integer the starting segment number
+ * @param int the starting segment number
* @param array an array of default values
* @param string which array we should use
* @return array
@@ -458,12 +460,9 @@ class CI_URI {
if ($this->$total_segments() < $n)
{
- if (count($default) === 0)
- {
- return array();
- }
-
- return array_fill_keys($default, FALSE);
+ return (count($default) === 0)
+ ? array()
+ : array_fill_keys($default, FALSE);
}
$segments = array_slice($this->$segment_array(), ($n - 1));
@@ -512,7 +511,7 @@ class CI_URI {
public function assoc_to_uri($array)
{
$temp = array();
- foreach ((array)$array as $key => $val)
+ foreach ( (array) $array as $key => $val)
{
$temp[] = $key;
$temp[] = $val;
@@ -526,7 +525,7 @@ class CI_URI {
/**
* Fetch a URI Segment and add a trailing slash
*
- * @param integer
+ * @param int
* @param string
* @return string
*/
@@ -540,7 +539,7 @@ class CI_URI {
/**
* Fetch a URI Segment and add a trailing slash
*
- * @param integer
+ * @param int
* @param string
* @return string
*/
@@ -554,7 +553,7 @@ class CI_URI {
/**
* Fetch a URI Segment and add a trailing slash - helper function
*
- * @param integer
+ * @param int
* @param string
* @param string
* @return string
@@ -604,7 +603,7 @@ class CI_URI {
/**
* Total number of segments
*
- * @return integer
+ * @return int
*/
public function total_segments()
{
@@ -616,7 +615,7 @@ class CI_URI {
/**
* Total number of routed segments
*
- * @return integer
+ * @return int
*/
public function total_rsegments()
{
@@ -645,7 +644,7 @@ class CI_URI {
*/
public function ruri_string()
{
- return implode('/', $this->rsegment_array());
+ return '/'.implode('/', $this->rsegment_array());
}
}
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 122020aea..a6faa84ec 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -42,6 +42,8 @@ class CI_Utf8 {
* Constructor
*
* Determines if UTF-8 support is to be enabled
+ *
+ * @return void
*/
public function __construct()
{
@@ -124,7 +126,7 @@ class CI_Utf8 {
* Attempts to convert a string to UTF-8
*
* @param string
- * @param string - input encoding
+ * @param string input encoding
* @return string
*/
public function convert_to_utf8($str, $encoding)