diff --git a/laravel/hash.php b/laravel/hash.php index f45811b6..17e49b06 100644 --- a/laravel/hash.php +++ b/laravel/hash.php @@ -2,18 +2,6 @@ class Hash { - /** - * Determine if an unhashed value matches a given Bcrypt hash. - * - * @param string $value - * @param string $hash - * @return bool - */ - public static function check($value, $hash) - { - return crypt($value, $hash) === $hash; - } - /** * Hash a password using the Bcrypt hashing scheme. * @@ -51,4 +39,16 @@ public static function make($value, $rounds = 8) return crypt($value, '$2a$'.$work.'$'.$salt); } + /** + * Determine if an unhashed value matches a Bcrypt hash. + * + * @param string $value + * @param string $hash + * @return bool + */ + public static function check($value, $hash) + { + return crypt($value, $hash) === $hash; + } + } \ No newline at end of file diff --git a/laravel/lang.php b/laravel/lang.php index 74250bcc..7840dab0 100644 --- a/laravel/lang.php +++ b/laravel/lang.php @@ -183,20 +183,35 @@ public static function load($bundle, $language, $file) // Language files can belongs to the application or to any bundle // that is installed for the application. So, we'll need to use - // the bundle's path when checking for the file. - // - // This is similar to the loading method for configuration files, - // but we do not need to cascade across directories since most - // likely language files are static across environments. - $path = Bundle::path($bundle)."language/{$language}/{$file}".EXT; + // the bundle's path when looking for the file. + $path = static::path($bundle, $language, $file); - if (file_exists($path)) $lines = require $path; + if (file_exists($path)) + { + $lines = require $path; + } + // All of the language lines are cached in an array so we can + // quickly look them up on subsequent reqwuests for the line. + // This keeps us from loading files each time. static::$lines[$bundle][$language][$file] = $lines; return count($lines) > 0; } + /** + * Get the path to a bundle's language file. + * + * @param string $bundle + * @param string $language + * @param string $file + * @return string + */ + protected static function path($bundle, $language, $file) + { + return Bundle::path($bundle)."language/{$language}/{$file}".EXT; + } + /** * Get the string content of the language line. *