Skip to content

Commit

Permalink
Fix: #60
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Nieuwoudt committed Aug 6, 2015
1 parent a83cc18 commit d6be218
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
36 changes: 6 additions & 30 deletions gump.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,25 +473,13 @@ public function get_readable_errors($convert_to_string = false, $field_class = '
$resp[] = "The <span class=\"$field_class\">$field</span> field is required to be a valid email address";
break;
case 'validate_max_len':
if ($param == 1) {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be shorter than $param character";
} else {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be shorter than $param characters";
}
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be $param or shorter in length";
break;
case 'validate_min_len':
if ($param == 1) {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be longer than $param character";
} else {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be longer than $param characters";
}
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be $param or longer in length";
break;
case 'validate_exact_len':
if ($param == 1) {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be exactly $param character in length";
} else {
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be exactly $param characters in length";
}
$resp[] = "The <span class=\"$field_class\">$field</span> field needs to be exactly $param characters in length";
break;
case 'validate_alpha':
$resp[] = "The <span class=\"$field_class\">$field</span> field may only contain alpha characters(a-z)";
Expand Down Expand Up @@ -617,25 +605,13 @@ public function get_errors_array($convert_to_string = null)
$resp[$field] = "The $field field is required to be a valid email address";
break;
case 'validate_max_len':
if ($param == 1) {
$resp[$field] = "The $field field needs to be shorter than $param character";
} else {
$resp[$field] = "The $field field needs to be shorter than $param characters";
}
$resp[$field] = "The $field field needs to be $param or shorter in length";
break;
case 'validate_min_len':
if ($param == 1) {
$resp[$field] = "The $field field needs to be longer than $param character";
} else {
$resp[$field] = "The $field field needs to be longer than $param characters";
}
$resp[$field] = "The $field field needs to be $param or longer in length";
break;
case 'validate_exact_len':
if ($param == 1) {
$resp[$field] = "The $field field needs to be exactly $param character in length";
} else {
$resp[$field] = "The $field field needs to be exactly $param characters in length";
}
$resp[$field] = "The $field field needs to be exactly $param characters in length";
break;
case 'validate_alpha':
$resp[$field] = "The $field field may only contain alpha characters(a-z)";
Expand Down
8 changes: 4 additions & 4 deletions tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'alpha' => 'alpha',
'alpha_numeric' => 'alpha_numeric',
'alpha_dash' => 'alpha_dash',
'alpha_space' => 'alpha_space',
'alpha_space' => 'alpha_space',
'numeric' => 'numeric',
'integer' => 'integer',
'boolean' => 'boolean',
Expand All @@ -40,7 +40,7 @@
'alpha' => "*(^*^*&",
'alpha_numeric' => "abcdefg12345+\r\n\r\n\r\n",
'alpha_dash' => "ab<script>alert(1);</script>cdefg12345-_+",
'alpha_space' => 'abcdefg12345_$^%%&TGY',
'alpha_space' => 'abcdefg12345_$^%%&TGY',
'numeric' => "one, two\r\n",
'integer' => "1,003\r\n\r\n\r\n\r\n",
'boolean' => "this is not a boolean\r\n\r\n\r\n\r\n",
Expand Down Expand Up @@ -68,8 +68,8 @@
'integer' => 3,
'boolean' => FALSE,
'float' => 10.10,
'valid_url' => 'http://wixel.net',
'url_exists' => 'http://wixel.net',
'valid_url' => 'https://wixelhq.com',
'url_exists' => 'https://wixelhq.com',
'valid_ip' => '69.163.138.23',
'valid_ipv4' => "255.255.255.255",
'valid_ipv6' => "2001:0db8:85a3:08d3:1319:8a2e:0370:7334",
Expand Down

0 comments on commit d6be218

Please sign in to comment.