/**
  * 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) {
             $script = trim($content);
             $hash = md5($script . serialize($attribs));
             if (!isset($this->_loaded[$hash])) {
                 JFactory::getDocument()->addScriptDeclaration($script);
                 $this->_loaded[$hash] = true;
             }
         } else {
             if ($condition) {
                 $script = parent::_renderTag($attribs, $content);
                 JFactory::getDocument()->addCustomTag($script);
             } else {
                 unset($attribs['src']);
                 unset($attribs['condition']);
                 JFactory::getDocument()->addScript($link, 'text/javascript');
             }
         }
     } else {
         return parent::_renderTag($attribs, $content);
     }
 }
Exemple #2
0
 /**
  * Render script information
  * 
  * @param string    The script information
  * @param boolean   True, if the script information is a URL.
  * @param array     Associative array of attributes
  * @return string   
  */
 protected function _renderScript($script, $link, $attribs = array())
 {
     if (KRequest::type() == 'AJAX') {
         return parent::_renderScript($script, $link, $attribs);
     }
     $document = JFactory::getDocument();
     if ($link) {
         $document->addScript($script, 'text/javascript');
     } else {
         $document->addScriptDeclaration($script);
     }
 }