Skip to content

Instantly share code, notes, and snippets.

@Gillingham
Created October 26, 2011 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gillingham/1316978 to your computer and use it in GitHub Desktop.
Save Gillingham/1316978 to your computer and use it in GitHub Desktop.
vanilla use static CDN
--- functions.general.php.bak 2011-10-26 09:29:58.500837342 -0700
+++ functions.general.php 2011-10-26 09:51:18.896882681 -0700
@@ -332,9 +332,14 @@
if (substr($Destination, 0, 7) == 'http://' || substr($Destination, 0, 8) == 'https://') {
$Result = $Destination;
} else {
- $Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
- if (!$WithDomain)
- array_unshift($Parts, '/');
+ $cdn = Gdn::Config('Garden.CDN', NULL);
+ if(!is_null($cdn))
+ $Parts = array($cdn, $Destination);
+ else {
+ $Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
+ if (!$WithDomain)
+ array_unshift($Parts, '/');
+ }
$Result = CombinePaths($Parts, '/');
}
@@ -2095,9 +2100,14 @@
if (substr($Destination, 0, 7) == 'http://' || substr($Destination, 0, 8) == 'https://') {
$Result = $Destination;
} else {
- $Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
- if (!$WithDomain)
- array_unshift($Parts, '/');
+ $cdn = Gdn::Config('Garden.CDN', NULL);
+ if(!is_null($cdn))
+ $Parts = array($cdn, $Destination);
+ else {
+ $Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
+ if (!$WithDomain)
+ array_unshift($Parts, '/');
+ }
$Result = CombinePaths($Parts, '/');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment