diff --git a/ext/custom_html_headers/main.php b/ext/custom_html_headers/main.php new file mode 100644 index 00000000..99c1d94c --- /dev/null +++ b/ext/custom_html_headers/main.php @@ -0,0 +1,33 @@ + + * Link: http://www.drudexsoftware.com + * License: GPLv2 + * Description: Allows admins to set custom content + * Documentation: + * When you go to board config you can find a block named Custom HTML Headers. + * In that block you can simply place any thing you can place within + * + * This can be useful if you want to add website tracking code or other javascript. + * NOTE: Only use if you know what you're doing. + * + */ +class custom_html_headers extends Extension { + # Adds setup block for custom content + public function onSetupBuilding(SetupBuildingEvent $event) { + $sb = new SetupBlock("Custom HTML Headers"); + $sb->add_longtext_option("custom_html_headers", + "HTML Code to place within <head></head> on all pages
"); + $event->panel->add_block($sb); + } + + # Load Analytics tracking code on page request + public function onPageRequest(PageRequestEvent $event) { + global $config, $page; + + $header = $config->get_string('custom_html_headers',''); + if ($header!='') $page->add_html_header($header); + } +} +?>