Custom HTML Headers added
I may also expand it to allow headers specific pages later
This commit is contained in:
parent
cf9e0eae8c
commit
a03e4d5102
33
ext/custom_html_headers/main.php
Normal file
33
ext/custom_html_headers/main.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user