diff options
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Email.php | 34 | ||||
-rw-r--r-- | system/libraries/Encrypt.php | 6 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 43 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_cookie.php | 2 | ||||
-rw-r--r-- | system/libraries/Zip.php | 4 |
5 files changed, 58 insertions, 31 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 5d8fc8aea..365a8bc79 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -406,7 +406,7 @@ class CI_Email { * Initialize preferences * * @param array - * @return void + * @return CI_Email */ public function initialize($config = array()) { @@ -440,7 +440,7 @@ class CI_Email { * Initialize the Email Data * * @param bool - * @return object + * @return CI_Email */ public function clear($clear_attachments = FALSE) { @@ -474,7 +474,7 @@ class CI_Email { * @param string $from * @param string $name * @param string $return_path = NULL Return-Path - * @return object + * @return CI_Email */ public function from($from, $name = '', $return_path = NULL) { @@ -522,7 +522,7 @@ class CI_Email { * * @param string * @param string - * @return object + * @return CI_Email */ public function reply_to($replyto, $name = '') { @@ -558,7 +558,7 @@ class CI_Email { * Set Recipients * * @param string - * @return object + * @return CI_Email */ public function to($to) { @@ -586,7 +586,7 @@ class CI_Email { * Set CC * * @param string - * @return object + * @return CI_Email */ public function cc($cc) { @@ -614,7 +614,7 @@ class CI_Email { * * @param string * @param string - * @return object + * @return CI_Email */ public function bcc($bcc, $limit = '') { @@ -649,7 +649,7 @@ class CI_Email { * Set Email Subject * * @param string - * @return object + * @return CI_Email */ public function subject($subject) { @@ -664,7 +664,7 @@ class CI_Email { * Set Body * * @param string - * @return object + * @return CI_Email */ public function message($body) { @@ -693,7 +693,7 @@ class CI_Email { * @param string $disposition = 'attachment' * @param string $newname = NULL * @param string $mime = '' - * @return object + * @return CI_Email */ public function attach($filename, $disposition = '', $newname = NULL, $mime = '') { @@ -746,7 +746,7 @@ class CI_Email { * Set Multipart Value * * @param string - * @return object + * @return CI_Email */ public function set_alt_message($str = '') { @@ -760,7 +760,7 @@ class CI_Email { * Set Mailtype * * @param string - * @return object + * @return CI_Email */ public function set_mailtype($type = 'text') { @@ -774,7 +774,7 @@ class CI_Email { * Set Wordwrap * * @param bool - * @return object + * @return CI_Email */ public function set_wordwrap($wordwrap = TRUE) { @@ -788,7 +788,7 @@ class CI_Email { * Set Protocol * * @param string - * @return object + * @return CI_Email */ public function set_protocol($protocol = 'mail') { @@ -802,7 +802,7 @@ class CI_Email { * Set Priority * * @param int - * @return object + * @return CI_Email */ public function set_priority($n = 3) { @@ -816,7 +816,7 @@ class CI_Email { * Set Newline Character * * @param string - * @return object + * @return CI_Email */ public function set_newline($newline = "\n") { @@ -830,7 +830,7 @@ class CI_Email { * Set CRLF * * @param string - * @return object + * @return CI_Email */ public function set_crlf($crlf = "\n") { diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index cdb0a6452..e54ce4950 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -122,7 +122,7 @@ class CI_Encrypt { * Set the encryption key * * @param string - * @return object + * @return CI_Encrypt */ public function set_key($key = '') { @@ -419,7 +419,7 @@ class CI_Encrypt { * Set the Mcrypt Cipher * * @param int - * @return object + * @return CI_Encrypt */ public function set_cipher($cipher) { @@ -433,7 +433,7 @@ class CI_Encrypt { * Set the Mcrypt Mode * * @param int - * @return object + * @return CI_Encrypt */ public function set_mode($mode) { diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index e4eac04ba..32f7da1b1 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -149,7 +149,7 @@ class CI_Form_validation { * @param mixed $field * @param string $label * @param mixed $rules - * @return object + * @return CI_Form_validation */ public function set_rules($field, $label = '', $rules = '') { @@ -266,7 +266,7 @@ class CI_Form_validation { * * @param array * @param string - * @return object + * @return CI_Form_validation */ public function set_message($lang, $val = '') { @@ -288,7 +288,7 @@ class CI_Form_validation { * * @param string * @param string - * @return object + * @return CI_Form_validation */ public function set_error_delimiters($prefix = '<p>', $suffix = '</p>') { @@ -609,13 +609,15 @@ class CI_Form_validation { { $line = $this->_error_messages[$type]; } - elseif (FALSE === ($line = $this->CI->lang->line($type))) + elseif (FALSE === ($line = $this->CI->lang->line('form_validation_'.$type)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($type, FALSE))) { $line = 'The field was not set'; } // Build the error message - $message = sprintf($line, $this->_translate_fieldname($row['label'])); + $message = $this->_build_error_msg($line, $this->_translate_fieldname($row['label'])); // Save the error message $this->_field_data[$row['field']]['error'] = $message; @@ -749,7 +751,9 @@ class CI_Form_validation { { if ( ! isset($this->_error_messages[$rule])) { - if (FALSE === ($line = $this->CI->lang->line($rule))) + if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($rule, FALSE))) { $line = 'Unable to access an error message corresponding to your field name.'; } @@ -767,7 +771,7 @@ class CI_Form_validation { } // Build the error message - $message = sprintf($line, $this->_translate_fieldname($row['label']), $param); + $message = $this->_build_error_msg($line, $this->_translate_fieldname($row['label']), $param); // Save the error message $this->_field_data[$row['field']]['error'] = $message; @@ -797,7 +801,9 @@ class CI_Form_validation { if (sscanf($fieldname, 'lang:%s', $line) === 1) { // Were we able to translate the field name? If not we use $line - if (FALSE === ($fieldname = $this->CI->lang->line($line))) + if (FALSE === ($fieldname = $this->CI->lang->line('form_validation_'.$line)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE))) { return $line; } @@ -809,6 +815,27 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** + * Build an error message using the field and param. + * + * @param string The error message line + * @param string A field's human name + * @param mixed A rule's optional parameter + * @return string + */ + protected function _build_error_msg($line, $field = '', $param = '') + { + // Check for %s in the string for legacy support. + if (strpos($line, '%s') !== FALSE) + { + return sprintf($line, $field, $param); + } + + return str_replace(array('{field}', '{param}'), array($field, $param), $line); + } + + // -------------------------------------------------------------------- + + /** * Get the value from a form * * Permits you to repopulate a form field with the value it was submitted diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php index 6d926ae3d..9392a4dbe 100644 --- a/system/libraries/Session/drivers/Session_cookie.php +++ b/system/libraries/Session/drivers/Session_cookie.php @@ -457,7 +457,7 @@ class CI_Session_cookie extends CI_Session_driver { } // No result? Kill it! - if ($query->num_rows() === 0) + if (empty($query) OR $query->num_rows() === 0) { $this->sess_destroy(); return FALSE; diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 9ecd0de9f..740e99c72 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -133,7 +133,7 @@ class CI_Zip { protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = file_exists($dir) ? filemtime($dir) : getdate($this->now); + $date = file_exists($dir) ? @filemtime($dir) : getdate($this->now); return array( 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, @@ -438,7 +438,7 @@ class CI_Zip { * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * - * @return object + * @return CI_Zip */ public function clear_data() { |