protected function afterRender($view, &$output) { $this->onAfterRender(new CEvent($this)); parent::afterRender($view, $output); if (Yii::app()->facebook->jsSdk) { // if we have disabled this (like on the Facebook Page view), do none of it Yii::app()->facebook->ogTags['site_name'] = CHtml::encode(Yii::app()->name); if ($this->ogImage) { Yii::app()->facebook->ogTags['image'] = $this->ogImage; } else { Yii::app()->facebook->ogTags['image'] = Yii::app()->params->siteUrl . 'img/logo-dark.jpg'; } if ($this->pageTitle) { Yii::app()->facebook->ogTags['title'] = $this->pageTitle; } if ($this->metaDesc) { Yii::app()->facebook->ogTags['description'] = $this->metaDesc; } else { Yii::app()->facebook->ogTags['description'] = "Small Potatoes is an online garden surplus for the neighborhood. Anyone who loves locally grown produce can connect with their neighborhood gardeners, purchase their excess harvest, and support their hyper-local food community."; } Yii::app()->facebook->renderOGMetaTags(); $js = "\n \$('#fb-login-button').on('click',function(){\n FB.login(function(response) {\n if (response.authResponse) {\n window.location = '" . $this->createUrl('user/register') . "';\n }\n }, {scope: 'email,user_location'});\n return false;\n });\n\n "; if (Yii::app()->facebook->getUser()) { $js .= "\n FB.getLoginStatus(function(response) {\n if (response.status == 'connected') { // only bind this to the logout button if the user is logged in to FB\n \$('#logout').click(function (e) {\n FB.getLoginStatus(function(response) { // only do this if the user is logged in with Facebook\n if (response.authResponse) {\n if(!e) var e = window.event;\n FB.logout(function(response) { // when logout is complete, redirect to logout from SplashLab as well\n window.location = '" . $this->createUrl('site/logout') . "';\n });\n }\n });\n return false;\n });\n }\n });\n "; } Yii::app()->facebook->addJsCallback($js); Yii::app()->facebook->initJs($output); // this initializes the JS Yii::app()->clientScript->registerScript("ga", "var _gaq = _gaq || [];\n _gaq.push(['_setAccount', 'UA-34947582-1']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();", CClientScript::POS_END); } return true; }
protected function afterRender($view, &$output) { parent::afterRender($view, $output); //Yii::app()->facebook->addJsCallback($js); // use this if you are registering any $js code you want to run asyc //***************before using FB own sdk************ // Yii::app()->facebook->initJs($output); // this initializes the Facebook JS SDK on all pages // Yii::app()->facebook->renderOGMetaTags(); // this renders the OG tags return true; }
/** * @param string $view * @param string $output */ protected function afterRender($view, &$output) { parent::afterRender($view, $output); if ($this->enableFacebook && \Yii::app()->hasComponent('facebook')) { // Activation des SDK pour l'extension yii-facebook-opengraph // @internal cf. composant 'facebook' dans la configuration \Yii::app()->facebook->initJs($output); // this initializes the Facebook JS SDK on all pages /** @noinspection PhpUndefinedFieldInspection */ \Yii::app()->facebook->renderOGMetaTags(); // this renders the OG tags } }
protected function afterRender($view, &$output) { parent::afterRender($view, $output); //Yii::app()->facebook->addJsCallback($js); // use this if you are registering any $js code you want to run asyc if (_xls_facebook_login()) { Yii::app()->facebook->initJs($output); // this initializes the Facebook JS SDK on all pages } return true; }
/** * This method is invoked after the specified is rendered by calling {@link CController::render()}. * Note that this method is invoked BEFORE {@link CController::processOutput()}. * You may override this method to do some postprocessing for the view rendering. * @param string $view the view that has been rendered * @param string $output the rendering result of the view. Note that this parameter is passed * as a reference. That means you can modify it within this method. */ protected function afterRender($view, &$output) { SourceBans::app()->trigger('app.afterRender', new CEvent($this, array('view' => $view, 'output' => &$output))); parent::afterRender($view, $output); }
protected function afterRender($view, &$output) { parent::afterRender($view, $output); return true; }