Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
/**
 * Returns a "<link>" HTML element.
 */
function html_link($url, $attrs = array())
{
    return \Phpf\Util\Html::link($url, $attrs);
}