protected function _renderScript($script, $link, $attribs = array())
    {
        if ($link) {
            $script = pick($this->getService('com:base.template.asset')->getURL($script), $script);
        }

        //if ajax try to get the content of the file
        if (AnRequest::type() == 'AJAX') {
            if ($link) {
                $file = $this->getService('com:base.template.asset')->getFilePath($script);
                if ($file) {
                    $script = file_get_contents($file);
                    $link = false;
                }
            }

            return parent::_renderScript($script, $link, $attribs);
        }

        $document = AnService::get('anahita:document');

        if($link) {
            return $document->addScript($script, 'text/javascript');
        } else {
            return $document->addScriptDeclaration($script);
        }
    }
protected function _renderScript($script, $link, $attribs = array())
    {
        if ($link) {
            $script = pick($this->getService('com:base.template.asset')->getURL($script), $script);
        }

        //if ajax try to get the content of the file
        if (AnRequest::type() == 'AJAX') {
            if ($link) {
                $file = $this->getService('com:base.template.asset')->getFilePath($script);
                if ($file) {
                    $script = file_get_contents($file);
                    $link = false;
                }
            }

            return parent::_renderScript($script, $link, $attribs);
        }

        $document = AnService::get('anahita:document');

        if($link) {
            return $document->addScript($script, 'text/javascript');
        } else {
            return $document->addScriptDeclaration($script);
        }
    }
protected function _renderScript ( $ script , $ link , $ attribs = array ( ) ) { if ( $ link ) { $ script = pick ( $ this -> getService ( 'com:base.template.asset' ) -> getURL ( $ script ) , $ script ) ; } //if ajax try to get the content of the file if ( AnRequest :: type ( ) == 'AJAX' ) { if ( $ link ) { $ file = $ this -> getService ( 'com:base.template.asset' ) -> getFilePath ( $ script ) ; if ( $ file ) { $ script = file_get_contents ( $ file ) ; $ link = false ; } } return parent :: _renderScript ( $ script , $ link , $ attribs ) ; } $ document = AnService :: get ( 'anahita:document' ) ; if ( $ link ) { return $ document -> addScript ( $ script , 'text/javascript' ) ; } else { return $ document -> addScriptDeclaration ( $ script ) ; } }
Render script information.

@param string    The script information
@param bool   True, if the script information is a URL.
@param array     Associative array of attributes

@return string
Render script information .