- 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
@ -4,7 +4,7 @@
|
|||||||
* Author: Drudex Software <support@drudexsoftware.com>
|
* Author: Drudex Software <support@drudexsoftware.com>
|
||||||
* Link: http://www.drudexsoftware.com
|
* Link: http://www.drudexsoftware.com
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Allows admins to set custom <head> content
|
* Description: Allows admins to modify & set custom <head> content
|
||||||
* Documentation:
|
* Documentation:
|
||||||
* When you go to board config you can find a block named Custom HTML Headers.
|
* 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>
|
* In that block you can simply place any thing you can place within <head></head>
|
||||||
@ -12,22 +12,51 @@
|
|||||||
* This can be useful if you want to add website tracking code or other javascript.
|
* 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.
|
* 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 {
|
class custom_html_headers extends Extension {
|
||||||
# Adds setup block for custom <head> content
|
# Adds setup block for custom <head> content
|
||||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
$sb = new SetupBlock("Custom HTML Headers");
|
$sb = new SetupBlock("Custom HTML Headers");
|
||||||
|
|
||||||
|
// custom headers
|
||||||
$sb->add_longtext_option("custom_html_headers",
|
$sb->add_longtext_option("custom_html_headers",
|
||||||
"HTML Code to place within <head></head> on all pages<br>");
|
"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);
|
$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
|
# Load Analytics tracking code on page request
|
||||||
public function onPageRequest(PageRequestEvent $event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
global $config, $page;
|
$this->handle_custom_html_headers();
|
||||||
|
$this->handle_modified_page_title();
|
||||||
|
}
|
||||||
|
|
||||||
$header = $config->get_string('custom_html_headers','');
|
private function handle_custom_html_headers() {
|
||||||
if ($header!='') $page->add_html_header($header);
|
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")) {
|
if($event->page_matches("random")) {
|
||||||
// set vars
|
// set vars
|
||||||
|
$page->title = "Random Images";
|
||||||
$images_per_page = $config->get_int("random_images_list_count", 12);
|
$images_per_page = $config->get_int("random_images_list_count", 12);
|
||||||
$random_images = array();
|
$random_images = array();
|
||||||
$random_html = "<b>Refresh the page to view more images</b>
|
$random_html = "<b>Refresh the page to view more images</b>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user