/** * Load javascript library required for google gears * * @param Gpf_Contexts_Module $context */ public function initJsResources(Gpf_Contexts_Module $context) { //install mode will not connect google gears if (Gpf_Paths::getInstance()->isInstallModeActive()) { return; } try { $file = new Gpf_Io_File(Gpf_Paths::getInstance()->getAccountConfigDirectoryPath() . GoogleGears_Definition::getManifestFileName()); if (!$file->isExists()) { $def = new GoogleGears_Definition(); $def->generateManifest(); } $context->addJsResource(Gpf_Paths::getInstance()->getFrameworkPluginsDirectoryUrl() . 'GoogleGears/gears_init.js'); $manifestUrl = Gpf_Paths::getInstance()->getBaseServerUrl() . Gpf_Paths::getInstance()->getAccountDirectoryRelativePath() . Gpf_Paths::CONFIG_DIR . GoogleGears_Definition::getManifestFileName(); $context->addJsScript("try { var localServer = google.gears.factory.create('beta.localserver'); var store = localServer.createManagedStore('GwtPHP'); store.manifestUrl = '$manifestUrl'; store.checkForUpdate(); store.enabled = true; } catch (e) {} "); } catch (Gpf_Exception $e) { } }
/** * Load javascript library required by google maps * * @param Gpf_Contexts_Module $context */ public function initJsResources(Gpf_Contexts_Module $context) { if (($key = $this->getKey()) !== false) { $context->addJsResource( 'https://maps.google.com/maps?gwt=1&file=api&v=2.x&key=' . $key); $context->addJsResource( 'https://www.google.com/jsapi?key=' . $key); } }
/** * @return Gpf_Contexts_Module */ public function getContextInstance() { if (self::$instance == null) { self::$instance = new Gpf_Contexts_Module(); } return self::$instance; }
protected function assignTemplateVariables(Gpf_Templates_Template $template) { $template->assign('title', $this->getTitle()); $template->assign('metaDescription', $this->getMetaDescription()); $template->assign('metaKeywords', $this->getMetaKeywords()); $template->assign('cachedData', Gpf_Rpc_CachedResponse::render()); $template->assign('stylesheets', $this->styleSheets); $template->assign('jsResources', Gpf_Contexts_Module::getContextInstance()->getJsResources()); $template->assign('jsScripts', Gpf_Contexts_Module::getContextInstance()->getJsScripts()); $template->assign('body', $this->body); $template->assign('faviconUrl', $this->getFaviconUrl()); }
public function initJsResource(Gpf_Contexts_Module $module) { $module->addJsResource('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); }