コード例 #1
0
ファイル: Assets.php プロジェクト: jivoo/jivoo
 /**
  * Get an asset url.
  * @param string $key Path key.
  * @param string $path Path.
  * @return string Asset url.
  */
 private function getAssetUrl($key, $path)
 {
     $prefix = array('assets');
     if ($key == 'app') {
         $p = $this->p($key, 'assets/' . $path);
     } else {
         $prefix[] = $this->getAssetKey($key);
         $p = $this->p($key, $path);
     }
     $p = Utilities::convertRealPath($p);
     $suffix = '';
     if ($this->config['mtimeSuffix']) {
         $suffix = '?' . filemtime($p);
     }
     if (strncmp($p, $this->docRoot, $this->docRootLength) == 0) {
         return substr($p, $this->docRootLength) . $suffix;
     } else {
         return $this->m->Routing->getLinkFromPath(array_merge($prefix, explode('/', $path))) . $suffix;
     }
 }