summaryrefslogtreecommitdiffstats
path: root/system/libraries/Upload.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-08 14:27:53 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-08 14:27:53 +0100
commit119d8a7547e155edaaa53682b9247cd7e80d8c9d (patch)
treecfcaa9dae3b642833d80c06b00805ba2d521c953 /system/libraries/Upload.php
parentcab3e1813f71bddfe8f045772e5cb42e76a4d347 (diff)
Optimize get_instance() calls/assignments
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r--system/libraries/Upload.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 67a65501e..525880f62 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -263,6 +263,13 @@ class CI_Upload {
*/
protected $_file_name_override = '';
+ /**
+ * CI Singleton
+ *
+ * @var object
+ */
+ protected $CI;
+
// --------------------------------------------------------------------
/**
@@ -279,6 +286,7 @@ class CI_Upload {
}
$this->mimes =& get_mimes();
+ $this->CI =& get_instance();
log_message('debug', 'Upload Class Initialized');
}
@@ -479,8 +487,7 @@ class CI_Upload {
}
// Sanitize the file name for security
- $CI =& get_instance();
- $this->file_name = $CI->security->sanitize_filename($this->file_name);
+ $this->file_name = $this->CI->security->sanitize_filename($this->file_name);
// Truncate the file name if it's too long
if ($this->max_filename > 0)
@@ -1081,7 +1088,7 @@ class CI_Upload {
return FALSE;
}
- return get_instance()->security->xss_clean($data, TRUE);
+ return $this->CI->security->xss_clean($data, TRUE);
}
// --------------------------------------------------------------------
@@ -1094,17 +1101,13 @@ class CI_Upload {
*/
public function set_error($msg)
{
- $CI =& get_instance();
- $CI->lang->load('upload');
+ $this->CI->lang->load('upload');
- if ( ! is_array($msg))
- {
- $msg = array($msg);
- }
+ is_array($msg) OR $msg = array($msg);
foreach ($msg as $val)
{
- $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val);
+ $msg = ($this->CI->lang->line($val) === FALSE) ? $val : $this->CI->lang->line($val);
$this->error_msg[] = $msg;
log_message('error', $msg);
}