From 9f9af60e2d852177403a941ad876718161ba1375 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 10 Nov 2010 15:41:51 -0600 Subject: Altered Form_Validation library to allow for method chaining on set_rules(), set_message() and set_error_delimiters() functions. --- system/libraries/Form_validation.php | 12 +++++++++--- user_guide/changelog.html | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index d62071b79..bf3689058 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -77,7 +77,7 @@ class CI_Form_validation { // No reason to set rules if we have no POST data if (count($_POST) == 0) { - return; + return $this; } // If an array was passed via the first parameter instead of indidual string @@ -98,13 +98,13 @@ class CI_Form_validation { // Here we go! $this->set_rules($row['field'], $label, $row['rules']); } - return; + return $this; } // No fields? Nothing to do... if ( ! is_string($field) OR ! is_string($rules) OR $field == '') { - return; + return $this; } // If the field label wasn't passed we use the field name @@ -146,6 +146,8 @@ class CI_Form_validation { 'postdata' => NULL, 'error' => '' ); + + return $this; } // -------------------------------------------------------------------- @@ -169,6 +171,8 @@ class CI_Form_validation { } $this->_error_messages = array_merge($this->_error_messages, $lang); + + return $this; } // -------------------------------------------------------------------- @@ -187,6 +191,8 @@ class CI_Form_validation { { $this->_error_prefix = $prefix; $this->_error_suffix = $suffix; + + return $this; } // -------------------------------------------------------------------- diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 4b6078a5a..fbfab43aa 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -106,6 +106,7 @@ Hg Tag:

  • Changed the default encryption mode in the Encryption library to CBC.
  • Added an encode_from_legacy() method to provide a way to transition encrypted data from CodeIgniter 1.x to CodeIgniter 2.x. Please see the upgrade instructions for details.
  • +
  • Altered Form_Validation library to allow for method chaining on set_rules(), set_message() and set_error_delimiters() functions.
  • Database -- cgit v1.2.3-24-g4f1b