ExtensionInfo conversions what have I done

This commit is contained in:
Matthew Barbour
2019-08-07 14:53:59 -05:00
committed by matthew
parent 3d1b964812
commit de98e86938
212 changed files with 3449 additions and 1628 deletions

View File

@ -1,19 +1,5 @@
<?php
/**
* Name: Custom HTML Headers
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com
* License: GPLv2
* Description: Allows admins to modify & set custom &lt;head&gt; 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 &lt;head&gt;&lt;/head&gt;
*
* 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.
*
* You can also add your website name as prefix or suffix to the title of each page on your website.
*/
class custom_html_headers extends Extension
{
# Adds setup block for custom <head> content
@ -36,38 +22,38 @@ class custom_html_headers extends Extension
$event->panel->add_block($sb);
}
public function onInitExt(InitExtEvent $event)
{
global $config;
$config->set_default_int("sitename_in_title", 0);
}
# Load Analytics tracking code on page request
public function onPageRequest(PageRequestEvent $event)
{
$this->handle_custom_html_headers();
$this->handle_modified_page_title();
}
private function handle_custom_html_headers()
{
global $config, $page;
$header = $config->get_string('custom_html_headers', '');
if ($header!='') {
$page->add_html_header($header);
}
}
private function handle_modified_page_title()
{
global $config, $page;
// get config values
$site_title = $config->get_string(SetupConfig::TITLE);
$sitename_in_title = $config->get_int("sitename_in_title");
// if feature is enabled & sitename isn't already in title
// (can occur on index & other pages)
if ($sitename_in_title != 0 && !strstr($page->title, $site_title)) {