summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-05-17 14:55:08 +0200
committerTimothy Warren <tim@timshomepage.net>2012-05-17 14:55:08 +0200
commit55450deee2acbdf112f5c206673b3215ca10dfcb (patch)
tree09fa0f810524ed353f868194059f336c6f26eb50
parent351c2e1b0d3fdca80a5483d708d7c71084226e68 (diff)
parente30b3f7afafa2c016cf78cc8bb8a457c2dbcda8c (diff)
merge upstream
-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.php10
-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.php25
-rwxr-xr-xsystem/core/Security.php18
-rwxr-xr-xsystem/core/URI.php67
-rw-r--r--system/core/Utf8.php4
-rw-r--r--system/helpers/date_helper.php65
-rw-r--r--system/helpers/download_helper.php2
-rw-r--r--system/helpers/form_helper.php1
-rw-r--r--system/helpers/html_helper.php8
-rw-r--r--system/helpers/inflector_helper.php98
-rw-r--r--system/helpers/language_helper.php18
-rw-r--r--system/helpers/number_helper.php13
-rw-r--r--system/helpers/path_helper.php14
-rw-r--r--system/helpers/security_helper.php63
-rw-r--r--system/helpers/smiley_helper.php103
-rw-r--r--system/helpers/string_helper.php204
-rw-r--r--system/helpers/text_helper.php172
-rw-r--r--system/helpers/typography_helper.php47
-rw-r--r--system/helpers/url_helper.php272
-rw-r--r--system/helpers/xml_helper.php14
-rw-r--r--system/libraries/Cache/Cache.php4
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php4
-rw-r--r--system/libraries/Calendar.php41
-rw-r--r--system/libraries/Cart.php31
-rw-r--r--system/libraries/Driver.php8
-rw-r--r--system/libraries/Email.php206
-rw-r--r--system/libraries/Encrypt.php12
-rw-r--r--system/libraries/Form_validation.php60
-rw-r--r--system/libraries/Ftp.php2
-rw-r--r--system/libraries/Image_lib.php252
-rw-r--r--system/libraries/Log.php18
-rw-r--r--system/libraries/Migration.php13
-rw-r--r--system/libraries/Pagination.php1
-rw-r--r--system/libraries/Parser.php26
-rw-r--r--system/libraries/Profiler.php1
-rw-r--r--system/libraries/Session.php1
-rw-r--r--system/libraries/Table.php16
-rw-r--r--system/libraries/Typography.php4
-rw-r--r--system/libraries/Unit_test.php4
-rw-r--r--system/libraries/Upload.php4
-rw-r--r--system/libraries/Xmlrpcs.php9
-rw-r--r--system/libraries/Zip.php12
-rw-r--r--system/libraries/javascript/Jquery.php66
-rw-r--r--tests/README.md2
-rw-r--r--tests/codeigniter/core/Benchmark_test.php4
-rw-r--r--user_guide_src/source/changelog.rst1
57 files changed, 1057 insertions, 1106 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 f9618044e..8c32085fe 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
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 9314052fe..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()
{
@@ -433,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 c82b69ff9..81b6602ae 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -102,9 +102,11 @@ class CI_Security {
'Redirect\s+302',
"([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?"
);
-
+
/**
* Initialize security class
+ *
+ * @return void
*/
public function __construct()
{
@@ -201,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')
);
@@ -626,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 $3$5$6$7', $str, -1, $count);
+ $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)('.implode('|', $attribs).')(.*?)([\s><])([><]*)/i', '<$1 $3$5$6$7', $str, -1, $count);
}
} while ($count);
@@ -844,4 +846,4 @@ class CI_Security {
}
/* End of file Security.php */
-/* Location: ./system/core/Security.php */
+/* Location: ./system/core/Security.php */ \ No newline at end of file
diff --git a/system/core/URI.php b/system/core/URI.php
index cf82c5838..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()
{
@@ -651,4 +650,4 @@ class CI_URI {
}
/* End of file URI.php */
-/* Location: ./system/core/URI.php */
+/* Location: ./system/core/URI.php */ \ No newline at end of file
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)
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 531d1d32f..5f0427f7d 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -100,7 +100,7 @@ if ( ! function_exists('mdate'))
$datestr = str_replace(
'%\\',
'',
- preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr)
+ preg_replace('/([a-z]+?){1}/i', '\\\\\\1', $datestr)
);
return date($datestr, $time);
@@ -316,12 +316,12 @@ if ( ! function_exists('local_to_gmt'))
}
return mktime(
- gmdate("H", $time),
- gmdate("i", $time),
- gmdate("s", $time),
- gmdate("m", $time),
- gmdate("d", $time),
- gmdate("Y", $time)
+ gmdate('H', $time),
+ gmdate('i', $time),
+ gmdate('s', $time),
+ gmdate('m', $time),
+ gmdate('d', $time),
+ gmdate('Y', $time)
);
}
}
@@ -452,8 +452,7 @@ if ( ! function_exists('human_to_unix'))
return FALSE;
}
- $datestr = trim($datestr);
- $datestr = preg_replace("/\040+/", ' ', $datestr);
+ $datestr = preg_replace('/\040+/', ' ', trim($datestr));
if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
{
@@ -462,20 +461,20 @@ if ( ! function_exists('human_to_unix'))
$split = explode(' ', $datestr);
- $ex = explode("-", $split['0']);
+ $ex = explode('-', $split['0']);
- $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
- $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
- $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+ $year = (strlen($ex[0]) === 2) ? '20'.$ex[0] : $ex[0];
+ $month = (strlen($ex[1]) === 1) ? '0'.$ex[1] : $ex[1];
+ $day = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2];
- $ex = explode(":", $split['1']);
+ $ex = explode(':', $split['1']);
- $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
- $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
+ $hour = (strlen($ex[0]) === 1) ? '0'.$ex[0] : $ex[0];
+ $min = (strlen($ex[1]) === 1) ? '0'.$ex[1] : $ex[1];
- if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2']))
+ if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex[2]))
{
- $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+ $sec = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2];
}
else
{
@@ -485,11 +484,11 @@ if ( ! function_exists('human_to_unix'))
if (isset($split['2']))
{
- $ampm = strtolower($split['2']);
+ $ampm = strtolower($split[2]);
if (substr($ampm, 0, 1) === 'p' && $hour < 12)
{
- $hour = $hour + 12;
+ $hour += 12;
}
if (substr($ampm, 0, 1) === 'a' && $hour == 12)
@@ -497,7 +496,7 @@ if ( ! function_exists('human_to_unix'))
$hour = '00';
}
- if (strlen($hour) == 1)
+ if (strlen($hour) === 1)
{
$hour = '0'.$hour;
}
@@ -529,7 +528,7 @@ if ( ! function_exists('nice_date'))
// Date like: YYYYMM
if (preg_match('/^\d{6}$/', $bad_date))
{
- if (in_array(substr($bad_date, 0, 2),array('19', '20')))
+ if (in_array(substr($bad_date, 0, 2), array('19', '20')))
{
$year = substr($bad_date, 0, 4);
$month = substr($bad_date, 4, 2);
@@ -540,24 +539,24 @@ if ( ! function_exists('nice_date'))
$year = substr($bad_date, 2, 4);
}
- return date($format, strtotime($year . '-' . $month . '-01'));
+ return date($format, strtotime($year.'-'.$month.'-01'));
}
// Date Like: YYYYMMDD
- if (preg_match('/^\d{8}$/',$bad_date))
+ if (preg_match('/^\d{8}$/', $bad_date))
{
$month = substr($bad_date, 0, 2);
$day = substr($bad_date, 2, 2);
$year = substr($bad_date, 4, 4);
- return date($format, strtotime($month . '/01/' . $year));
+ return date($format, strtotime($month.'/01/'.$year));
}
// Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between)
- if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/',$bad_date))
+ if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/', $bad_date))
{
list($m, $d, $y) = explode('-', $bad_date);
- return date($format, strtotime("{$y}-{$m}-{$d}"));
+ return date($format, strtotime($y.'-'.$m.'-'.$d));
}
// Any other kind of string, when converted into UNIX time,
@@ -565,7 +564,7 @@ if ( ! function_exists('nice_date'))
// return "Invalid Date".
if (date('U', strtotime($bad_date)) == '0')
{
- return "Invalid Date";
+ return 'Invalid Date';
}
// It's probably a valid-ish date format already
@@ -587,7 +586,7 @@ if ( ! function_exists('timezone_menu'))
* @param string menu name
* @return string
*/
- function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
+ function timezone_menu($default = 'UTC', $class = '', $name = 'timezones')
{
$CI =& get_instance();
$CI->lang->load('date');
@@ -605,13 +604,11 @@ if ( ! function_exists('timezone_menu'))
foreach (timezones() as $key => $val)
{
- $selected = ($default == $key) ? " selected='selected'" : '';
- $menu .= "<option value='{$key}'{$selected}>".$CI->lang->line($key)."</option>\n";
+ $selected = ($default == $key) ? ' selected="selected"' : '';
+ $menu .= '<option value="'.$key.'"'.$selected.'>'.$CI->lang->line($key)."</option>\n";
}
- $menu .= "</select>";
-
- return $menu;
+ return $menu.'</select>';
}
}
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 97e6986b0..470b61ede 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -100,7 +100,7 @@ if ( ! function_exists('force_download'))
$x[count($x) - 1] = strtoupper($extension);
$filename = implode('.', $x);
}
-
+
// Clean output buffer
ob_clean();
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index b246d72f3..eca6c5f1e 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -184,7 +184,6 @@ if ( ! function_exists('form_input'))
// ------------------------------------------------------------------------
-
if ( ! function_exists('form_password'))
{
/**
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 124f58009..92a6db477 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -379,10 +379,10 @@ if ( ! function_exists('meta'))
$str = '';
foreach ($name as $meta)
{
- $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
- $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
- $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
- $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
+ $type = ( ! isset($meta['type']) OR $meta['type'] === 'name') ? 'name' : 'http-equiv';
+ $name = isset($meta['name']) ? $meta['name'] : '';
+ $content = isset($meta['content']) ? $meta['content'] : '';
+ $newline = isset($meta['newline']) ? $meta['newline'] : "\n";
$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
}
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index feeaf57d7..647d840e4 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -37,16 +37,16 @@
// --------------------------------------------------------------------
-/**
- * Singular
- *
- * Takes a plural word and makes it singular
- *
- * @param string
- * @return str
- */
if ( ! function_exists('singular'))
{
+ /**
+ * Singular
+ *
+ * Takes a plural word and makes it singular
+ *
+ * @param string
+ * @return string
+ */
function singular($str)
{
$result = strval($str);
@@ -101,17 +101,17 @@ if ( ! function_exists('singular'))
// --------------------------------------------------------------------
-/**
- * Plural
- *
- * Takes a singular word and makes it plural
- *
- * @param string
- * @param bool
- * @return str
- */
if ( ! function_exists('plural'))
{
+ /**
+ * Plural
+ *
+ * Takes a singular word and makes it plural
+ *
+ * @param string
+ * @param bool
+ * @return string
+ */
function plural($str, $force = FALSE)
{
$result = strval($str);
@@ -158,16 +158,16 @@ if ( ! function_exists('plural'))
// --------------------------------------------------------------------
-/**
- * Camelize
- *
- * Takes multiple words separated by spaces or underscores and camelizes them
- *
- * @param string
- * @return str
- */
if ( ! function_exists('camelize'))
{
+ /**
+ * Camelize
+ *
+ * Takes multiple words separated by spaces or underscores and camelizes them
+ *
+ * @param string
+ * @return string
+ */
function camelize($str)
{
return strtolower($str[0]).substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1);
@@ -176,16 +176,16 @@ if ( ! function_exists('camelize'))
// --------------------------------------------------------------------
-/**
- * Underscore
- *
- * Takes multiple words separated by spaces and underscores them
- *
- * @param string
- * @return str
- */
if ( ! function_exists('underscore'))
{
+ /**
+ * Underscore
+ *
+ * Takes multiple words separated by spaces and underscores them
+ *
+ * @param string
+ * @return string
+ */
function underscore($str)
{
return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
@@ -194,31 +194,33 @@ if ( ! function_exists('underscore'))
// --------------------------------------------------------------------
-/**
- * Humanize
- *
- * Takes multiple words separated by the separator and changes them to spaces
- *
- * @param string $str
- * @param string $separator
- * @return str
- */
if ( ! function_exists('humanize'))
{
+ /**
+ * Humanize
+ *
+ * Takes multiple words separated by the separator and changes them to spaces
+ *
+ * @param string $str
+ * @param string $separator
+ * @return string
+ */
function humanize($str, $separator = '_')
{
return ucwords(preg_replace('/['.$separator.']+/', ' ', strtolower(trim($str))));
}
}
-/**
- * Checks if the given word has a plural version.
- *
- * @param string the word to check
- * @return bool if the word is countable
- */
+// --------------------------------------------------------------------
+
if ( ! function_exists('is_countable'))
{
+ /**
+ * Checks if the given word has a plural version.
+ *
+ * @param string the word to check
+ * @return bool if the word is countable
+ */
function is_countable($word)
{
return ! in_array(strtolower(strval($word)),
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index b31c97107..34f030716 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -37,17 +37,17 @@
// ------------------------------------------------------------------------
-/**
- * Lang
- *
- * Fetches a language variable and optionally outputs a form label
- *
- * @param string the language line
- * @param string the id of the form element
- * @return string
- */
if ( ! function_exists('lang'))
{
+ /**
+ * Lang
+ *
+ * Fetches a language variable and optionally outputs a form label
+ *
+ * @param string the language line
+ * @param string the id of the form element
+ * @return string
+ */
function lang($line, $id = '')
{
$CI =& get_instance();
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 40da6e7bf..e49f2f7a0 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -37,14 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * Formats a numbers as bytes, based on size, and adds the appropriate suffix
- *
- * @param mixed // will be cast as int
- * @return string
- */
if ( ! function_exists('byte_format'))
{
+ /**
+ * Formats a numbers as bytes, based on size, and adds the appropriate suffix
+ *
+ * @param mixed will be cast as int
+ * @param int
+ * @return string
+ */
function byte_format($num, $precision = 1)
{
$CI =& get_instance();
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index 6ee99072c..13410545c 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -37,15 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * Set Realpath
- *
- * @param string
- * @param bool checks to see if the path exists
- * @return string
- */
if ( ! function_exists('set_realpath'))
{
+ /**
+ * Set Realpath
+ *
+ * @param string
+ * @param bool checks to see if the path exists
+ * @return string
+ */
function set_realpath($path, $check_existance = FALSE)
{
// Security check to make sure the path is NOT a URL. No remote file inclusion!
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index d6f134c9f..6187a4a7a 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -37,15 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * XSS Filtering
- *
- * @param string
- * @param bool whether or not the content is an image file
- * @return string
- */
if ( ! function_exists('xss_clean'))
{
+ /**
+ * XSS Filtering
+ *
+ * @param string
+ * @param bool whether or not the content is an image file
+ * @return string
+ */
function xss_clean($str, $is_image = FALSE)
{
$CI =& get_instance();
@@ -55,14 +55,14 @@ if ( ! function_exists('xss_clean'))
// ------------------------------------------------------------------------
-/**
- * Sanitize Filename
- *
- * @param string
- * @return string
- */
if ( ! function_exists('sanitize_filename'))
{
+ /**
+ * Sanitize Filename
+ *
+ * @param string
+ * @return string
+ */
function sanitize_filename($filename)
{
$CI =& get_instance();
@@ -72,14 +72,15 @@ if ( ! function_exists('sanitize_filename'))
// --------------------------------------------------------------------
-/**
- * Hash encode a string
- *
- * @param string
- * @return string
- */
if ( ! function_exists('do_hash'))
{
+ /**
+ * Hash encode a string
+ *
+ * @param string
+ * @param string
+ * @return string
+ */
function do_hash($str, $type = 'sha1')
{
if ( ! in_array(strtolower($type), hash_algos()))
@@ -93,14 +94,14 @@ if ( ! function_exists('do_hash'))
// ------------------------------------------------------------------------
-/**
- * Strip Image Tags
- *
- * @param string
- * @return string
- */
if ( ! function_exists('strip_image_tags'))
{
+ /**
+ * Strip Image Tags
+ *
+ * @param string
+ * @return string
+ */
function strip_image_tags($str)
{
return preg_replace(array('#<img\s+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img\s+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str);
@@ -109,14 +110,14 @@ if ( ! function_exists('strip_image_tags'))
// ------------------------------------------------------------------------
-/**
- * Convert PHP tags to entities
- *
- * @param string
- * @return string
- */
if ( ! function_exists('encode_php_tags'))
{
+ /**
+ * Convert PHP tags to entities
+ *
+ * @param string
+ * @return string
+ */
function encode_php_tags($str)
{
return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 638100e9c..5e6de08af 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -37,18 +37,19 @@
// ------------------------------------------------------------------------
-/**
- * Smiley Javascript
- *
- * Returns the javascript required for the smiley insertion. Optionally takes
- * an array of aliases to loosely couple the smiley array to the view.
- *
- * @param mixed alias name or array of alias->field_id pairs
- * @param string field_id if alias name was passed in
- * @return array
- */
if ( ! function_exists('smiley_js'))
{
+ /**
+ * Smiley Javascript
+ *
+ * Returns the javascript required for the smiley insertion. Optionally takes
+ * an array of aliases to loosely couple the smiley array to the view.
+ *
+ * @param mixed alias name or array of alias->field_id pairs
+ * @param string field_id if alias name was passed in
+ * @param bool
+ * @return array
+ */
function smiley_js($alias = '', $field_id = '', $inline = TRUE)
{
static $do_setup = TRUE;
@@ -118,17 +119,20 @@ EOF;
// ------------------------------------------------------------------------
-/**
- * Get Clickable Smileys
- *
- * Returns an array of image tag links that can be clicked to be inserted
- * into a form field.
- *
- * @param string the URL to the folder containing the smiley images
- * @return array
- */
+
if ( ! function_exists('get_clickable_smileys'))
{
+ /**
+ * Get Clickable Smileys
+ *
+ * Returns an array of image tag links that can be clicked to be inserted
+ * into a form field.
+ *
+ * @param string the URL to the folder containing the smiley images
+ * @param array
+ * @param array
+ * @return array
+ */
function get_clickable_smileys($image_url, $alias = '', $smileys = NULL)
{
// For backward compatibility with js_insert_smiley
@@ -166,17 +170,18 @@ if ( ! function_exists('get_clickable_smileys'))
// ------------------------------------------------------------------------
-/**
- * Parse Smileys
- *
- * Takes a string as input and swaps any contained smileys for the actual image
- *
- * @param string the text to be parsed
- * @param string the URL to the folder containing the smiley images
- * @return string
- */
if ( ! function_exists('parse_smileys'))
{
+ /**
+ * Parse Smileys
+ *
+ * Takes a string as input and swaps any contained smileys for the actual image
+ *
+ * @param string the text to be parsed
+ * @param string the URL to the folder containing the smiley images
+ * @param array
+ * @return string
+ */
function parse_smileys($str = '', $image_url = '', $smileys = NULL)
{
if ($image_url == '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array())))
@@ -198,15 +203,15 @@ if ( ! function_exists('parse_smileys'))
// ------------------------------------------------------------------------
-/**
- * Get Smiley Array
- *
- * Fetches the config/smiley.php file
- *
- * @return mixed
- */
if ( ! function_exists('_get_smiley_array'))
{
+ /**
+ * Get Smiley Array
+ *
+ * Fetches the config/smiley.php file
+ *
+ * @return mixed
+ */
function _get_smiley_array()
{
if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
@@ -222,33 +227,5 @@ if ( ! function_exists('_get_smiley_array'))
}
}
-// ------------------------------------------------------------------------
-
-/**
- * JS Insert Smiley
- *
- * Generates the javascript function needed to insert smileys into a form field
- *
- * DEPRECATED as of version 1.7.2, use smiley_js instead
- *
- * @param string form name
- * @param string field name
- * @return string
- */
-if ( ! function_exists('js_insert_smiley'))
-{
- function js_insert_smiley($form_name = '', $form_field = '')
- {
- return <<<EOF
-<script type="text/javascript">
- function insert_smiley(smiley)
- {
- document.{$form_name}.{$form_field}.value += " " + smiley;
- }
-</script>
-EOF;
- }
-}
-
/* End of file smiley_helper.php */
/* Location: ./system/helpers/smiley_helper.php */ \ No newline at end of file
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index a6a6b485d..0c47d440a 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -37,22 +37,22 @@
// ------------------------------------------------------------------------
-/**
- * Trim Slashes
- *
- * Removes any leading/trailing slashes from a string:
- *
- * /this/that/theother/
- *
- * becomes:
- *
- * this/that/theother
- *
- * @param string
- * @return string
- */
if ( ! function_exists('trim_slashes'))
{
+ /**
+ * Trim Slashes
+ *
+ * Removes any leading/trailing slashes from a string:
+ *
+ * /this/that/theother/
+ *
+ * becomes:
+ *
+ * this/that/theother
+ *
+ * @param string
+ * @return string
+ */
function trim_slashes($str)
{
return trim($str, '/');
@@ -61,16 +61,16 @@ if ( ! function_exists('trim_slashes'))
// ------------------------------------------------------------------------
-/**
- * Strip Slashes
- *
- * Removes slashes contained in a string or in an array
- *
- * @param mixed string or array
- * @return mixed string or array
- */
if ( ! function_exists('strip_slashes'))
{
+ /**
+ * Strip Slashes
+ *
+ * Removes slashes contained in a string or in an array
+ *
+ * @param mixed string or array
+ * @return mixed string or array
+ */
function strip_slashes($str)
{
if ( ! is_array($str))
@@ -89,16 +89,16 @@ if ( ! function_exists('strip_slashes'))
// ------------------------------------------------------------------------
-/**
- * Strip Quotes
- *
- * Removes single and double quotes from a string
- *
- * @param string
- * @return string
- */
if ( ! function_exists('strip_quotes'))
{
+ /**
+ * Strip Quotes
+ *
+ * Removes single and double quotes from a string
+ *
+ * @param string
+ * @return string
+ */
function strip_quotes($str)
{
return str_replace(array('"', "'"), '', $str);
@@ -107,16 +107,16 @@ if ( ! function_exists('strip_quotes'))
// ------------------------------------------------------------------------
-/**
- * Quotes to Entities
- *
- * Converts single and double quotes to entities
- *
- * @param string
- * @return string
- */
if ( ! function_exists('quotes_to_entities'))
{
+ /**
+ * Quotes to Entities
+ *
+ * Converts single and double quotes to entities
+ *
+ * @param string
+ * @return string
+ */
function quotes_to_entities($str)
{
return str_replace(array("\'","\"","'",'"'), array("&#39;","&quot;","&#39;","&quot;"), $str);
@@ -125,23 +125,23 @@ if ( ! function_exists('quotes_to_entities'))
// ------------------------------------------------------------------------
-/**
- * Reduce Double Slashes
- *
- * Converts double slashes in a string to a single slash,
- * except those found in http://
- *
- * http://www.some-site.com//index.php
- *
- * becomes:
- *
- * http://www.some-site.com/index.php
- *
- * @param string
- * @return string
- */
if ( ! function_exists('reduce_double_slashes'))
{
+ /**
+ * Reduce Double Slashes
+ *
+ * Converts double slashes in a string to a single slash,
+ * except those found in http://
+ *
+ * http://www.some-site.com//index.php
+ *
+ * becomes:
+ *
+ * http://www.some-site.com/index.php
+ *
+ * @param string
+ * @return string
+ */
function reduce_double_slashes($str)
{
return preg_replace('#(^|[^:])//+#', '\\1/', $str);
@@ -150,24 +150,24 @@ if ( ! function_exists('reduce_double_slashes'))
// ------------------------------------------------------------------------
-/**
- * Reduce Multiples
- *
- * Reduces multiple instances of a particular character. Example:
- *
- * Fred, Bill,, Joe, Jimmy
- *
- * becomes:
- *
- * Fred, Bill, Joe, Jimmy
- *
- * @param string
- * @param string the character you wish to reduce
- * @param bool TRUE/FALSE - whether to trim the character from the beginning/end
- * @return string
- */
if ( ! function_exists('reduce_multiples'))
{
+ /**
+ * Reduce Multiples
+ *
+ * Reduces multiple instances of a particular character. Example:
+ *
+ * Fred, Bill,, Joe, Jimmy
+ *
+ * becomes:
+ *
+ * Fred, Bill, Joe, Jimmy
+ *
+ * @param string
+ * @param string the character you wish to reduce
+ * @param bool TRUE/FALSE - whether to trim the character from the beginning/end
+ * @return string
+ */
function reduce_multiples($str, $character = ',', $trim = FALSE)
{
$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
@@ -177,17 +177,17 @@ if ( ! function_exists('reduce_multiples'))
// ------------------------------------------------------------------------
-/**
- * Create a Random String
- *
- * Useful for generating passwords or hashes.
- *
- * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
- * @param int number of characters
- * @return string
- */
if ( ! function_exists('random_string'))
{
+ /**
+ * Create a Random String
+ *
+ * Useful for generating passwords or hashes.
+ *
+ * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
+ * @param int number of characters
+ * @return string
+ */
function random_string($type = 'alnum', $len = 8)
{
switch ($type)
@@ -226,16 +226,16 @@ if ( ! function_exists('random_string'))
// ------------------------------------------------------------------------
-/**
- * Add's _1 to a string or increment the ending number to allow _2, _3, etc
- *
- * @param string required
- * @param string What should the duplicate number be appended with
- * @param string Which number should be used for the first dupe increment
- * @return string
- */
if ( ! function_exists('increment_string'))
{
+ /**
+ * Add's _1 to a string or increment the ending number to allow _2, _3, etc
+ *
+ * @param string required
+ * @param string What should the duplicate number be appended with
+ * @param string Which number should be used for the first dupe increment
+ * @return string
+ */
function increment_string($str, $separator = '_', $first = 1)
{
preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
@@ -245,17 +245,17 @@ if ( ! function_exists('increment_string'))
// ------------------------------------------------------------------------
-/**
- * Alternator
- *
- * Allows strings to be alternated. See docs...
- *
- * @param string (as many parameters as needed)
- * @return string
- */
if ( ! function_exists('alternator'))
{
- function alternator()
+ /**
+ * Alternator
+ *
+ * Allows strings to be alternated. See docs...
+ *
+ * @param string (as many parameters as needed)
+ * @return string
+ */
+ function alternator($args)
{
static $i;
@@ -271,15 +271,15 @@ if ( ! function_exists('alternator'))
// ------------------------------------------------------------------------
-/**
- * Repeater function
- *
- * @param string
- * @param int number of repeats
- * @return string
- */
if ( ! function_exists('repeater'))
{
+ /**
+ * Repeater function
+ *
+ * @param string
+ * @param int number of repeats
+ * @return string
+ */
function repeater($data, $num = 1)
{
return ($num > 0) ? str_repeat($data, $num) : '';
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index c1c0eb947..e4451ae81 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -37,18 +37,18 @@
// ------------------------------------------------------------------------
-/**
- * Word Limiter
- *
- * Limits a string to X number of words.
- *
- * @param string
- * @param int
- * @param string the end character. Usually an ellipsis
- * @return string
- */
if ( ! function_exists('word_limiter'))
{
+ /**
+ * Word Limiter
+ *
+ * Limits a string to X number of words.
+ *
+ * @param string
+ * @param int
+ * @param string the end character. Usually an ellipsis
+ * @return string
+ */
function word_limiter($str, $limit = 100, $end_char = '&#8230;')
{
if (trim($str) == '')
@@ -69,19 +69,19 @@ if ( ! function_exists('word_limiter'))
// ------------------------------------------------------------------------
-/**
- * Character Limiter
- *
- * Limits the string based on the character count. Preserves complete words
- * so the character count may not be exactly as specified.
- *
- * @param string
- * @param int
- * @param string the end character. Usually an ellipsis
- * @return string
- */
if ( ! function_exists('character_limiter'))
{
+ /**
+ * Character Limiter
+ *
+ * Limits the string based on the character count. Preserves complete words
+ * so the character count may not be exactly as specified.
+ *
+ * @param string
+ * @param int
+ * @param string the end character. Usually an ellipsis
+ * @return string
+ */
function character_limiter($str, $n = 500, $end_char = '&#8230;')
{
if (strlen($str) < $n)
@@ -112,16 +112,16 @@ if ( ! function_exists('character_limiter'))
// ------------------------------------------------------------------------
-/**
- * High ASCII to Entities
- *
- * Converts High ascii text and MS Word special characters to character entities
- *
- * @param string
- * @return string
- */
if ( ! function_exists('ascii_to_entities'))
{
+ /**
+ * High ASCII to Entities
+ *
+ * Converts High ascii text and MS Word special characters to character entities
+ *
+ * @param string
+ * @return string
+ */
function ascii_to_entities($str)
{
$count = 1;
@@ -174,17 +174,17 @@ if ( ! function_exists('ascii_to_entities'))
// ------------------------------------------------------------------------
-/**
- * Entities to ASCII
- *
- * Converts character entities back to ASCII
- *
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('entities_to_ascii'))
{
+ /**
+ * Entities to ASCII
+ *
+ * Converts character entities back to ASCII
+ *
+ * @param string
+ * @param bool
+ * @return string
+ */
function entities_to_ascii($str, $all = TRUE)
{
if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
@@ -227,20 +227,20 @@ if ( ! function_exists('entities_to_ascii'))
// ------------------------------------------------------------------------
-/**
- * Word Censoring Function
- *
- * Supply a string and an array of disallowed words and any
- * matched words will be converted to #### or to the replacement
- * word you've submitted.
- *
- * @param string the text string
- * @param string the array of censoered words
- * @param string the optional replacement value
- * @return string
- */
if ( ! function_exists('word_censor'))
{
+ /**
+ * Word Censoring Function
+ *
+ * Supply a string and an array of disallowed words and any
+ * matched words will be converted to #### or to the replacement
+ * word you've submitted.
+ *
+ * @param string the text string
+ * @param string the array of censoered words
+ * @param string the optional replacement value
+ * @return string
+ */
function word_censor($str, $censored, $replacement = '')
{
if ( ! is_array($censored))
@@ -274,16 +274,16 @@ if ( ! function_exists('word_censor'))
// ------------------------------------------------------------------------
-/**
- * Code Highlighter
- *
- * Colorizes code strings
- *
- * @param string the text string
- * @return string
- */
if ( ! function_exists('highlight_code'))
{
+ /**
+ * Code Highlighter
+ *
+ * Colorizes code strings
+ *
+ * @param string the text string
+ * @return string
+ */
function highlight_code($str)
{
/* The highlight string function encodes and highlights
@@ -323,19 +323,19 @@ if ( ! function_exists('highlight_code'))
// ------------------------------------------------------------------------
-/**
- * Phrase Highlighter
- *
- * Highlights a phrase within a text string
- *
- * @param string the text string
- * @param string the phrase you'd like to highlight
- * @param string the openging tag to precede the phrase with
- * @param string the closing tag to end the phrase with
- * @return string
- */
if ( ! function_exists('highlight_phrase'))
{
+ /**
+ * Phrase Highlighter
+ *
+ * Highlights a phrase within a text string
+ *
+ * @param string the text string
+ * @param string the phrase you'd like to highlight
+ * @param string the openging tag to precede the phrase with
+ * @param string the closing tag to end the phrase with
+ * @return string
+ */
function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
{
if ($str == '')
@@ -354,14 +354,14 @@ if ( ! function_exists('highlight_phrase'))
// ------------------------------------------------------------------------
-/**
- * Convert Accented Foreign Characters to ASCII
- *
- * @param string the text string
- * @return string
- */
if ( ! function_exists('convert_accented_characters'))
{
+ /**
+ * Convert Accented Foreign Characters to ASCII
+ *
+ * @param string the text string
+ * @return string
+ */
function convert_accented_characters($str)
{
global $foreign_characters;
@@ -490,19 +490,19 @@ if ( ! function_exists('word_wrap'))
// ------------------------------------------------------------------------
-/**
- * Ellipsize String
- *
- * This function will strip tags from a string, split it at its max_length and ellipsize
- *
- * @param string string to ellipsize
- * @param int max length of string
- * @param mixed int (1|0) or float, .5, .2, etc for position to split
- * @param string ellipsis ; Default '...'
- * @return string ellipsized string
- */
if ( ! function_exists('ellipsize'))
{
+ /**
+ * Ellipsize String
+ *
+ * This function will strip tags from a string, split it at its max_length and ellipsize
+ *
+ * @param string string to ellipsize
+ * @param int max length of string
+ * @param mixed int (1|0) or float, .5, .2, etc for position to split
+ * @param string ellipsis ; Default '...'
+ * @return string ellipsized string
+ */
function ellipsize($str, $max_length, $position = 1, $ellipsis = '&hellip;')
{
// Strip tags
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 7a3db5d6b..af9d16a89 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -37,14 +37,14 @@
// ------------------------------------------------------------------------
-/**
- * Convert newlines to HTML line breaks except within PRE tags
- *
- * @param string
- * @return string
- */
if ( ! function_exists('nl2br_except_pre'))
{
+ /**
+ * Convert newlines to HTML line breaks except within PRE tags
+ *
+ * @param string
+ * @return string
+ */
function nl2br_except_pre($str)
{
$CI =& get_instance();
@@ -55,16 +55,16 @@ if ( ! function_exists('nl2br_except_pre'))
// ------------------------------------------------------------------------
-/**
- * Auto Typography Wrapper Function
- *
- * @param string
- * @param bool whether to allow javascript event handlers
- * @param bool whether to reduce multiple instances of double newlines to two
- * @return string
- */
if ( ! function_exists('auto_typography'))
{
+ /**
+ * Auto Typography Wrapper Function
+ *
+ * @param string
+ * @param bool whether to allow javascript event handlers
+ * @param bool whether to reduce multiple instances of double newlines to two
+ * @return string
+ */
function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
{
$CI =& get_instance();
@@ -73,20 +73,19 @@ if ( ! function_exists('auto_typography'))
}
}
-
// --------------------------------------------------------------------
-/**
- * HTML Entities Decode
- *
- * This function is a replacement for html_entity_decode()
- *
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('entity_decode'))
{
+ /**
+ * HTML Entities Decode
+ *
+ * This function is a replacement for html_entity_decode()
+ *
+ * @param string
+ * @param string
+ * @return string
+ */
function entity_decode($str, $charset = NULL)
{
global $SEC;
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 5576c2748..0e933c18e 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -37,17 +37,17 @@
// ------------------------------------------------------------------------
-/**
- * Site URL
- *
- * Create a local URL based on your basepath. Segments can be passed via the
- * first parameter either as a string or an array.
- *
- * @param string
- * @return string
- */
if ( ! function_exists('site_url'))
{
+ /**
+ * Site URL
+ *
+ * Create a local URL based on your basepath. Segments can be passed via the
+ * first parameter either as a string or an array.
+ *
+ * @param string
+ * @return string
+ */
function site_url($uri = '')
{
$CI =& get_instance();
@@ -57,18 +57,18 @@ if ( ! function_exists('site_url'))
// ------------------------------------------------------------------------
-/**
- * Base URL
- *
- * Create a local URL based on your basepath.
- * Segments can be passed in as a string or an array, same as site_url
- * or a URL to a file can be passed in, e.g. to an image file.
- *
- * @param string
- * @return string
- */
if ( ! function_exists('base_url'))
{
+ /**
+ * Base URL
+ *
+ * Create a local URL based on your basepath.
+ * Segments can be passed in as a string or an array, same as site_url
+ * or a URL to a file can be passed in, e.g. to an image file.
+ *
+ * @param string
+ * @return string
+ */
function base_url($uri = '')
{
$CI =& get_instance();
@@ -78,16 +78,16 @@ if ( ! function_exists('base_url'))
// ------------------------------------------------------------------------
-/**
- * Current URL
- *
- * Returns the full URL (including segments) of the page where this
- * function is placed
- *
- * @return string
- */
if ( ! function_exists('current_url'))
{
+ /**
+ * Current URL
+ *
+ * Returns the full URL (including segments) of the page where this
+ * function is placed
+ *
+ * @return string
+ */
function current_url()
{
$CI =& get_instance();
@@ -96,15 +96,16 @@ if ( ! function_exists('current_url'))
}
// ------------------------------------------------------------------------
-/**
- * URL String
- *
- * Returns the URI segments.
- *
- * @return string
- */
+
if ( ! function_exists('uri_string'))
{
+ /**
+ * URL String
+ *
+ * Returns the URI segments.
+ *
+ * @return string
+ */
function uri_string()
{
$CI =& get_instance();
@@ -114,15 +115,15 @@ if ( ! function_exists('uri_string'))
// ------------------------------------------------------------------------
-/**
- * Index page
- *
- * Returns the "index_page" from your config file
- *
- * @return string
- */
if ( ! function_exists('index_page'))
{
+ /**
+ * Index page
+ *
+ * Returns the "index_page" from your config file
+ *
+ * @return string
+ */
function index_page()
{
$CI =& get_instance();
@@ -132,18 +133,18 @@ if ( ! function_exists('index_page'))
// ------------------------------------------------------------------------
-/**
- * Anchor Link
- *
- * Creates an anchor based on the local URL.
- *
- * @param string the URL
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('anchor'))
{
+ /**
+ * Anchor Link
+ *
+ * Creates an anchor based on the local URL.
+ *
+ * @param string the URL
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function anchor($uri = '', $title = '', $attributes = '')
{
$title = (string) $title;
@@ -173,19 +174,19 @@ if ( ! function_exists('anchor'))
// ------------------------------------------------------------------------
-/**
- * Anchor Link - Pop-up version
- *
- * Creates an anchor based on the local URL. The link
- * opens a new window based on the attributes specified.
- *
- * @param string the URL
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('anchor_popup'))
{
+ /**
+ * Anchor Link - Pop-up version
+ *
+ * Creates an anchor based on the local URL. The link
+ * opens a new window based on the attributes specified.
+ *
+ * @param string the URL
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function anchor_popup($uri = '', $title = '', $attributes = FALSE)
{
$title = (string) $title;
@@ -198,7 +199,7 @@ if ( ! function_exists('anchor_popup'))
if ($attributes === FALSE)
{
- return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title.'</a>';
+ return '<a href="javascript:void(0);" onclick="window.open(\''.$site_url."', '_blank');\">".$title.'</a>';
}
if ( ! is_array($attributes))
@@ -217,22 +218,22 @@ if ( ! function_exists('anchor_popup'))
$attributes = _parse_attributes($attributes);
}
- return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"".$attributes.'>'.$title.'</a>';
+ return '<a href="javascript:void(0);" onclick="window.open(\''.$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"".$attributes.'>'.$title.'</a>';
}
}
// ------------------------------------------------------------------------
-/**
- * Mailto Link
- *
- * @param string the email address
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('mailto'))
{
+ /**
+ * Mailto Link
+ *
+ * @param string the email address
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function mailto($email, $title = '', $attributes = '')
{
$title = (string) $title;
@@ -248,18 +249,18 @@ if ( ! function_exists('mailto'))
// ------------------------------------------------------------------------
-/**
- * Encoded Mailto Link
- *
- * Create a spam-protected mailto link written in Javascript
- *
- * @param string the email address
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('safe_mailto'))
{
+ /**
+ * Encoded Mailto Link
+ *
+ * Create a spam-protected mailto link written in Javascript
+ *
+ * @param string the email address
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function safe_mailto($email, $title = '', $attributes = '')
{
$title = (string) $title;
@@ -357,21 +358,21 @@ if ( ! function_exists('safe_mailto'))
// ------------------------------------------------------------------------
-/**
- * Auto-linker
- *
- * Automatically links URL and Email addresses.
- * Note: There's a bit of extra code here to deal with
- * URLs or emails that end in a period. We'll strip these
- * off and add them after the link.
- *
- * @param string the string
- * @param string the type: email, url, or both
- * @param bool whether to create pop-up links
- * @return string
- */
if ( ! function_exists('auto_link'))
{
+ /**
+ * Auto-linker
+ *
+ * Automatically links URL and Email addresses.
+ * Note: There's a bit of extra code here to deal with
+ * URLs or emails that end in a period. We'll strip these
+ * off and add them after the link.
+ *
+ * @param string the string
+ * @param string the type: email, url, or both
+ * @param bool whether to create pop-up links
+ * @return string
+ */
function auto_link($str, $type = 'both', $popup = FALSE)
{
if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches))
@@ -423,16 +424,16 @@ if ( ! function_exists('auto_link'))
// ------------------------------------------------------------------------
-/**
- * Prep URL
- *
- * Simply adds the http:// part if no scheme is included
- *
- * @param string the URL
- * @return string
- */
if ( ! function_exists('prep_url'))
{
+ /**
+ * Prep URL
+ *
+ * Simply adds the http:// part if no scheme is included
+ *
+ * @param string the URL
+ * @return string
+ */
function prep_url($str = '')
{
if ($str === 'http://' OR $str == '')
@@ -453,20 +454,20 @@ if ( ! function_exists('prep_url'))
// ------------------------------------------------------------------------
-/**
- * Create URL Title
- *
- * Takes a "title" string as input and creates a
- * human-friendly URL string with a "separator" string
- * as the word separator.
- *
- * @param string the string
- * @param string the separator
- * @param bool
- * @return string
- */
if ( ! function_exists('url_title'))
{
+ /**
+ * Create URL Title
+ *
+ * Takes a "title" string as input and creates a
+ * human-friendly URL string with a "separator" string
+ * as the word separator.
+ *
+ * @param string the string
+ * @param string the separator
+ * @param bool
+ * @return string
+ */
function url_title($str, $separator = '-', $lowercase = FALSE)
{
if ($separator === 'dash')
@@ -504,19 +505,20 @@ if ( ! function_exists('url_title'))
// ------------------------------------------------------------------------
-/**
- * Header Redirect
- *
- * Header redirect in two flavors
- * For very fine grained control over headers, you could use the Output
- * Library's set_header() function.
- *
- * @param string the URL
- * @param string the method: location or refresh
- * @return string
- */
if ( ! function_exists('redirect'))
{
+ /**
+ * Header Redirect
+ *
+ * Header redirect in two flavors
+ * For very fine grained control over headers, you could use the Output
+ * Library's set_header() function.
+ *
+ * @param string the URL
+ * @param string the method: location or refresh
+ * @param int
+ * @return string
+ */
function redirect($uri = '', $method = 'auto', $http_response_code = 302)
{
if ( ! preg_match('#^https?://#i', $uri))
@@ -545,17 +547,17 @@ if ( ! function_exists('redirect'))
// ------------------------------------------------------------------------
-/**
- * Parse out the attributes
- *
- * Some of the functions use this
- *
- * @param array
- * @param bool
- * @return string
- */
if ( ! function_exists('_parse_attributes'))
{
+ /**
+ * Parse out the attributes
+ *
+ * Some of the functions use this
+ *
+ * @param array
+ * @param bool
+ * @return string
+ */
function _parse_attributes($attributes, $javascript = FALSE)
{
if (is_string($attributes))
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 67fd34b97..958c633dd 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -37,15 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * Convert Reserved XML characters to Entities
- *
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('xml_convert'))
{
+ /**
+ * Convert Reserved XML characters to Entities
+ *
+ * @param string
+ * @param bool
+ * @return string
+ */
function xml_convert($str, $protect_all = FALSE)
{
$temp = '__TEMP_AMPERSANDS__';
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 0493d5a6e..ba732ee8e 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -55,14 +55,14 @@ class CI_Cache extends CI_Driver_Library {
* @var string
*/
protected $_cache_path = NULL;
-
+
/**
* Reference to the driver
*
* @var mixed
*/
protected $_adapter = 'dummy';
-
+
/**
* Fallback driver
*
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index ec4195278..f0eb8bdf7 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -45,6 +45,8 @@ class CI_Cache_file extends CI_Driver {
/**
* Initialize file-based cache
+ *
+ * @return void
*/
public function __construct()
{
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index 813df4b1c..1df149c2d 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -77,7 +77,7 @@ class CI_Cache_memcached extends CI_Driver {
* @param string unique identifier
* @param mixed data being cached
* @param int time to live
- * @return bool true on success, false on failure
+ * @return bool true on success, false on failure
*/
public function save($id, $data, $ttl = 60)
{
@@ -99,7 +99,7 @@ class CI_Cache_memcached extends CI_Driver {
* Delete from Cache
*
* @param mixed key to be deleted.
- * @return bool true on success, false on failure
+ * @return bool true on success, false on failure
*/
public function delete($id)
{
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 4db754f5e..92f372b20 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -44,55 +44,55 @@ class CI_Calendar {
* @var object
*/
protected $CI;
-
+
/**
* Current local time
*
* @var int
*/
public $local_time;
-
+
/**
* Calendar layout template
*
* @var string
*/
public $template = '';
-
+
/**
* Day of the week to start the calendar on
*
* @var string
*/
public $start_day = 'sunday';
-
+
/**
* How to display months
*
* @var string
*/
public $month_type = 'long';
-
+
/**
* How to display names of days
*
* @var string
*/
public $day_type = 'abr';
-
+
/**
* Whether to show next/prev month links
*
* @var bool
*/
- public $show_next_prev = FALSE;
-
+ public $show_next_prev = FALSE;
+
/**
* Url base to use for next/prev month links
*
* @var bool
*/
- public $next_prev_url = '';
+ public $next_prev_url = '';
/**
* Constructor
@@ -187,7 +187,7 @@ class CI_Calendar {
// Set the starting day of the week
$start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6);
- $start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day];
+ $start_day = isset($start_days[$this->start_day]) ? $start_days[$this->start_day] : 0;
// Set the starting day number
$local_date = mktime(12, 0, 0, $month, 1, $year);
@@ -290,9 +290,7 @@ class CI_Calendar {
$out .= "\n".$this->temp['cal_row_end']."\n";
}
- $out .= "\n".$this->temp['table_close'];
-
- return $out;
+ return $out .= "\n".$this->temp['table_close'];
}
// --------------------------------------------------------------------
@@ -317,14 +315,9 @@ class CI_Calendar {
$month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december');
}
- $month = $month_names[$month];
-
- if ($this->CI->lang->line($month) === FALSE)
- {
- return ucfirst(substr($month, 4));
- }
-
- return $this->CI->lang->line($month);
+ return ($this->CI->lang->line($month_names[$month]) === FALSE)
+ ? ucfirst(substr($month_names[$month], 4))
+ : $this->CI->lang->line($month_names[$month]);
}
// --------------------------------------------------------------------
@@ -345,11 +338,11 @@ class CI_Calendar {
$this->day_type = $day_type;
}
- if ($this->day_type == 'long')
+ if ($this->day_type === 'long')
{
$day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
}
- elseif ($this->day_type == 'short')
+ elseif ($this->day_type === 'short')
{
$day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
}
@@ -448,7 +441,7 @@ class CI_Calendar {
*/
public function default_template()
{
- return array (
+ return array(
'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
'heading_row_start' => '<tr>',
'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index eee123584..b73ed5128 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -39,11 +39,11 @@ class CI_Cart {
/**
* These are the regular expression rules that we use to validate the product ID and product name
* alpha-numeric, dashes, underscores, or periods
- *
+ *
* @var string
*/
public $product_id_rules = '\.a-z0-9_-';
-
+
/**
* These are the regular expression rules that we use to validate the product ID and product name
* alpha-numeric, dashes, underscores, colons or periods
@@ -51,7 +51,7 @@ class CI_Cart {
* @var string
*/
public $product_name_rules = '\.\:\-_ a-z0-9';
-
+
/**
* only allow safe product names
*
@@ -62,14 +62,14 @@ class CI_Cart {
// --------------------------------------------------------------------------
// Protected variables. Do not change!
// --------------------------------------------------------------------------
-
+
/**
* Reference to CodeIgniter instance
*
* @var object
*/
protected $CI;
-
+
/**
* Contents of the cart
*
@@ -83,6 +83,7 @@ class CI_Cart {
* The constructor loads the Session class, used to store the shopping cart contents.
*
* @param array
+ * @return void
*/
public function __construct($params = array())
{
@@ -180,7 +181,7 @@ class CI_Cart {
// --------------------------------------------------------------------
// Does the $items array contain an id, quantity, price, and name? These are required
- if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name']))
+ if ( ! isset($items['id'], $items['qty'], $items['price'], $items['name']))
{
log_message('error', 'The cart array must contain a product ID, quantity, price, and name.');
return FALSE;
@@ -341,7 +342,7 @@ class CI_Cart {
protected function _update($items = array())
{
// Without these array indexes there is nothing we can do
- if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this->_cart_contents[$items['rowid']]))
+ if ( ! isset($items['qty'], $items['rowid'], $this->_cart_contents[$items['rowid']]))
{
return FALSE;
}
@@ -383,7 +384,7 @@ class CI_Cart {
foreach ($this->_cart_contents as $key => $val)
{
// We make sure the array contains the proper indexes
- if ( ! is_array($val) OR ! isset($val['price']) OR ! isset($val['qty']))
+ if ( ! is_array($val) OR ! isset($val['price'], $val['qty']))
{
continue;
}
@@ -393,7 +394,7 @@ class CI_Cart {
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
}
- // Is our cart empty? If so we delete it from the session
+ // Is our cart empty? If so we delete it from the session
if (count($this->_cart_contents) <= 2)
{
$this->CI->session->unset_userdata('cart_contents');
@@ -489,7 +490,7 @@ class CI_Cart {
*/
public function has_options($rowid = '')
{
- return (isset($this->_cart_contents[$rowid]['options']) && count($this->_cart_contents[$rowid]['options']) !== 0) ? TRUE : FALSE;
+ return (isset($this->_cart_contents[$rowid]['options']) && count($this->_cart_contents[$rowid]['options']) !== 0);
}
// --------------------------------------------------------------------
@@ -519,15 +520,7 @@ class CI_Cart {
*/
public function format_number($n = '')
{
- if ($n == '')
- {
- return '';
- }
-
- // Remove anything that isn't a number or decimal point.
- $n = (float) $n;
-
- return number_format($n, 2, '.', ',');
+ return ($n == '') ? '' : number_format( (float) $n, 2, '.', ',');
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index b1fff154d..c79698c7b 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -45,7 +45,7 @@ class CI_Driver_Library {
* @var array
*/
protected $valid_drivers = array();
-
+
/**
* Name of the current class - usually the driver class
*
@@ -57,8 +57,8 @@ class CI_Driver_Library {
* The first time a child is used it won't exist, so we instantiate it
* subsequents calls will go straight to the proper child.
*
- * @param mixed $child
- * @return mixed
+ * @param mixed $child
+ * @return mixed
*/
public function __get($child)
{
@@ -145,7 +145,7 @@ class CI_Driver {
* @var array
*/
protected $_methods = array();
-
+
/**
* List of properties in the parent class
*
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 103c3cb25..56d60c802 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -93,6 +93,8 @@ class CI_Email {
* Constructor - Sets Email Preferences
*
* The constructor can be passed an array of config values
+ *
+ * @return void
*/
public function __construct($config = array())
{
@@ -303,8 +305,7 @@ class CI_Email {
*/
public function cc($cc)
{
- $cc = $this->_str_to_array($cc);
- $cc = $this->clean_email($cc);
+ $cc = $this->clean_email($this->_str_to_array($cc));
if ($this->validate)
{
@@ -338,8 +339,7 @@ class CI_Email {
$this->bcc_batch_size = $limit;
}
- $bcc = $this->_str_to_array($bcc);
- $bcc = $this->clean_email($bcc);
+ $bcc = $this->clean_email($this->_str_to_array($bcc));
if ($this->validate)
{
@@ -441,15 +441,11 @@ class CI_Email {
{
if ( ! is_array($email))
{
- if (strpos($email, ',') !== FALSE)
- {
- $email = preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY);
- }
- else
- {
- $email = (array) trim($email);
- }
+ return (strpos($email, ',') !== FALSE)
+ ? preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY)
+ : (array) trim($email);
}
+
return $email;
}
@@ -477,7 +473,7 @@ class CI_Email {
*/
public function set_mailtype($type = 'text')
{
- $this->mailtype = ($type == 'html') ? 'html' : 'text';
+ $this->mailtype = ($type === 'html') ? 'html' : 'text';
return $this;
}
@@ -574,7 +570,7 @@ class CI_Email {
protected function _get_message_id()
{
$from = str_replace(array('>', '<'), '', $this->_headers['Return-Path']);
- return '<'.uniqid('').strstr($from, '@').'>';
+ return '<'.uniqid('').strstr($from, '@').'>';
}
// --------------------------------------------------------------------
@@ -631,13 +627,9 @@ class CI_Email {
*/
protected function _get_content_type()
{
- if ($this->mailtype === 'html' && count($this->_attach_name) === 0)
- {
- return 'html';
- }
- elseif ($this->mailtype === 'html' && count($this->_attach_name) > 0)
+ if ($this->mailtype === 'html')
{
- return 'html-attach';
+ return (count($this->_attach_name) == 0) ? 'html' : 'html-attach';
}
elseif ($this->mailtype === 'text' && count($this->_attach_name) > 0)
{
@@ -731,7 +723,7 @@ class CI_Email {
{
if ( ! is_array($email))
{
- return (preg_match('/\<(.*)\>/', $email, $match)) ? $match[1] : $email;
+ return preg_match('/\<(.*)\>/', $email, $match) ? $match[1] : $email;
}
$clean_email = array();
@@ -763,7 +755,7 @@ class CI_Email {
return $this->word_wrap($this->alt_message, '76');
}
- $body = (preg_match('/\<body.*?\>(.*)\<\/body\>/si', $this->_body, $match)) ? $match[1] : $this->_body;
+ $body = preg_match('/\<body.*?\>(.*)\<\/body\>/si', $this->_body, $match) ? $match[1] : $this->_body;
$body = str_replace("\t", '', preg_replace('#<!--(.*)--\>#', '', trim(strip_tags($body))));
for ($i = 20; $i >= 3; $i--)
@@ -788,11 +780,11 @@ class CI_Email {
// Se the character limit
if ($charlim == '')
{
- $charlim = ($this->wrapchars == "") ? 76 : $this->wrapchars;
+ $charlim = ($this->wrapchars == '') ? 76 : $this->wrapchars;
}
// Reduce multiple spaces
- $str = preg_replace("| +|", " ", $str);
+ $str = preg_replace('| +|', ' ', $str);
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
@@ -803,22 +795,22 @@ class CI_Email {
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
- if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches))
+ if (preg_match_all('|(\{unwrap\}.+?\{/unwrap\})|s', $str, $matches))
{
for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
{
$unwrap[] = $matches[1][$i];
- $str = str_replace($matches[1][$i], "{{unwrapped".$i."}}", $str);
+ $str = str_replace($matches[1][$i], '{{unwrapped'.$i.'}}', $str);
}
}
// Use PHP's native public function to do the initial wordwrap.
// We set the cut flag to FALSE so that any individual words that are
- // too long get left alone. In the next step we'll deal with them.
+ // too long get left alone. In the next step we'll deal with them.
$str = wordwrap($str, $charlim, "\n", FALSE);
// Split the string into individual lines of text and cycle through them
- $output = "";
+ $output = '';
foreach (explode("\n", $str) as $line)
{
// Is the line within the allowed character count?
@@ -833,7 +825,7 @@ class CI_Email {
do
{
// If the over-length word is a URL we won't wrap it
- if (preg_match("!\[url.+\]|://|wwww.!", $line))
+ if (preg_match('!\[url.+\]|://|wwww.!', $line))
{
break;
}
@@ -859,7 +851,7 @@ class CI_Email {
{
foreach ($unwrap as $key => $val)
{
- $output = str_replace("{{unwrapped".$key."}}", $val, $output);
+ $output = str_replace('{{unwrapped'.$key.'}}', $val, $output);
}
}
@@ -898,15 +890,15 @@ class CI_Email {
}
reset($this->_headers);
- $this->_header_str = "";
+ $this->_header_str = '';
foreach ($this->_headers as $key => $val)
{
$val = trim($val);
- if ($val != "")
+ if ($val != '')
{
- $this->_header_str .= $key.": ".$val.$this->newline;
+ $this->_header_str .= $key.': '.$val.$this->newline;
}
}
@@ -940,8 +932,8 @@ class CI_Email {
{
case 'plain' :
- $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: " . $this->_get_encoding();
+ $hdr .= 'Content-Type: text/plain; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: '.$this->_get_encoding();
if ($this->_get_protocol() === 'mail')
{
@@ -959,25 +951,25 @@ class CI_Email {
if ($this->send_multipart === FALSE)
{
- $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: quoted-printable";
+ $hdr .= 'Content-Type: text/html; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: quoted-printable';
}
else
{
- $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline . $this->newline;
+ $hdr .= 'Content-Type: multipart/alternative; boundary="'.$this->_alt_boundary.'"'.$this->newline.$this->newline;
- $body .= $this->_get_mime_message() . $this->newline . $this->newline
- . "--" . $this->_alt_boundary . $this->newline
+ $body .= $this->_get_mime_message().$this->newline.$this->newline
+ .'--'.$this->_alt_boundary.$this->newline
- . "Content-Type: text/plain; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline
- . $this->_get_alt_message() . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline
+ .'Content-Type: text/plain; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: '.$this->_get_encoding().$this->newline.$this->newline
+ .$this->_get_alt_message().$this->newline.$this->newline.'--'.$this->_alt_boundary.$this->newline
- . "Content-Type: text/html; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: quoted-printable" . $this->newline . $this->newline;
+ .'Content-Type: text/html; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: quoted-printable'.$this->newline.$this->newline;
}
- $this->_finalbody = $body . $this->_prep_quoted_printable($this->_body) . $this->newline . $this->newline;
+ $this->_finalbody = $body.$this->_prep_quoted_printable($this->_body).$this->newline.$this->newline;
if ($this->_get_protocol() === 'mail')
@@ -986,59 +978,59 @@ class CI_Email {
}
else
{
- $this->_finalbody = $hdr . $this->_finalbody;
+ $this->_finalbody = $hdr.$this->_finalbody;
}
if ($this->send_multipart !== FALSE)
{
- $this->_finalbody .= "--" . $this->_alt_boundary . "--";
+ $this->_finalbody .= '--'.$this->_alt_boundary.'--';
}
return;
case 'plain-attach' :
- $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline . $this->newline;
+ $hdr .= 'Content-Type: multipart/'.$this->multipart.'; boundary="'.$this->_atc_boundary.'"'.$this->newline.$this->newline;
if ($this->_get_protocol() === 'mail')
{
$this->_header_str .= $hdr;
}
- $body .= $this->_get_mime_message() . $this->newline . $this->newline
- . "--" . $this->_atc_boundary . $this->newline
+ $body .= $this->_get_mime_message().$this->newline.$this->newline
+ .'--'.$this->_atc_boundary.$this->newline
- . "Content-Type: text/plain; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline
+ .'Content-Type: text/plain; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: '.$this->_get_encoding().$this->newline.$this->newline
- . $this->_body . $this->newline . $this->newline;
+ .$this->_body.$this->newline.$this->newline;
break;
case 'html-attach' :
- $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline . $this->newline;
+ $hdr .= 'Content-Type: multipart/'.$this->multipart.'; boundary="'.$this->_atc_boundary.'"'.$this->newline.$this->newline;
if ($this->_get_protocol() === 'mail')
{
$this->_header_str .= $hdr;
}
- $body .= $this->_get_mime_message() . $this->newline . $this->newline
- . "--" . $this->_atc_boundary . $this->newline
+ $body .= $this->_get_mime_message().$this->newline.$this->newline
+ .'--'.$this->_atc_boundary.$this->newline
- . "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline .$this->newline
- . "--" . $this->_alt_boundary . $this->newline
+ .'Content-Type: multipart/alternative; boundary="'.$this->_alt_boundary.'"'.$this->newline.$this->newline
+ .'--'.$this->_alt_boundary.$this->newline
- . "Content-Type: text/plain; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline
- . $this->_get_alt_message() . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline
+ .'Content-Type: text/plain; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: '.$this->_get_encoding().$this->newline.$this->newline
+ .$this->_get_alt_message().$this->newline.$this->newline.'--'.$this->_alt_boundary.$this->newline
- . "Content-Type: text/html; charset=" . $this->charset . $this->newline
- . "Content-Transfer-Encoding: quoted-printable" . $this->newline . $this->newline
+ .'Content-Type: text/html; charset='.$this->charset.$this->newline
+ .'Content-Transfer-Encoding: quoted-printable'.$this->newline.$this->newline
- . $this->_prep_quoted_printable($this->_body) . $this->newline . $this->newline
- . "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline;
+ .$this->_prep_quoted_printable($this->_body).$this->newline.$this->newline
+ .'--'.$this->_alt_boundary.'--'.$this->newline.$this->newline;
break;
}
@@ -1047,7 +1039,7 @@ class CI_Email {
for ($i = 0, $c = count($this->_attach_name), $z = 0; $i < $c; $i++)
{
$filename = $this->_attach_name[$i][0];
- $basename = (is_null($this->_attach_name[$i][1])) ? basename($filename) : $this->_attach_name[$i][1];
+ $basename = is_null($this->_attach_name[$i][1]) ? basename($filename) : $this->_attach_name[$i][1];
$ctype = $this->_attach_type[$i];
$file_content = '';
@@ -1075,17 +1067,18 @@ class CI_Email {
{
$file_content =& $this->_attach_content[$i];
}
- $attachment[$z++] = "--".$this->_atc_boundary.$this->newline
- . "Content-type: ".$ctype."; "
- . "name=\"".$basename."\"".$this->newline
- . "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline
- . "Content-Transfer-Encoding: base64".$this->newline;
+
+ $attachment[$z++] = '--'.$this->_atc_boundary.$this->newline
+ .'Content-type: '.$ctype.'; '
+ .'name="'.$basename.'"'.$this->newline
+ .'Content-Disposition: '.$this->_attach_disp[$i].';'.$this->newline
+ .'Content-Transfer-Encoding: base64'.$this->newline;
$attachment[$z++] = chunk_split(base64_encode($file_content));
}
- $body .= implode($this->newline, $attachment).$this->newline."--".$this->_atc_boundary."--";
- $this->_finalbody = ($this->_get_protocol() === 'mail') ? $body : $hdr . $body;
+ $body .= implode($this->newline, $attachment).$this->newline.'--'.$this->_atc_boundary.'--';
+ $this->_finalbody = ($this->_get_protocol() === 'mail') ? $body : $hdr.$body;
return;
}
@@ -1112,7 +1105,7 @@ class CI_Email {
}
// Reduce multiple spaces & remove nulls
- $str = preg_replace(array("| +|", '/\x00+/'), array(' ', ''), $str);
+ $str = preg_replace(array('| +|', '/\x00+/'), array(' ', ''), $str);
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
@@ -1233,11 +1226,9 @@ class CI_Email {
$temp .= $char;
}
- $str = $output.$temp;
-
// wrap each line with the shebang, charset, and transfer encoding
// the preceding space on successive lines is required for header "folding"
- return trim(preg_replace('/^(.*)$/m', ' =?'.$this->charset.'?Q?$1?=', $str));
+ return trim(preg_replace('/^(.*)$/m', ' =?'.$this->charset.'?Q?$1?=', $output.$temp));
}
// --------------------------------------------------------------------
@@ -1335,7 +1326,7 @@ class CI_Email {
*/
protected function _unwrap_specials()
{
- $this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody);
+ $this->_finalbody = preg_replace_callback('/\{unwrap\}(.*?)\{\/unwrap\}/si', array($this, '_remove_nl_callback'), $this->_finalbody);
}
// --------------------------------------------------------------------
@@ -1366,10 +1357,10 @@ class CI_Email {
{
$this->_unwrap_specials();
- $method = '_send_with_' . $this->_get_protocol();
+ $method = '_send_with_'.$this->_get_protocol();
if ( ! $this->$method())
{
- $this->_set_error_message('lang:email_send_failure_' . ($this->_get_protocol() === 'mail' ? 'phpmail' : $this->_get_protocol()));
+ $this->_set_error_message('lang:email_send_failure_'.($this->_get_protocol() === 'mail' ? 'phpmail' : $this->_get_protocol()));
return FALSE;
}
@@ -1394,7 +1385,7 @@ class CI_Email {
{
// most documentation of sendmail using the "-f" flag lacks a space after it, however
// we've encountered servers that seem to require it to be in place.
- return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']));
+ return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$this->clean_email($this->_headers['From']));
}
}
@@ -1407,7 +1398,7 @@ class CI_Email {
*/
protected function _send_with_sendmail()
{
- $fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w');
+ $fp = @popen($this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From']).' -t', 'w');
if ($fp === FALSE OR $fp === NULL)
{
@@ -1461,7 +1452,7 @@ class CI_Email {
{
foreach ($this->_cc_array as $val)
{
- if ($val != "")
+ if ($val != '')
{
$this->_send_command('to', $val);
}
@@ -1472,7 +1463,7 @@ class CI_Email {
{
foreach ($this->_bcc_array as $val)
{
- if ($val != "")
+ if ($val != '')
{
$this->_send_command('to', $val);
}
@@ -1482,7 +1473,7 @@ class CI_Email {
$this->_send_command('data');
// perform dot transformation on any lines that begin with a dot
- $this->_send_data($this->_header_str . preg_replace('/^\./m', '..$1', $this->_finalbody));
+ $this->_send_data($this->_header_str.preg_replace('/^\./m', '..$1', $this->_finalbody));
$this->_send_data('.');
@@ -1513,14 +1504,14 @@ class CI_Email {
$ssl = ($this->smtp_crypto == 'ssl') ? 'ssl://' : NULL;
$this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
- $this->smtp_port,
- $errno,
- $errstr,
- $this->smtp_timeout);
+ $this->smtp_port,
+ $errno,
+ $errstr,
+ $this->smtp_timeout);
if ( ! is_resource($this->_smtp_connect))
{
- $this->_set_error_message('lang:email_smtp_error', $errno." ".$errstr);
+ $this->_set_error_message('lang:email_smtp_error', $errno.' '.$errstr);
return FALSE;
}
@@ -1558,27 +1549,29 @@ class CI_Email {
{
case 'hello' :
- if ($this->_smtp_auth OR $this->_get_encoding() == '8bit')
- $this->_send_data('EHLO '.$this->_get_hostname());
- else
- $this->_send_data('HELO '.$this->_get_hostname());
+ if ($this->_smtp_auth OR $this->_get_encoding() === '8bit')
+ {
+ $this->_send_data('EHLO '.$this->_get_hostname());
+ }
+ else
+ {
+ $this->_send_data('HELO '.$this->_get_hostname());
+ }
$resp = 250;
break;
case 'starttls' :
$this->_send_data('STARTTLS');
-
$resp = 220;
break;
case 'from' :
$this->_send_data('MAIL FROM:<'.$data.'>');
-
$resp = 250;
break;
- case 'to' :
-
+ case 'to' :
+
if ($this->dsn)
{
$this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data);
@@ -1587,25 +1580,24 @@ class CI_Email {
{
$this->_send_data('RCPT TO:<'.$data.'>');
}
+
$resp = 250;
break;
case 'data' :
$this->_send_data('DATA');
-
$resp = 354;
break;
case 'quit' :
$this->_send_data('QUIT');
-
$resp = 221;
break;
}
$reply = $this->_get_smtp_data();
- $this->_debug_msg[] = "<pre>".$cmd.": ".$reply."</pre>";
+ $this->_debug_msg[] = '<pre>'.$cmd.': '.$reply.'</pre>';
if (substr($reply, 0, 3) != $resp)
{
@@ -1701,13 +1693,13 @@ class CI_Email {
*/
protected function _get_smtp_data()
{
- $data = "";
+ $data = '';
while ($str = fgets($this->_smtp_connect, 512))
{
$data .= $str;
- if ($str[3] == " ")
+ if ($str[3] == ' ')
{
break;
}
@@ -1806,11 +1798,11 @@ class CI_Email {
if (substr($msg, 0, 5) !== 'lang:' OR FALSE === ($line = $CI->lang->line(substr($msg, 5))))
{
- $this->_debug_msg[] = str_replace('%s', $val, $msg)."<br />";
+ $this->_debug_msg[] = str_replace('%s', $val, $msg).'<br />';
}
else
{
- $this->_debug_msg[] = str_replace('%s', $val, $line)."<br />";
+ $this->_debug_msg[] = str_replace('%s', $val, $line).'<br />';
}
}
@@ -1921,4 +1913,4 @@ class CI_Email {
}
/* End of file Email.php */
-/* Location: ./system/libraries/Email.php */
+/* Location: ./system/libraries/Email.php */ \ No newline at end of file
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 17437c1ca..751557fab 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -44,28 +44,28 @@ class CI_Encrypt {
* @var string
*/
public $encryption_key = '';
-
+
/**
* Type of hash operation
- *
+ *
* @var string
*/
protected $_hash_type = 'sha1';
-
+
/**
* Flag for the existance of mcrypt
*
* @var bool
*/
protected $_mcrypt_exists = FALSE;
-
+
/**
* Current cipher to be used with mcrypt
*
* @var string
*/
protected $_mcrypt_cipher;
-
+
/**
* Method for encrypting/decrypting data
*
@@ -75,6 +75,8 @@ class CI_Encrypt {
/**
* Initialize Encryption class
+ *
+ * @return void
*/
public function __construct()
{
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index c396580be..67cbfd1a0 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -42,63 +42,63 @@ class CI_Form_validation {
* @var object
*/
protected $CI;
-
+
/**
* Validation data for the current form submission
*
* @var array
*/
- protected $_field_data = array();
-
+ protected $_field_data = array();
+
/**
* Validation rules for the current form
*
* @var array
*/
- protected $_config_rules = array();
-
+ protected $_config_rules = array();
+
/**
* Array of validation errors
*
* @var array
*/
protected $_error_array = array();
-
+
/**
* Array of custom error messages
*
* @var array
*/
protected $_error_messages = array();
-
+
/**
* Start tag for error wrapping
*
* @var string
*/
protected $_error_prefix = '<p>';
-
+
/**
* End tag for error wrapping
- *
+ *
* @var string
*/
protected $_error_suffix = '</p>';
-
+
/**
* Custom error message
*
* @var string
*/
protected $error_string = '';
-
+
/**
* Whether the form data has been validated as safe
*
* @var bool
*/
protected $_safe_form_data = FALSE;
-
+
/**
* Custom data to validate
*
@@ -109,7 +109,8 @@ class CI_Form_validation {
/**
* Initialize Form_Validation class
*
- * @param array $rules
+ * @param array $rules
+ * @return void
*/
public function __construct($rules = array())
{
@@ -222,13 +223,13 @@ class CI_Form_validation {
// Build our master array
$this->_field_data[$field] = array(
- 'field' => $field,
- 'label' => $label,
- 'rules' => $rules,
- 'is_array' => $is_array,
- 'keys' => $indexes,
- 'postdata' => NULL,
- 'error' => ''
+ 'field' => $field,
+ 'label' => $label,
+ 'rules' => $rules,
+ 'is_array' => $is_array,
+ 'keys' => $indexes,
+ 'postdata' => NULL,
+ 'error' => ''
);
return $this;
@@ -595,16 +596,13 @@ class CI_Form_validation {
// Set the message type
$type = in_array('required', $rules) ? 'required' : 'isset';
- if ( ! isset($this->_error_messages[$type]))
+ if (isset($this->_error_messages[$type]))
{
- if (FALSE === ($line = $this->CI->lang->line($type)))
- {
- $line = 'The field was not set';
- }
+ $line = $this->_error_messages[$type];
}
- else
+ elseif (FALSE === ($line = $this->CI->lang->line($type)))
{
- $line = $this->_error_messages[$type];
+ $line = 'The field was not set';
}
// Build the error message
@@ -956,12 +954,8 @@ class CI_Form_validation {
public function matches($str, $field)
{
$validation_array = empty($this->validation_data) ? $_POST : $this->validation_data;
- if ( ! isset($validation_array[$field]))
- {
- return FALSE;
- }
- return ($str === $validation_array[$field]);
+ return isset($validation_array[$field]) ? ($str === $validation_array[$field]) : FALSE;
}
// --------------------------------------------------------------------
@@ -1276,7 +1270,7 @@ class CI_Form_validation {
*/
public function valid_base64($str)
{
- return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
+ return ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 8aa1650d2..3cfe1b2b6 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -44,7 +44,6 @@ class CI_FTP {
public $debug = FALSE;
public $conn_id = FALSE;
-
public function __construct($config = array())
{
if (count($config) > 0)
@@ -539,7 +538,6 @@ class CI_FTP {
return FALSE;
}
-
// --------------------------------------------------------------------
/**
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 24695049c..0cb189445 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -38,321 +38,321 @@ class CI_Image_lib {
/**
* PHP extension/library to use for image manipulation
- * Can be: imagemagick, netpbm, gd, gd2
+ * Can be: imagemagick, netpbm, gd, gd2
*
* @var string
*/
public $image_library = 'gd2';
-
+
/**
* Path to the graphic library (if applicable)
*
* @var string
*/
public $library_path = '';
-
+
/**
* Whether to send to browser or write to disk
*
* @var bool
*/
public $dynamic_output = FALSE;
-
+
/**
* Path to original image
*
* @var string
*/
public $source_image = '';
-
+
/**
* Path to the modified image
*
* @var string
*/
- public $new_image = '';
-
+ public $new_image = '';
+
/**
* Image width
*
* @var int
*/
- public $width = '';
-
+ public $width = '';
+
/**
* Image height
*
* @var int
*/
- public $height = '';
-
+ public $height = '';
+
/**
* Quality percentage of new image
*
* @var int
*/
- public $quality = '90';
-
+ public $quality = 90;
+
/**
* Whether to create a thumbnail
*
* @var bool
*/
public $create_thumb = FALSE;
-
+
/**
* String to add to thumbnail version of image
*
* @var string
*/
public $thumb_marker = '_thumb';
-
+
/**
* Whether to maintain aspect ratio when resizing or use hard values
*
* @var bool
*/
public $maintain_ratio = TRUE;
-
+
/**
* auto, height, or width. Determines what to use as the master dimension
*
* @var string
*/
- public $master_dim = 'auto';
-
+ public $master_dim = 'auto';
+
/**
* Angle at to rotate image
*
* @var string
*/
public $rotation_angle = '';
-
+
/**
* X Coordinate for manipulation of the current image
*
* @var int
*/
- public $x_axis = '';
-
+ public $x_axis = '';
+
/**
* Y Coordinate for manipulation of the current image
*
* @var int
*/
- public $y_axis = '';
+ public $y_axis = '';
// --------------------------------------------------------------------------
// Watermark Vars
// --------------------------------------------------------------------------
-
+
/**
* Watermark text if graphic is not used
*
* @var string
*/
public $wm_text = '';
-
+
/**
* Type of watermarking. Options: text/overlay
*
* @var string
*/
public $wm_type = 'text';
-
+
/**
* Default transparency for watermark
- *
+ *
* @var int
*/
public $wm_x_transp = 4;
-
+
/**
* Default transparency for watermark
*
* @var int
*/
public $wm_y_transp = 4;
-
+
/**
* Watermark image path
- *
+ *
* @var string
*/
- public $wm_overlay_path = '';
-
+ public $wm_overlay_path = '';
+
/**
* TT font
*
* @var string
*/
public $wm_font_path = '';
-
+
/**
* Font size (different versions of GD will either use points or pixels)
*
* @var int
*/
public $wm_font_size = 17;
-
+
/**
* Vertical alignment: T M B
*
* @var string
*/
public $wm_vrt_alignment = 'B';
-
+
/**
* Horizontal alignment: L R C
*
* @var string
*/
public $wm_hor_alignment = 'C';
-
+
/**
* Padding around text
*
* @var int
*/
public $wm_padding = 0;
-
+
/**
* Lets you push text to the right
*
* @var int
*/
public $wm_hor_offset = 0;
-
+
/**
* Lets you push text down
*
* @var int
*/
public $wm_vrt_offset = 0;
-
+
/**
* Text color
*
* @var string
*/
- protected $wm_font_color = '#ffffff';
-
+ protected $wm_font_color = '#ffffff';
+
/**
* Dropshadow color
*
* @var string
*/
- protected $wm_shadow_color = '';
-
+ protected $wm_shadow_color = '';
+
/**
* Dropshadow distance
*
* @var int
*/
public $wm_shadow_distance = 2;
-
+
/**
* Image opacity: 1 - 100 Only works with image
*
* @var int
*/
- public $wm_opacity = 50;
+ public $wm_opacity = 50;
// --------------------------------------------------------------------------
// Private Vars
// --------------------------------------------------------------------------
-
+
/**
* Source image folder
*
* @var string
*/
public $source_folder = '';
-
+
/**
* Destination image folder
*
* @var string
*/
public $dest_folder = '';
-
+
/**
* Image mime-type
*
* @var string
*/
- public $mime_type = '';
-
+ public $mime_type = '';
+
/**
- * Original image width
+ * Original image width
*
* @var int
*/
- public $orig_width = '';
-
+ public $orig_width = '';
+
/**
* Original image height
*
* @var int
*/
public $orig_height = '';
-
+
/**
* Image format
- *
+ *
* @var string
*/
- public $image_type = '';
-
+ public $image_type = '';
+
/**
* Size of current image
*
* @var string
*/
- public $size_str = '';
-
+ public $size_str = '';
+
/**
* Full path to source image
*
* @var string
*/
public $full_src_path = '';
-
+
/**
* Full path to destination image
*
* @var string
*/
public $full_dst_path = '';
-
+
/**
* Name of function to create image
*
* @var string
*/
- public $create_fnc = 'imagecreatetruecolor';
-
+ public $create_fnc = 'imagecreatetruecolor';
+
/**
* Name of function to copy image
*
* @var string
*/
- public $copy_fnc = 'imagecopyresampled';
-
+ public $copy_fnc = 'imagecopyresampled';
+
/**
* Error messages
*
* @var array
*/
- public $error_msg = array();
-
+ public $error_msg = array();
+
/**
* Whether to have a drop shadow on watermark
*
* @var bool
*/
protected $wm_use_drop_shadow = FALSE;
-
+
/**
* Whether to use truetype fonts
*
@@ -364,6 +364,7 @@ class CI_Image_lib {
* Initialize Image Library
*
* @param array $props
+ * @return void
*/
public function __construct($props = array())
{
@@ -395,7 +396,7 @@ class CI_Image_lib {
$this->image_library = 'gd2';
$this->dynamic_output = FALSE;
- $this->quality = '90';
+ $this->quality = 90;
$this->create_thumb = FALSE;
$this->thumb_marker = '_thumb';
$this->maintain_ratio = TRUE;
@@ -895,16 +896,16 @@ class CI_Image_lib {
switch ($this->image_type)
{
case 1 :
- $cmd_in = 'giftopnm';
- $cmd_out = 'ppmtogif';
+ $cmd_in = 'giftopnm';
+ $cmd_out = 'ppmtogif';
break;
case 2 :
- $cmd_in = 'jpegtopnm';
- $cmd_out = 'ppmtojpeg';
+ $cmd_in = 'jpegtopnm';
+ $cmd_out = 'ppmtojpeg';
break;
case 3 :
- $cmd_in = 'pngtopnm';
- $cmd_out = 'ppmtopng';
+ $cmd_in = 'pngtopnm';
+ $cmd_out = 'ppmtopng';
break;
}
@@ -916,15 +917,15 @@ class CI_Image_lib {
{
switch ($this->rotation_angle)
{
- case 90 : $angle = 'r270';
+ case 90: $angle = 'r270';
break;
- case 180 : $angle = 'r180';
+ case 180: $angle = 'r180';
break;
- case 270 : $angle = 'r90';
+ case 270: $angle = 'r90';
break;
- case 'vrt' : $angle = 'tb';
+ case 'vrt': $angle = 'tb';
break;
- case 'hor' : $angle = 'lr';
+ case 'hor': $angle = 'lr';
break;
}
@@ -1401,49 +1402,49 @@ class CI_Image_lib {
{
switch ($this->image_type)
{
- case 1 :
- if ( ! function_exists('imagegif'))
- {
- $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
- return FALSE;
- }
+ case 1:
+ if ( ! function_exists('imagegif'))
+ {
+ $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
+ return FALSE;
+ }
- if ( ! @imagegif($resource, $this->full_dst_path))
- {
- $this->set_error('imglib_save_failed');
- return FALSE;
- }
- break;
- case 2 :
- if ( ! function_exists('imagejpeg'))
- {
- $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
- return FALSE;
- }
+ if ( ! @imagegif($resource, $this->full_dst_path))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
+ break;
+ case 2:
+ if ( ! function_exists('imagejpeg'))
+ {
+ $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
+ return FALSE;
+ }
- if ( ! @imagejpeg($resource, $this->full_dst_path, $this->quality))
- {
- $this->set_error('imglib_save_failed');
- return FALSE;
- }
- break;
- case 3 :
- if ( ! function_exists('imagepng'))
- {
- $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
- return FALSE;
- }
+ if ( ! @imagejpeg($resource, $this->full_dst_path, $this->quality))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
+ break;
+ case 3:
+ if ( ! function_exists('imagepng'))
+ {
+ $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
+ return FALSE;
+ }
- if ( ! @imagepng($resource, $this->full_dst_path))
- {
- $this->set_error('imglib_save_failed');
- return FALSE;
- }
- break;
- default :
- $this->set_error(array('imglib_unsupported_imagecreate'));
- return FALSE;
- break;
+ if ( ! @imagepng($resource, $this->full_dst_path))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
+ break;
+ default:
+ $this->set_error(array('imglib_unsupported_imagecreate'));
+ return FALSE;
+ break;
}
return TRUE;
@@ -1466,13 +1467,13 @@ class CI_Image_lib {
switch ($this->image_type)
{
- case 1 : imagegif($resource);
+ case 1 : imagegif($resource);
break;
- case 2 : imagejpeg($resource, '', $this->quality);
+ case 2 : imagejpeg($resource, '', $this->quality);
break;
- case 3 : imagepng($resource);
+ case 3 : imagepng($resource);
break;
- default : echo 'Unable to display the image';
+ default: echo 'Unable to display the image';
break;
}
}
@@ -1613,8 +1614,10 @@ class CI_Image_lib {
foreach ($allowed as $item)
{
- if ( ! isset($vals[$item]) OR $vals[$item] == '')
+ if (empty($vals[$item]))
+ {
$vals[$item] = 0;
+ }
}
if ($vals['width'] == 0 OR $vals['height'] == 0)
@@ -1712,7 +1715,6 @@ class CI_Image_lib {
{
foreach ($msg as $val)
{
-
$msg = ($CI->lang->line($val) == FALSE) ? $val : $CI->lang->line($val);
$this->error_msg[] = $msg;
log_message('error', $msg);
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index c10363a2e..51ce43dc7 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -42,42 +42,42 @@ class CI_Log {
* @var string
*/
protected $_log_path;
-
+
/**
* Level of logging
*
* @var int
*/
protected $_threshold = 1;
-
+
/**
* Highest level of logging
*
* @var int
*/
protected $_threshold_max = 0;
-
+
/**
* Array of threshold levels to log
*
* @var array
*/
protected $_threshold_array = array();
-
+
/**
* Format of timestamp for log files
*
* @var string
*/
protected $_date_fmt = 'Y-m-d H:i:s';
-
+
/**
* Whether or not the logger can write to the log files
*
* @var bool
*/
protected $_enabled = TRUE;
-
+
/**
* Predefined logging levels
*
@@ -88,7 +88,7 @@ class CI_Log {
/**
* Initialize Logging class
*
- * @return void
+ * @return void
*/
public function __construct()
{
@@ -151,7 +151,7 @@ class CI_Log {
if ( ! file_exists($filepath))
{
$newfile = TRUE;
- $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
+ $message .= '<'."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
}
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
@@ -159,7 +159,7 @@ class CI_Log {
return FALSE;
}
- $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n";
+ $message .= $level.' '.($level === 'INFO' ? ' -' : '-').' '.date($this->_date_fmt).' --> '.$msg."\n";
flock($fp, LOCK_EX);
fwrite($fp, $message);
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index ce4683fc1..0a88e6926 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -45,28 +45,28 @@ class CI_Migration {
* @var bool
*/
protected $_migration_enabled = FALSE;
-
+
/**
* Path to migration classes
*
* @var string
*/
protected $_migration_path = NULL;
-
+
/**
* Current migration version
*
* @var mixed
*/
protected $_migration_version = 0;
-
+
/**
* Database table with migration info
*
* @var string
*/
protected $_migration_table = 'migrations';
-
+
/**
* Whether to automatically run migrations
*
@@ -85,6 +85,7 @@ class CI_Migration {
* Initialize Migration Class
*
* @param array
+ * @return void
*/
public function __construct($config = array())
{
@@ -96,7 +97,7 @@ class CI_Migration {
foreach ($config as $key => $val)
{
- $this->{'_' . $key} = $val;
+ $this->{'_'.$key} = $val;
}
log_message('debug', 'Migrations class initialized');
@@ -340,7 +341,6 @@ class CI_Migration {
}
sort($files);
-
return $files;
}
@@ -384,6 +384,7 @@ class CI_Migration {
{
return get_instance()->$var;
}
+
}
/* End of file Migration.php */
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 3d2911813..58f86fa17 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -73,6 +73,7 @@ class CI_Pagination {
* Constructor
*
* @param array initialization parameters
+ * @return void
*/
public function __construct($params = array())
{
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index c40f339b4..a0b60ed97 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -42,14 +42,14 @@ class CI_Parser {
* @var string
*/
public $l_delim = '{';
-
+
/**
* Right delimeter character for psuedo vars
*
* @var string
*/
public $r_delim = '}';
-
+
/**
* Reference to CodeIgniter instance
*
@@ -116,14 +116,9 @@ class CI_Parser {
foreach ($data as $key => $val)
{
- if (is_array($val))
- {
- $template = $this->_parse_pair($key, $val, $template);
- }
- else
- {
- $template = $this->_parse_single($key, (string)$val, $template);
- }
+ $template = is_array($val)
+ ? $this->_parse_pair($key, $val, $template)
+ : $template = $this->_parse_single($key, (string) $val, $template);
}
if ($return == FALSE)
@@ -189,14 +184,9 @@ class CI_Parser {
$temp = $match[1];
foreach ($row as $key => $val)
{
- if ( ! is_array($val))
- {
- $temp = $this->_parse_single($key, $val, $temp);
- }
- else
- {
- $temp = $this->_parse_pair($key, $val, $temp);
- }
+ $temp = is_array($val)
+ ? $this->_parse_pair($key, $val, $temp)
+ : $this->_parse_single($key, $val, $temp);
}
$str .= $temp;
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 1e86f3c61..e219d20f2 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -527,6 +527,7 @@ class CI_Profiler {
return $output.'</div>';
}
+
}
/* End of file Profiler.php */
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 3195f0a91..783109a60 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -190,6 +190,7 @@ class CI_Session {
* whenever the class is instantiated.
*
* @param array
+ * @return void
*/
public function __construct($params = array())
{
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 236129531..f844d6435 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -44,49 +44,49 @@ class CI_Table {
* @var array
*/
public $rows = array();
-
+
/**
* Data for table heading
*
* @var array
*/
public $heading = array();
-
+
/**
* Whether or not to automatically create the table header
*
* @var bool
*/
public $auto_heading = TRUE;
-
+
/**
* Table caption
*
* @var string
*/
public $caption = NULL;
-
+
/**
- * Table layout template
+ * Table layout template
*
* @var array
*/
public $template = NULL;
-
+
/**
* Newline setting
*
* @var string
*/
public $newline = "\n";
-
+
/**
* Contents of empty cells
*
* @var string
*/
public $empty_cells = '';
-
+
/**
* Callback for custom table layout
*
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 50bd12486..6aaa993ae 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -38,7 +38,7 @@ class CI_Typography {
/**
* Block level elements that should not be wrapped inside <p> tags
- *
+ *
* @var string
*/
public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
@@ -52,7 +52,7 @@ class CI_Typography {
/**
* Tags we want the parser to completely ignore when splitting the string.
- *
+ *
* @var string
*/
public $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index 0f6e2dfdd..6ec2dcd5d 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -350,11 +350,11 @@ class CI_Unit_test {
*/
function is_true($test)
{
- return (is_bool($test) && $test === TRUE);
+ return ($test === TRUE);
}
function is_false($test)
{
- return (is_bool($test) && $test === FALSE);
+ return ($test === FALSE);
}
/* End of file Unit_test.php */
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 24d4bd4d0..271c6d21f 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -1036,7 +1036,7 @@ class CI_Upload {
*/
if (DIRECTORY_SEPARATOR !== '\\')
{
- $cmd = 'file --brief --mime ' . escapeshellarg($file['tmp_name']) . ' 2>&1';
+ $cmd = 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1';
if (function_exists('exec'))
{
@@ -1103,4 +1103,4 @@ class CI_Upload {
}
/* End of file Upload.php */
-/* Location: ./system/libraries/Upload.php */
+/* Location: ./system/libraries/Upload.php */ \ No newline at end of file
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index f0c5b48e7..1853906ea 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -54,21 +54,21 @@ class CI_Xmlrpcs extends CI_Xmlrpc
* @var array
*/
public $methods = array();
-
+
/**
* Debug Message
*
* @var string
*/
public $debug_msg = '';
-
+
/**
* XML RPC Server methods
*
* @var array
*/
public $system_methods = array();
-
+
/**
* Configuration object
*
@@ -79,7 +79,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc
/**
* Initialize XMLRPC class
*
- * @param array $config
+ * @param array $config
+ * @return void
*/
public function __construct($config = array())
{
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 86d0787b2..e0dc637ad 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -48,35 +48,35 @@ class CI_Zip {
* @var string
*/
public $zipdata = '';
-
+
/**
* Zip data for a directory in string form
*
* @var string
*/
public $directory = '';
-
+
/**
* Number of files/folder in zip file
*
* @var int
*/
public $entries = 0;
-
+
/**
* Number of files in zip
*
* @var int
*/
public $file_num = 0;
-
+
/**
* relative offset of local header
*
* @var int
*/
public $offset = 0;
-
+
/**
* Reference to time at init
*
@@ -87,7 +87,7 @@ class CI_Zip {
/**
* Initialize zip compression class
*
- * @return void
+ * @return void
*/
public function __construct()
{
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index f30d7c639..3c9ae1867 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* Jquery Class
*
@@ -57,7 +55,7 @@ class CI_Jquery extends CI_Javascript {
$this->script();
}
- log_message('debug', "Jquery Class Initialized");
+ log_message('debug', 'Jquery Class Initialized');
}
// --------------------------------------------------------------------
@@ -115,7 +113,7 @@ class CI_Jquery extends CI_Javascript {
if ($ret_false)
{
- $js[] = "return false;";
+ $js[] = 'return false;';
}
return $this->_add_event($element, $js, 'click');
@@ -183,7 +181,7 @@ class CI_Jquery extends CI_Javascript {
*/
protected function _hover($element = 'this', $over, $out)
{
- $event = "\n\t$(" . $this->_prep_element($element) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n";
+ $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n";
$this->jquery_code_for_compile[] = $event;
@@ -322,7 +320,7 @@ class CI_Jquery extends CI_Javascript {
foreach ($array_js as $js)
{
- $this->jquery_code_for_compile[] = "\t$js\n";
+ $this->jquery_code_for_compile[] = "\t".$js."\n";
}
}
@@ -389,7 +387,7 @@ class CI_Jquery extends CI_Javascript {
protected function _addClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- return "$({$element}).addClass(\"$class\");";
+ return '$('.$element.').addClass("'.$class.'");';
}
// --------------------------------------------------------------------
@@ -411,9 +409,9 @@ class CI_Jquery extends CI_Javascript {
$animations = "\t\t\t";
- foreach ($params as $param=>$value)
+ foreach ($params as $param => $value)
{
- $animations .= $param.': \''.$value.'\', ';
+ $animations .= $param.": '".$value."', ";
}
$animations = substr($animations, 0, -2); // remove the last ", "
@@ -428,7 +426,7 @@ class CI_Jquery extends CI_Javascript {
$extra = ', '.$extra;
}
- return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
+ return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');';
}
// --------------------------------------------------------------------
@@ -478,7 +476,7 @@ class CI_Jquery extends CI_Javascript {
$callback = ", function(){\n{$callback}\n}";
}
- return "$({$element}).fadeOut({$speed}{$callback});";
+ return '$('.$element.').fadeOut('.$speed.$callback.');';
}
// --------------------------------------------------------------------
@@ -519,7 +517,7 @@ class CI_Jquery extends CI_Javascript {
protected function _removeClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- return "$({$element}).removeClass(\"$class\");";
+ return '$('.$element.').removeClass("'.$class.'");';
}
// --------------------------------------------------------------------
@@ -544,7 +542,7 @@ class CI_Jquery extends CI_Javascript {
$callback = ", function(){\n{$callback}\n}";
}
- return "$({$element}).slideUp({$speed}{$callback});";
+ return '$('.$element.').slideUp('.$speed.$callback.');';
}
// --------------------------------------------------------------------
@@ -569,7 +567,7 @@ class CI_Jquery extends CI_Javascript {
$callback = ", function(){\n{$callback}\n}";
}
- return "$({$element}).slideDown({$speed}{$callback});";
+ return '$('.$element.').slideDown('.$speed.$callback.');';
}
// --------------------------------------------------------------------
@@ -594,7 +592,7 @@ class CI_Jquery extends CI_Javascript {
$callback = ", function(){\n{$callback}\n}";
}
- return "$({$element}).slideToggle({$speed}{$callback});";
+ return '$('.$element.').slideToggle('.$speed.$callback.');';
}
// --------------------------------------------------------------------
@@ -610,7 +608,7 @@ class CI_Jquery extends CI_Javascript {
protected function _toggle($element = 'this')
{
$element = $this->_prep_element($element);
- return "$({$element}).toggle();";
+ return '$('.$element.').toggle();';
}
// --------------------------------------------------------------------
@@ -626,7 +624,7 @@ class CI_Jquery extends CI_Javascript {
protected function _toggleClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- return "$({$element}).toggleClass(\"$class\");";
+ return '$('.$element.').toggleClass("'.$class.'");';
}
// --------------------------------------------------------------------
@@ -651,7 +649,7 @@ class CI_Jquery extends CI_Javascript {
$callback = ", function(){\n{$callback}\n}";
}
- return "$({$element}).show({$speed}{$callback});";
+ return '$('.$element.').show('.$speed.$callback.');';
}
// --------------------------------------------------------------------
@@ -676,22 +674,22 @@ class CI_Jquery extends CI_Javascript {
// ajaxStart and ajaxStop are better choices here... but this is a stop gap
if ($this->CI->config->item('javascript_ajax_img') == '')
{
- $loading_notifier = "Loading...";
+ $loading_notifier = 'Loading...';
}
else
{
- $loading_notifier = '<img src=\''.$this->CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'\' alt=\'Loading\' />';
+ $loading_notifier = '<img src="'.$this->CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'" alt="Loading" />';
}
- $updater = "$($container).empty();\n" // anything that was in... get it out
- . "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image
+ $updater = '$('.$container.").empty();\n" // anything that was in... get it out
+ ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image
$request_options = '';
if ($options != '')
{
$request_options .= ', {'
- . (is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(":", "':'", $options)."'")
- . '}';
+ .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'")
+ .'}';
}
return $updater."\t\t$($container).load('$controller'$request_options);";
@@ -746,7 +744,7 @@ class CI_Jquery extends CI_Javascript {
$corner_style = '"'.$corner_style.'"';
}
- return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");";
+ return '$('.$this->_prep_element($element).').corner('.$corner_style.');';
}
// --------------------------------------------------------------------
@@ -821,16 +819,16 @@ class CI_Jquery extends CI_Javascript {
$sort_options = array();
foreach ($options as $k=>$v)
{
- $sort_options[] = "\n\t\t".$k.': '.$v."";
+ $sort_options[] = "\n\t\t".$k.': '.$v;
}
- $sort_options = implode(",", $sort_options);
+ $sort_options = implode(',', $sort_options);
}
else
{
$sort_options = '';
}
- return "$(" . $this->_prep_element($element) . ").sortable({".$sort_options."\n\t});";
+ return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});";
}
// --------------------------------------------------------------------
@@ -844,7 +842,7 @@ class CI_Jquery extends CI_Javascript {
*/
public function tablesorter($table = '', $options = '')
{
- $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n";
+ $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n";
}
// --------------------------------------------------------------------
@@ -869,7 +867,7 @@ class CI_Jquery extends CI_Javascript {
}
- $event = "\n\t$(" . $this->_prep_element($element) . ").{$event}(function(){\n\t\t{$js}\n\t});\n";
+ $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n";
$this->jquery_code_for_compile[] = $event;
return $event;
}
@@ -898,8 +896,8 @@ class CI_Jquery extends CI_Javascript {
// Inline references
$script = '$(document).ready(function() {'."\n"
- . implode('', $this->jquery_code_for_compile)
- . '});';
+ .implode('', $this->jquery_code_for_compile)
+ .'});';
$output = ($script_tags === FALSE) ? $script : $this->inline($script);
@@ -998,7 +996,7 @@ class CI_Jquery extends CI_Javascript {
{
return '"'.$speed.'"';
}
- elseif (preg_match("/[^0-9]/", $speed))
+ elseif (preg_match('/[^0-9]/', $speed))
{
return '';
}
@@ -1009,4 +1007,4 @@ class CI_Jquery extends CI_Javascript {
}
/* End of file Jquery.php */
-/* Location: ./system/libraries/Jquery.php */
+/* Location: ./system/libraries/Jquery.php */ \ No newline at end of file
diff --git a/tests/README.md b/tests/README.md
index b46f344cb..c8fc608e8 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -1,6 +1,6 @@
# CodeIgniter Unit Tests #
-Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=feature/unit-tests)](http://travis-ci.org/EllisLab/CodeIgniter)
+Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=develop)](http://travis-ci.org/EllisLab/CodeIgniter)
### Introduction:
diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php
index 2790b582e..109b38821 100644
--- a/tests/codeigniter/core/Benchmark_test.php
+++ b/tests/codeigniter/core/Benchmark_test.php
@@ -29,8 +29,8 @@ class Benchmark_test extends CI_TestCase {
$this->benchmark->mark('code_start');
sleep(1);
$this->benchmark->mark('code_end');
-
- $this->assertEquals('1.00', $this->benchmark->elapsed_time('code_start', 'code_end', 3));
+
+ $this->assertEquals('1.0', $this->benchmark->elapsed_time('code_start', 'code_end', 1));
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index d33a6a635..7fc5ee5a0 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -52,6 +52,7 @@ Release Date: Not Released
- set_realpath() can now also handle file paths as opposed to just directories.
- do_hash() now uses PHP's native hash() function, supporting more algorithms.
- Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html.
+ - Removed deprecated helper function ``js_insert_smiley()`` from smiley helper.
- Database