示例#1
0
 /**
  * Returns url of aggregated file
  *
  * @param string $sFile		Aggregated file name
  * @param string $sType		css or js
  * @param mixed $bGz		True (or 1) if gzip set and enabled
  * @param number $sTime		Expire header time
  * @return string			Url of aggregated file
  */
 protected function buildUrl($sId, $sType, $iTime, $bGz = false)
 {
     $oUri = clone JUri::getInstance(JUri::base());
     $sJbase = JUri::base(true);
     $sPath = $sJbase . '/plugins/system/jch_optimize/assets';
     $sBaseFolder = $sJbase == '/' ? $sJbase : $sJbase . '/';
     $iUrlRewriteMode = $this->params->get('htaccess', 2);
     if ($iUrlRewriteMode == 1 || JchOptimizeHelper::modRewriteEnabled() && $iUrlRewriteMode != 0) {
         $sUrl = $sPath . $sBaseFolder . ($bGz ? 'gz/' : 'nz/') . $iTime . '/' . $sId . '.' . $sType;
     } else {
         $oUri->setPath($sPath . '2/jscss.php');
         $aVar = array();
         $aVar['f'] = $sId;
         $aVar['type'] = $sType;
         if ($bGz) {
             $aVar['gz'] = 'gz';
         }
         $aVar['d'] = $iTime;
         $oUri->setQuery($aVar);
         $sUrl = htmlentities($oUri->toString(array('path', 'query')));
     }
     return $sUrl;
 }