a03e4d5102
I may also expand it to allow headers specific pages later
33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Name: Custom HTML Headers
|
|
* Author: Drudex Software <support@drudexsoftware.com>
|
|
* Link: http://www.drudexsoftware.com
|
|
* License: GPLv2
|
|
* Description: Allows admins to set custom <head> 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 <head></head>
|
|
*
|
|
* 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 <head> 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<br>");
|
|
$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);
|
|
}
|
|
}
|
|
?>
|