function onExtra($name) { $output = NULL; if ($name == "footer") { $serverName = $this->yellow->config->get("piwikServerName"); $siteId = $this->yellow->config->get("piwikSiteId"); $output = "<script type=\"text/javascript\">\n"; $output .= "var _paq = _paq || [];\n"; $output .= "(function(){ var u=((\"https:\"==document.location.protocol) ? \"https\" : \"http\") + \"://" . strencode($serverName) . "/\";\n"; $output .= "_paq.push(['setSiteId', '" . strencode($siteId) . "']);\n"; $output .= "_paq.push(['setTrackerUrl', u+'piwik.php']);\n"; $output .= "_paq.push(['trackPageView']);\n"; $output .= "_paq.push(['enableLinkTracking']);\n"; $output .= "var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';\n"; $output .= "s.parentNode.insertBefore(g,s); })();\n"; $output .= "</script>\n"; } return $output; }
function onExtra($name) { $output = null; if ($name == "disqus" || $name == "comments") { $shortname = $this->yellow->config->get("disqusShortname"); $url = $this->yellow->page->get("pageRead"); $output = "<div id=\"disqus_thread\"></div>\n"; $output .= "<script type=\"text/javascript\">\n"; $output .= "var disqus_shortname = '" . strencode($shortname) . "';\n"; $output .= "var disqus_url = '" . strencode($url) . "';\n"; $output .= "(function() {\n"; $output .= "var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n"; $output .= "dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n"; $output .= "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n"; $output .= "})();\n"; $output .= "</script>\n"; $output .= "<noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n"; } return $output; }