Exemplo n.º 1
0
 /**
  * Render the tag
  *
  * @param   array   $attribs Associative array of attributes
  * @param   string  $content The tag content
  * @return string
  */
 protected function _renderTag($attribs = array(), $content = null)
 {
     if ($this->getTemplate()->getParameters()->layout !== 'koowa') {
         $link = isset($attribs['src']) ? $attribs['src'] : false;
         $condition = isset($attribs['condition']) ? $attribs['condition'] : false;
         if (!$link) {
             $hash = md5($content . serialize($attribs));
             if (!isset($this->_loaded[$hash])) {
                 JFactory::getDocument()->addStyleDeclaration($content);
                 $this->_loaded[$hash] = true;
             }
         } else {
             if ($condition) {
                 $style = parent::_renderTag($attribs, $content);
                 JFactory::getDocument()->addCustomTag($style);
             } else {
                 unset($attribs['src']);
                 unset($attribs['condition']);
                 JFactory::getDocument()->addStyleSheet($link, 'text/css', null, $attribs);
             }
         }
     } else {
         return parent::_renderTag($attribs, $content);
     }
 }
Exemplo n.º 2
0
 /**
  * Render style information
  * 
  * @param string    The style information
  * @param boolean   True, if the style information is a URL
  * @param array     Associative array of attributes
  * @return string
  */
 protected function _renderStyle($style, $link, $attribs = array())
 {
     if (KRequest::type() == 'AJAX') {
         return parent::_renderStyle($style, $link, $attribs);
     }
     $document = KFactory::get('lib.joomla.document');
     if ($link) {
         $document->addStyleSheet($style, 'text/css', null, $attribs);
     } else {
         $document->addStyleDeclaration($style);
     }
 }