From ffbab555b8622160b552616dacf188f1a38aca9a Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Sat, 16 Mar 2013 14:27:55 +0000 Subject: [PATCH 1/2] Feature #446 - Allow customizing page title --- config.php-dist | 3 +++ index.php | 2 +- js/tt-rss.js | 6 +++++- mobile/index.php | 2 +- prefs.php | 2 +- register.php | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config.php-dist b/config.php-dist index eaaaa3d69..a742cf9af 100644 --- a/config.php-dist +++ b/config.php-dist @@ -181,6 +181,9 @@ // Users may enable other user plugins from Preferences/Plugins but may not // disable plugins specified in this list. + define('PAGE_TITLE','Tiny Tiny RSS'); + // Change this value to customize the HTML page title + define('CONFIG_VERSION', 26); // Expected config version. Please update this option in config.php // if necessary (after migrating all new options from this file). diff --git a/index.php b/index.php index 6584d8d2e..53d31fc52 100644 --- a/index.php +++ b/index.php @@ -55,7 +55,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - Tiny Tiny RSS + <?php echo PAGE_TITLE ?> diff --git a/js/tt-rss.js b/js/tt-rss.js index badfe8707..5d6e1d81e 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -178,7 +178,11 @@ function search() { } function updateTitle() { - var tmp = "Tiny Tiny RSS"; + var tmp = document.title; + if (tmp.indexOf('(')>0) + { + tmp = tmp.substr(0,tmp.lastIndexOf('(')); + } if (global_unread > 0) { tmp = tmp + " (" + global_unread + ")"; diff --git a/mobile/index.php b/mobile/index.php index edbf586e0..aad2d2884 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -19,7 +19,7 @@ -Tiny Tiny RSS +<?php echo PAGE_TITLE ?> diff --git a/prefs.php b/prefs.php index 6c1091843..b4ab3689d 100644 --- a/prefs.php +++ b/prefs.php @@ -25,7 +25,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - Tiny Tiny RSS : <?php echo __("Preferences") ?> + <?php echo PAGE_TITLE ?> : <?php echo __("Preferences") ?> diff --git a/register.php b/register.php index b0c9bd95f..d61bcfa29 100644 --- a/register.php +++ b/register.php @@ -27,7 +27,7 @@ print ''; print " ".htmlspecialchars(SELF_URL_PATH . "/register.php")." - Tiny Tiny RSS registration slots + <?php echo PAGE_TITLE ?> registration slots "; From 8d051fa0769922df69ac737eee9d13dff67095a9 Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Thu, 21 Mar 2013 20:24:26 +0000 Subject: [PATCH 2/2] update SITE_TITLE customization to work without needing to be pre-defined, make it compatible with unread count now being at start of title --- config.php-dist | 2 +- include/functions.php | 7 +++++++ index.php | 2 +- js/tt-rss.js | 4 ++-- prefs.php | 2 +- register.php | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/config.php-dist b/config.php-dist index 4414e77d3..176949fd9 100644 --- a/config.php-dist +++ b/config.php-dist @@ -183,7 +183,7 @@ // Users may enable other user plugins from Preferences/Plugins but may not // disable plugins specified in this list. - define('PAGE_TITLE','Tiny Tiny RSS'); + define('SITE_TITLE', 'Tiny Tiny RSS'); // Change this value to customize the HTML page title define('CONFIG_VERSION', 26); diff --git a/include/functions.php b/include/functions.php index 5d5550059..879a03e3f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -4098,4 +4098,11 @@ return $max_ts; } + function get_site_title() { + $original_title = "Tiny Tiny RSS"; + if (defined("SITE_TITLE")) { + return SITE_TITLE; + } + return $original_title; + } ?> diff --git a/index.php b/index.php index 5a37c0e98..4669a2080 100644 --- a/index.php +++ b/index.php @@ -53,7 +53,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <?php echo PAGE_TITLE ?> + <?php echo get_site_title() ?> diff --git a/js/tt-rss.js b/js/tt-rss.js index 1d6540dbb..91aff8b68 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -179,9 +179,9 @@ function search() { function updateTitle() { var tmp = document.title; - if (tmp.indexOf('(')>0) + if (tmp.indexOf(")") > 0) { - tmp = tmp.substr(0,tmp.lastIndexOf('(')); + tmp = tmp.substr(tmp.indexOf(")") + 1); } if (global_unread > 0) { diff --git a/prefs.php b/prefs.php index 9c59d6c4d..0d27a6e81 100644 --- a/prefs.php +++ b/prefs.php @@ -23,7 +23,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <?php echo PAGE_TITLE ?> : <?php echo __("Preferences") ?> + <?php echo get_site_title() ?> : <?php echo __("Preferences") ?> diff --git a/register.php b/register.php index d7ba7da5f..69a3dbf50 100644 --- a/register.php +++ b/register.php @@ -27,7 +27,7 @@ print ''; print " ".htmlspecialchars(SELF_URL_PATH . "/register.php")." - <?php echo PAGE_TITLE ?> registration slots + <?php echo get_site_title() ?> registration slots ";