code-igniter-v3-giggi: update release v1
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 1bd5549..c068614 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -105,6 +105,27 @@
protected $error_string = '';
/**
+ * Start tag for message wrapping
+ *
+ * @var string
+ */
+ protected $_message_prefix = '<p>';
+
+ /**
+ * End tag for message wrapping
+ *
+ * @var string
+ */
+ protected $_message_suffix = '</p>';
+
+ /**
+ * Custom message
+ *
+ * @var string
+ */
+ protected $message_string = '';
+
+ /**
* Whether the form data has been validated as safe
*
* @var bool
@@ -300,6 +321,24 @@
// --------------------------------------------------------------------
/**
+ * Set Message
+ *
+ * Lets users set their own messages on the fly. Note:
+ * The key name has to match the function name that it corresponds to.
+ *
+ * @param array
+ * @param string
+ * @return CI_Form_validation
+ */
+ public function set_string($msg = '')
+ {
+ $this->message_string = $msg;
+ return $this;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set The Error Delimiter
*
* Permits a prefix/suffix to be added to each error message
@@ -350,6 +389,35 @@
// --------------------------------------------------------------------
/**
+ * Get Message
+ *
+ * Gets the message associated with a particular field
+ *
+ * @param string $field Field name
+ * @param string $prefix HTML start tag
+ * @param string $suffix HTML end tag
+ * @return string
+ */
+ public function message($field, $prefix = '', $suffix = '')
+ {
+ /* No class specific message field */
+
+ if ($prefix === '')
+ {
+ $prefix = $this->_message_prefix;
+ }
+
+ if ($suffix === '')
+ {
+ $suffix = $this->_message_suffix;
+ }
+
+ return $prefix.$this->message_string.$suffix;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Get Array of Error Messages
*
* Returns the error messages as an array