diff --git a/ext/arrowkey_navigation/main.php b/ext/arrowkey_navigation/main.php index 657f0891..b2a12ec6 100644 --- a/ext/arrowkey_navigation/main.php +++ b/ext/arrowkey_navigation/main.php @@ -24,6 +24,12 @@ class arrowkey_navigation extends Extension { $next_url = make_http(make_link("post/list/".$pageinfo["next"])); $this->add_arrowkeys_code($prev_url, $next_url); } + + // for random_list extension + else if ($event->page_matches("random")) { + $randomurl = make_http(make_link("random")); + $this->add_arrowkeys_code($randomurl, $randomurl); + } } # adds the javascript to the page with the given urls diff --git a/ext/custom_html_headers/main.php b/ext/custom_html_headers/main.php index 99c1d94c..4bb00058 100644 --- a/ext/custom_html_headers/main.php +++ b/ext/custom_html_headers/main.php @@ -1,33 +1,74 @@ - - * Link: http://www.drudexsoftware.com - * License: GPLv2 - * Description: Allows admins to set custom 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 - * - * 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 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
"); - $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); - } -} -?> + + * 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 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 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
"); + + // modified title + $sb->add_choice_option("sitename_in_title", array( + "none" => 0, + "as prefix" => 1, + "as suffix" => 2 + ), "
Add website name in title"); + + $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("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)) + { + if ($sitename_in_title == 1) + $page->title = "$site_title - $page->title"; // as prefix + else if ($sitename_in_title == 2) + $page->title = "$page->title - $site_title"; // as suffix + } + } +} +?> diff --git a/ext/google_analytics/main.php b/ext/google_analytics/main.php index 494604fa..f1ef0b08 100644 --- a/ext/google_analytics/main.php +++ b/ext/google_analytics/main.php @@ -11,23 +11,18 @@ class google_analytics extends Extension { # Add analytics to config public function onSetupBuilding(SetupBuildingEvent $event) { - global $config; - $sb = new SetupBlock("Google Analytics"); $sb->add_text_option("google_analytics_id", "Analytics ID: "); $sb->add_label("
(eg. UA-xxxxxxxx-x)"); - $event->panel->add_block($sb); } # Load Analytics tracking code on page request public function onPageRequest(PageRequestEvent $event) { - global $config; - global $page; + global $config, $page; $google_analytics_id = $config->get_string('google_analytics_id',''); - if (stristr($google_analytics_id, "UA-")) - { + if (stristr($google_analytics_id, "UA-")) { $page->add_html_header("