From 53e8f9b77469025e74910823265cede331d32ed6 Mon Sep 17 00:00:00 2001 From: Keith Loy Date: Mon, 9 Apr 2012 21:11:54 -0500 Subject: [PATCH] Fixing bug where custom validation messages in bundle language files were not getting picked up. --- laravel/validator.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/laravel/validator.php b/laravel/validator.php index b238ce13..b18bf512 100644 --- a/laravel/validator.php +++ b/laravel/validator.php @@ -559,7 +559,7 @@ protected function validate_url($attribute, $value) protected function validate_active_url($attribute, $value) { $url = str_replace(array('http://', 'https://', 'ftp://'), '', Str::lower($value)); - + return checkdnsrr($url); } @@ -608,7 +608,7 @@ protected function validate_alpha_num($attribute, $value) */ protected function validate_alpha_dash($attribute, $value) { - return preg_match('/^([-a-z0-9_-])+$/i', $value); + return preg_match('/^([-a-z0-9_-])+$/i', $value); } /** @@ -657,7 +657,7 @@ protected function validate_mimes($attribute, $value, $parameters) protected function validate_before($attribute, $value, $parameters) { return (strtotime($value) < strtotime($parameters[0])); - } + } /** * Validate the date is after a given date. @@ -670,7 +670,7 @@ protected function validate_before($attribute, $value, $parameters) protected function validate_after($attribute, $value, $parameters) { return (strtotime($value) > strtotime($parameters[0])); - } + } /** * Get the proper error message for an attribute and rule. @@ -692,7 +692,7 @@ protected function message($attribute, $rule) { return $this->messages[$custom]; } - elseif (Lang::has($custom = "validation.custom.{$custom}", $this->language)) + elseif (Lang::has($custom = "{$bundle}validation.custom.{$custom}", $this->language)) { return Lang::line($custom)->get($this->language); } @@ -753,7 +753,7 @@ protected function size_message($bundle, $attribute, $rule) $line = 'string'; } - return Lang::line("{$bundle}validation.{$rule}.{$line}")->get($this->language); + return Lang::line("{$bundle}validation.{$rule}.{$line}")->get($this->language); } /** @@ -929,7 +929,7 @@ protected function replace_before($message, $attribute, $rule, $parameters) protected function replace_after($message, $attribute, $rule, $parameters) { return str_replace(':date', $parameters[0], $message); - } + } /** * Get the displayable name for a given attribute. @@ -988,7 +988,7 @@ protected function parse($rule) { $parameters = array(); - // The format for specifying validation rules and parameters follows a + // The format for specifying validation rules and parameters follows a // {rule}:{parameters} formatting convention. For instance, the rule // "max:3" specifies that the value may only be 3 characters long. if (($colon = strpos($rule, ':')) !== false)