예제 #1
0
 /**
  * Add version to js/css files
  *
  * @param string $file
  * @param array $params
  * @return string
  */
 public function getSkinUrl($file = null, array $params = array())
 {
     $result = parent::getSkinUrl($file, $params);
     if ($this->addTstampToAssetsCss) {
         $matches = array();
         if (preg_match('/(.*)\\.(css)$/i', $result, $matches)) {
             $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2];
         }
         if ($this->cssProtocolRelativeUris) {
             $result = $this->convertToProtocolRelativeUri($result);
         }
     }
     if ($this->addTstampToAssetsJs) {
         $matches = array();
         if (preg_match('/(.*)\\.(js)$/i', $result, $matches)) {
             $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2];
         }
         if ($this->jsProtocolRelativeUris) {
             $result = $this->convertToProtocolRelativeUri($result);
         }
     }
     if ($this->addTstampToAssets) {
         $matches = array();
         if (preg_match('/(.*)\\.(gif|png|jpg)$/i', $result, $matches)) {
             $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2];
         }
         if ($this->cssProtocolRelativeUris) {
             $result = $this->convertToProtocolRelativeUri($result);
         }
     }
     return $result;
 }
예제 #2
0
 /**
  * Add version to js/css files
  *
  * @param string $file
  * @param array $params
  * @return string
  */
 public function getSkinUrl($file = null, array $params = array())
 {
     $result = parent::getSkinUrl($file, $params);
     if ($this->addTstampToAssetsCss) {
         $matches = array();
         if (preg_match('/(.*)\\.(css)$/i', $result, $matches)) {
             $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2];
         }
     } elseif ($this->addTstampToAssetsJs) {
         $matches = array();
         if (preg_match('/(.*)\\.(js)$/i', $result, $matches)) {
             $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2];
         }
     }
     return $result;
 }