diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-14 11:46:34 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-14 11:46:34 +0100 |
commit | 0fe8c8e21315e00dbc06a87290fb268a2dc999a9 (patch) | |
tree | 4bc75acb95f49de7bf5df9ec3eb684bc39c93ad0 /system | |
parent | ca6404749a8dd3ee5dd68d64832374dce05fe6a3 (diff) | |
parent | 62c0647d241d556590d470ea27ac9aa36f609bfa (diff) |
Merge branch 'feature/unit-tests' into develop
Diffstat (limited to 'system')
-rwxr-xr-x | system/core/Config.php | 2 | ||||
-rwxr-xr-x | system/core/URI.php | 18 | ||||
-rw-r--r-- | system/database/DB_active_rec.php | 1 | ||||
-rw-r--r-- | system/helpers/date_helper.php | 7 | ||||
-rw-r--r-- | system/helpers/inflector_helper.php | 2 | ||||
-rw-r--r-- | system/libraries/Table.php | 4 |
6 files changed, 25 insertions, 9 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index 1e149d005..91826bd41 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -76,7 +76,7 @@ class CI_Config { log_message('debug', 'Config Class Initialized'); // Set the base_url automatically if none was provided - if ($this->config['base_url'] == '') + if (empty($this->config['base_url'])) { if (isset($_SERVER['HTTP_HOST'])) { diff --git a/system/core/URI.php b/system/core/URI.php index db5b8e44b..b5364a30d 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -22,7 +22,6 @@ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 - * @filesource */ // ------------------------------------------------------------------------ @@ -93,7 +92,7 @@ class CI_URI { if (strtoupper($this->config->item('uri_protocol')) === 'AUTO') { // Is the request coming from the command line? - if (php_sapi_name() === 'cli' OR defined('STDIN')) + if ($this->_is_cli_request()) { $this->_set_uri_string($this->_parse_cli_args()); return; @@ -227,6 +226,21 @@ 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 + */ + protected function _is_cli_request() + { + return (php_sapi_name() == 'cli') OR defined('STDIN'); + } + + + // -------------------------------------------------------------------- /** * Parse cli arguments diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 756709698..35164a79c 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -214,6 +214,7 @@ class CI_DB_active_record extends CI_DB_driver { $sql = $this->protect_identifiers($type.'('.trim($select).')').' AS '.$this->protect_identifiers(trim($alias)); $this->ar_select[] = $sql; + $this->ar_no_escape[] = NULL; if ($this->ar_caching === TRUE) { diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 2a34cf93e..7e60cccf8 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -128,15 +128,16 @@ if ( ! function_exists('standard_date')) function standard_date($fmt = 'DATE_RFC822', $time = '') { $formats = array( - 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%Q', + 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%O', 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', - 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', + 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%O', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', + 'DATE_RFC2822' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', - 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q' + 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%O' ); if ( ! isset($formats[$fmt])) diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 2f6b40aa7..ad9cd1fbd 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -173,7 +173,7 @@ if ( ! function_exists('camelize')) { function camelize($str) { - return substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); + return strtolower($str[0]).substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); } } diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 8651b9e69..08590c0e0 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -102,7 +102,7 @@ class CI_Table { */ public function make_columns($array = array(), $col_limit = 0) { - if ( ! is_array($array) OR count($array) === 0) + if ( ! is_array($array) OR count($array) === 0 OR ! is_int($col_limit)) { return FALSE; } @@ -395,7 +395,7 @@ class CI_Table { // First generate the headings from the table column names if (count($this->heading) === 0) { - if ( ! method_exists($query, 'list_fields')) + if ( ! is_callable(array($query, 'list_fields'))) { return FALSE; } |