private function _addScripts()
    {
        $api = 'https://www.google.com/recaptcha/api.js';
        $base = AnService::get('com:application')->getRouter()->getBaseUrl();
        $recaptcha = $base.'/media/plg_recaptcha/js/';
        $recaptcha .= ANDEBUG ? 'recaptcha.js' : 'min/recaptcha.min.js';

        $document = AnService::get('anahita:document');
        $jsDeclaration = "
            var recaptcha = null;
            $(document).ready(function(){
                if( $('form.recaptcha').length ) {
                    recaptcha = $('form.recaptcha').recaptcha({
                        siteKey: \"%s\"
                    });
                }
            });
            function recaptchaCallback(token) {
                recaptcha.recaptcha('recaptchaCallback', token)
            }
        ";

        $document->addScriptDeclaration(sprintf($jsDeclaration, $this->_params->get('site-key')));
        $document->addScript($recaptcha);
        $document->addScript($api, 'text/javascript', array('async', 'defer'));
    }
private function _addScripts()
    {
        $api = 'https://www.google.com/recaptcha/api.js';
        $base = AnService::get('com:application')->getRouter()->getBaseUrl();
        $recaptcha = $base.'/media/plg_recaptcha/js/';
        $recaptcha .= ANDEBUG ? 'recaptcha.js' : 'min/recaptcha.min.js';

        $document = AnService::get('anahita:document');
        $jsDeclaration = "
            var recaptcha = null;
            $(document).ready(function(){
                if( $('form.recaptcha').length ) {
                    recaptcha = $('form.recaptcha').recaptcha({
                        siteKey: \"%s\"
                    });
                }
            });
            function recaptchaCallback(token) {
                recaptcha.recaptcha('recaptchaCallback', token)
            }
        ";

        $document->addScriptDeclaration(sprintf($jsDeclaration, $this->_params->get('site-key')));
        $document->addScript($recaptcha);
        $document->addScript($api, 'text/javascript', array('async', 'defer'));
    }
private function _addScripts ( ) { $ api = 'https://www.google.com/recaptcha/api.js' ; $ base = AnService :: get ( 'com:application' ) -> getRouter ( ) -> getBaseUrl ( ) ; $ recaptcha = $ base . '/media/plg_recaptcha/js/' ; $ recaptcha .= ANDEBUG ? 'recaptcha.js' : 'min/recaptcha.min.js' ; $ document = AnService :: get ( 'anahita:document' ) ; $ jsDeclaration = "
            var recaptcha = null;
            $(document).ready(function(){
                if( $('form.recaptcha').length ) {
                    recaptcha = $('form.recaptcha').recaptcha({
                        siteKey: \"%s\"
                    });
                }
            });
            function recaptchaCallback(token) {
                recaptcha.recaptcha('recaptchaCallback', token)
            }
        " ; $ document -> addScriptDeclaration ( sprintf ( $ jsDeclaration , $ this -> _params -> get ( 'site-key' ) ) ) ; $ document -> addScript ( $ recaptcha ) ; $ document -> addScript ( $ api , 'text/javascript' , array ( 'async' , 'defer' ) ) ; }
Adds required javascript code to the header.

@return void
Adds required javascript code to the header .