Ejemplo n.º 1
0
 /**
  * Check if a style was added before calling JDocument.
  *
  * Note that for links the check is already done in JDocument so no need to repeat here.
  *
  * @see ComDefaultTemplateFilterStyle::_renderStyle()
  */
 protected function _renderStyle($style, $link, $attribs = array())
 {
     if (!$link) {
         $hash = md5($style . serialize($attribs));
         if (isset($this->_loaded[$hash])) {
             return;
         }
     }
     parent::_renderStyle($style, $link, $attribs);
     if (!$link) {
         $this->_loaded[$hash] = true;
     }
 }
Ejemplo n.º 2
0
 /**
  * Render style information.
  * 
  * @param string    The style information
  * @param bool   True, if the style information is a URL
  * @param array     Associative array of attributes
  *
  * @return string
  */
 protected function _renderStyle($style, $link, $attribs = array())
 {
     //get the correct URL
     if ($link) {
         $style = pick($this->getService('com://site/base.template.asset')->getURL($style), $style);
     }
     //if ajax try to get the content of the file
     if (KRequest::type() == 'AJAX') {
         if ($link) {
             $file = $this->getService('com://site/base.template.asset')->getFilePath($style);
             if ($file) {
                 $style = file_get_contents($file);
                 $link = false;
             }
         }
     }
     return parent::_renderStyle($style, $link, $attribs);
 }