Merge branch 'develop' into feature/http-foundation

This commit is contained in:
Taylor Otwell
2012-04-02 20:45:24 -05:00
57 changed files with 8732 additions and 3 deletions

View File

@@ -95,7 +95,13 @@ class URL {
*/
public static function to($url = '', $https = false)
{
if (filter_var($url, FILTER_VALIDATE_URL) !== false) return $url;
// If the given URL is already valid or begins with a hash, we'll just return
// the URL unchanged since it is already well formed. Otherwise we will add
// the base URL of the application and return the full URL.
if (static::valid($url) or starts_with($url, '#'))
{
return $url;
}
$root = static::base().'/'.Config::get('application.index');
@@ -288,4 +294,15 @@ class URL {
return trim($uri, '/');
}
/**
* Determine if the given URL is valid.
*
* @param string $url
* @return bool
*/
public static function valid($url)
{
return filter_var($url, FILTER_VALIDATE_URL) !== false;
}
}