summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-12-14 10:07:13 +0100
committerAndrey Andreev <narf@bofh.bg>2012-12-14 10:07:13 +0100
commitd4eec9f3638cc31dc8965f929b74a2b3b201b8b7 (patch)
treeaf47abe9c0e35731a2e6260b92a97e47cf6dabdc /system/libraries
parent749f2503dc055fa7e1f376af6435f500eb5db0e1 (diff)
Fix issue #539
Form validation language line keys were not prefixed. They are now prefixed with 'form_validation_' in order to avoid collisions. The old keys will still work if a prefixed match is not found, but are DEPRECATED and will be removed in the next major version. Also added upgrade notes and changelog entries for the new error message format from PR #961.
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Form_validation.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index ecd5b18df..68534251b 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -609,7 +609,9 @@ 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';
}
@@ -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.';
}
@@ -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;
}
@@ -807,7 +813,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Build an error message using the field and param.
*