- Random list page now has a title<br>
- Custom Html Headers extension now allows admin to set title prefix & suffix for all pages
This commit is contained in:
parent
e54c8439cb
commit
8e6fe9f7e3
2 changed files with 63 additions and 33 deletions
|
@ -1,33 +1,62 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?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 <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.
|
||||
*
|
||||
* You can now also add a prefix or suffix to your page title for SEO purposes
|
||||
*/
|
||||
class custom_html_headers extends Extension {
|
||||
# Adds setup block for custom <head> content
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
|
||||
$sb = new SetupBlock("Custom HTML Headers");
|
||||
|
||||
// custom headers
|
||||
$sb->add_longtext_option("custom_html_headers",
|
||||
"HTML Code to place within <head></head> on all pages<br>");
|
||||
|
||||
// modified title
|
||||
$sb->add_text_option("title_prefix", "<br>Page Title Prefix ");
|
||||
$sb->add_text_option("title_suffix", "<br>Page Title Suffix ");
|
||||
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
global $config;
|
||||
|
||||
$config->set_default_string("title_prefix", "");
|
||||
$config->set_default_string("title_suffix", " - {$config->get_string("title")}");
|
||||
}
|
||||
|
||||
# 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;
|
||||
|
||||
$page->title = $config->get_string("title_prefix") .
|
||||
$page->title . $config->get_string("title_suffix");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -14,6 +14,7 @@ class RandomList extends Extension {
|
|||
|
||||
if($event->page_matches("random")) {
|
||||
// set vars
|
||||
$page->title = "Random Images";
|
||||
$images_per_page = $config->get_int("random_images_list_count", 12);
|
||||
$random_images = array();
|
||||
$random_html = "<b>Refresh the page to view more images</b>
|
||||
|
|
Reference in a new issue