forked from Cavemanon/cavepaintings
Cleaned up code in some of my extensions
Removed function testImage in ext/chatbox/test.php because it no longer applies (there is a cache now)
This commit is contained in:
@@ -11,23 +11,18 @@
|
||||
class google_analytics extends Extension {
|
||||
# Add analytics to config
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
|
||||
$sb = new SetupBlock("Google Analytics");
|
||||
$sb->add_text_option("google_analytics_id", "Analytics ID: ");
|
||||
$sb->add_label("<br>(eg. UA-xxxxxxxx-x)");
|
||||
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
# Load Analytics tracking code on page request
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config;
|
||||
global $page;
|
||||
global $config, $page;
|
||||
|
||||
$google_analytics_id = $config->get_string('google_analytics_id','');
|
||||
if (stristr($google_analytics_id, "UA-"))
|
||||
{
|
||||
if (stristr($google_analytics_id, "UA-")) {
|
||||
$page->add_html_header("<script type='text/javascript'>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '$google_analytics_id']);
|
||||
|
Reference in New Issue
Block a user