Allow the specification of a asset base URL.
This commit is contained in:
parent
48dae0c3d9
commit
efe3de6843
|
@ -20,10 +20,9 @@
|
||||||
| Asset URL
|
| Asset URL
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| The base URL used for your application's asset files, if you are serving
|
| The base URL used for your application's asset files. This is useful if
|
||||||
| them through a different server or a content delivery network, for
|
| you are serving your assets through a different server or a CDN. If it
|
||||||
| example. If it's not set, we'll default to the application URL (above).
|
| is not set, we'll default to the application URL above.
|
||||||
| Leave off the trailing slash.
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ ## Laravel 3.2
|
||||||
- Added support for `HAVING` SQL clauses.
|
- Added support for `HAVING` SQL clauses.
|
||||||
- Added `array_pluck` helper, similar to pluck method in Underscore.js.
|
- Added `array_pluck` helper, similar to pluck method in Underscore.js.
|
||||||
- Allow the registration of custom cache and session drivers.
|
- Allow the registration of custom cache and session drivers.
|
||||||
|
- Allow the specification of a separate asset base URL for using CDNs.
|
||||||
|
|
||||||
<a name="upgrade-3.2"></a>
|
<a name="upgrade-3.2"></a>
|
||||||
## Upgrading From 3.1
|
## Upgrading From 3.1
|
||||||
|
|
|
@ -220,16 +220,14 @@ protected static function convention($action, $parameters)
|
||||||
*/
|
*/
|
||||||
public static function to_asset($url, $https = null)
|
public static function to_asset($url, $https = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// If the URL is already well-formed, just return it
|
|
||||||
if (static::valid($url)) return $url;
|
if (static::valid($url)) return $url;
|
||||||
|
|
||||||
// If a base asset URL is defined in the configuration, use that and
|
// If a base asset URL is defined in the configuration, use that and don't
|
||||||
// don't try and change links to http/https.
|
// try and change the HTTP protocol. This allows the delivery of assets
|
||||||
if ($root = Config::get('application.asset_url', false )) {
|
// through a different server or third-party content delivery network.
|
||||||
|
if ($root = Config::get('application.asset_url', false))
|
||||||
|
{
|
||||||
return rtrim($root, '/').'/'.ltrim($url, '/');
|
return rtrim($root, '/').'/'.ltrim($url, '/');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($https)) $https = Request::secure();
|
if (is_null($https)) $https = Request::secure();
|
||||||
|
|
Loading…
Reference in New Issue