diff options
author | Darren Benney <cutenfuzzy@gmail.com> | 2013-03-30 21:07:49 +0100 |
---|---|---|
committer | Darren Benney <cutenfuzzy@gmail.com> | 2013-03-30 21:07:49 +0100 |
commit | 4a8d1907d5fc5c054a24130cece8fe738ba46167 (patch) | |
tree | c1ff71e265da745f169613301dc05a7f921caa2f | |
parent | 54e6c1b04a786dc35b2fdeda456685a10f7d2073 (diff) |
Made set_error() method DRY.
-rw-r--r-- | system/libraries/Upload.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 1c14f99ed..4751a850f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1076,21 +1076,17 @@ class CI_Upload { $CI =& get_instance(); $CI->lang->load('upload'); - if (is_array($msg)) + if ( ! is_array($msg)) { - foreach ($msg as $val) - { - $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val); - $this->error_msg[] = $msg; - log_message('error', $msg); - } - } - else - { - $msg = ($CI->lang->line($msg) === FALSE) ? $msg : $CI->lang->line($msg); - $this->error_msg[] = $msg; - log_message('error', $msg); - } + $msg = array($msg); + } + + foreach ($msg as $val) + { + $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val); + $this->error_msg[] = $msg; + log_message('error', $msg); + } } // -------------------------------------------------------------------- |