cleaning up code before release.
This commit is contained in:
parent
bb0967cceb
commit
0e4f726874
|
@ -2,18 +2,6 @@
|
||||||
|
|
||||||
class Hash {
|
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.
|
* 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);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -183,20 +183,35 @@ public static function load($bundle, $language, $file)
|
||||||
|
|
||||||
// Language files can belongs to the application or to any bundle
|
// Language files can belongs to the application or to any bundle
|
||||||
// that is installed for the application. So, we'll need to use
|
// that is installed for the application. So, we'll need to use
|
||||||
// the bundle's path when checking for the file.
|
// the bundle's path when looking for the file.
|
||||||
//
|
$path = static::path($bundle, $language, $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;
|
|
||||||
|
|
||||||
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;
|
static::$lines[$bundle][$language][$file] = $lines;
|
||||||
|
|
||||||
return count($lines) > 0;
|
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.
|
* Get the string content of the language line.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue