public function render($handle) { if ($this->isRendered($handle)) { return ''; } if (!$this->isRegistered($handle)) { trigger_error("Cannot render asset '{$handle}' - not set.", E_USER_NOTICE); return ''; } // get url & attributes list($url, $attrs) = $this->assets[$handle]; $attrs['id'] = $handle; if (0 !== strpos($url, '/') && false === strpos($url, '://')) { $url = \Phpf\Util\Path::url($url); } $html = ''; if (Str::endsWith($url, '.css')) { $html = Html::link($url, $attrs); } elseif (Str::endsWith($url, '.js')) { $html = Html::script($url, $attrs); } $this->rendered[$handle] = $handle; return $html; }
/** * Converts a path to URL */ function path_url($path, $protocol = 'http') { return \Phpf\Util\Path::url($path, $protocol); }