/**
  * Parses an item in the files array and returns it's path relative to the assets directory
  * 
  * @param  string $path The path to a file either relative to the assets directory or the custom path.
  * @param  string $type either AssetManager::CSS or AssetManager::JAVASCRIPT
  * @return string       the url path of the asset.
  */
 protected function parseFileConfig($path, $type)
 {
     $config = $this->config;
     if (is_array($path)) {
         $path = $path[0];
     }
     $pos = strpos($path, '::');
     if ($pos !== false) {
         foreach ($config['paths'] as $key => $location) {
             if (substr($path, 0, $pos) == $key) {
                 if (is_array($location)) {
                     $type = Arr::get($location, $type . '_dir', $type . '/');
                     $location = $location['path'];
                 }
                 if ($type and substr($type, -1) != '/') {
                     $type .= '/';
                 }
                 // a little something for google web fonts
                 if (substr($path, $pos + 2, 1) == '?') {
                     $type = rtrim($type, '/');
                 }
                 $path = $location . $type . substr($path, $pos + 2);
                 break;
             }
         }
     } else {
         $path = $this->assetUrl() . '/' . $type . '/' . $path;
     }
     return $path;
 }
示例#2
0
 public function get_data($key = null, $default = null)
 {
     return \FuelPHP\Common\Arr::get($this->data, $key, $default);
 }