summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-03-14 11:51:36 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-03-14 11:51:36 +0100
commit15a29e11a1003ff253b4df7c8a4c6e97b052a06d (patch)
tree8297ecf0727c574bd90cb12413f687f8413dce2e /system/core
parent0fe8c8e21315e00dbc06a87290fb268a2dc999a9 (diff)
parentce707b4cafd64b95031690cf927584b1d60c7ad7 (diff)
Merged unit test progress.
Diffstat (limited to 'system/core')
-rwxr-xr-xsystem/core/Input.php31
-rw-r--r--system/core/Loader.php11
-rwxr-xr-xsystem/core/URI.php4
3 files changed, 12 insertions, 34 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 54b7e0923..901b4147e 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -366,36 +366,7 @@ class CI_Input {
*/
public function valid_ip($ip)
{
- // if php version >= 5.2, use filter_var to check validate ip.
- if (function_exists('filter_var'))
- {
- return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
- }
-
- $ip_segments = explode('.', $ip);
-
- // Always 4 segments needed
- if (count($ip_segments) !== 4)
- {
- return FALSE;
- }
- // IP can not start with 0
- if ($ip_segments[0][0] == '0')
- {
- return FALSE;
- }
- // Check each segment
- foreach ($ip_segments as $segment)
- {
- // IP segments must be digits and can not be
- // longer than 3 digits or greater then 255
- if ($segment == '' OR preg_match('/[^0-9]/', $segment) OR $segment > 255 OR strlen($segment) > 3)
- {
- return FALSE;
- }
- }
-
- return TRUE;
+ return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
// --------------------------------------------------------------------
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 3d91915c4..9b9cc2fef 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -615,13 +615,22 @@ class CI_Loader {
*
* Loads a driver library
*
- * @param string the name of the class
+ * @param mixed the name of the class or array of classes
* @param mixed the optional parameters
* @param string an optional object name
* @return void
*/
public function driver($library = '', $params = NULL, $object_name = NULL)
{
+ if (is_array($library))
+ {
+ foreach ($library as $driver)
+ {
+ $this->driver($driver);
+ }
+ return FALSE;
+ }
+
if ( ! class_exists('CI_Driver_Library'))
{
// we aren't instantiating an object here, that'll be done by the Library itself
diff --git a/system/core/URI.php b/system/core/URI.php
index b5364a30d..48bb7ae3c 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -458,9 +458,7 @@ class CI_URI {
return array();
}
- return function_exists('array_fill_keys')
- ? array_fill_keys($default, FALSE)
- : array_combine($default, array_fill(0, count($default), FALSE));
+ return array_fill_keys($default, FALSE);
}
$segments = array_slice($this->$segment_array(), ($n - 1));