コード例 #1
0
ファイル: CdnFacade.php プロジェクト: codenut/cdn
 /**
  * check if package is surpassed or not then
  * prepare the path before generating the url.
  *
  * @param        $path
  * @param string $prepend
  *
  * @return mixed
  */
 private function generateUrl($path, $prepend = '')
 {
     // if the package is surpassed, then return the same $path
     // to load the asset from the localhost
     if (isset($this->configurations['bypass']) && $this->configurations['bypass']) {
         return Request::root() . '/' . $path;
     }
     if (!isset($path)) {
         throw new EmptyPathException('Path does not exist.');
     }
     // Add version number
     //$path = str_replace(
     //    "build",
     //    $this->configurations['providers']['aws']['s3']['version'],
     //    $path
     //);
     // remove slashes from begging and ending of the path
     // and append directories if needed
     $clean_path = $prepend . $this->helper->cleanPath($path);
     // call the provider specific url generator
     return $this->provider->urlGenerator($clean_path);
 }