diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-02-24 13:28:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-24 13:28:30 +0100 |
commit | e746c237cdff932cf4c6510becc185c149fa4592 (patch) | |
tree | 2a9a3041b1c34f27ffcb046ecdf03da70491e386 /index.php | |
parent | b9c6589363f3a9b86fd64a96dfbafcdeb9f42c77 (diff) | |
parent | 980efd6cf895536a69ed679573d9be826776daa5 (diff) | |
download | Shaarli-e746c237cdff932cf4c6510becc185c149fa4592.tar.gz Shaarli-e746c237cdff932cf4c6510becc185c149fa4592.tar.zst Shaarli-e746c237cdff932cf4c6510becc185c149fa4592.zip |
Merge pull request #1062 from ArthurHoaro/feature/pages-title
Use a specific page title in all pages
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -573,6 +573,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager) | |||
573 | $pageBuilder->assign($key, $value); | 573 | $pageBuilder->assign($key, $value); |
574 | } | 574 | } |
575 | 575 | ||
576 | $pageBuilder->assign('pagetitle', t('Daily') .' - '. $conf->get('general.title', 'Shaarli')); | ||
576 | $pageBuilder->renderPage('daily'); | 577 | $pageBuilder->renderPage('daily'); |
577 | exit; | 578 | exit; |
578 | } | 579 | } |
@@ -677,6 +678,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
677 | // add default state of the 'remember me' checkbox | 678 | // add default state of the 'remember me' checkbox |
678 | $PAGE->assign('remember_user_default', $conf->get('privacy.remember_user_default')); | 679 | $PAGE->assign('remember_user_default', $conf->get('privacy.remember_user_default')); |
679 | $PAGE->assign('user_can_login', $loginManager->canLogin($_SERVER)); | 680 | $PAGE->assign('user_can_login', $loginManager->canLogin($_SERVER)); |
681 | $PAGE->assign('pagetitle', t('Login') .' - '. $conf->get('general.title', 'Shaarli')); | ||
680 | $PAGE->renderPage('loginform'); | 682 | $PAGE->renderPage('loginform'); |
681 | exit; | 683 | exit; |
682 | } | 684 | } |
@@ -717,6 +719,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
717 | $PAGE->assign($key, $value); | 719 | $PAGE->assign($key, $value); |
718 | } | 720 | } |
719 | 721 | ||
722 | $PAGE->assign('pagetitle', t('Picture wall') .' - '. $conf->get('general.title', 'Shaarli')); | ||
720 | $PAGE->renderPage('picwall'); | 723 | $PAGE->renderPage('picwall'); |
721 | exit; | 724 | exit; |
722 | } | 725 | } |
@@ -752,8 +755,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
752 | ); | 755 | ); |
753 | } | 756 | } |
754 | 757 | ||
758 | $searchTags = implode(' ', escape($filteringTags)); | ||
755 | $data = array( | 759 | $data = array( |
756 | 'search_tags' => implode(' ', escape($filteringTags)), | 760 | 'search_tags' => $searchTags, |
757 | 'tags' => $tagList, | 761 | 'tags' => $tagList, |
758 | ); | 762 | ); |
759 | $pluginManager->executeHooks('render_tagcloud', $data, array('loggedin' => isLoggedIn())); | 763 | $pluginManager->executeHooks('render_tagcloud', $data, array('loggedin' => isLoggedIn())); |
@@ -762,6 +766,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
762 | $PAGE->assign($key, $value); | 766 | $PAGE->assign($key, $value); |
763 | } | 767 | } |
764 | 768 | ||
769 | $searchTags = ! empty($searchTags) ? $searchTags .' - ' : ''; | ||
770 | $PAGE->assign('pagetitle', $searchTags. t('Tag cloud') .' - '. $conf->get('general.title', 'Shaarli')); | ||
765 | $PAGE->renderPage('tag.cloud'); | 771 | $PAGE->renderPage('tag.cloud'); |
766 | exit; | 772 | exit; |
767 | } | 773 | } |
@@ -782,8 +788,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
782 | alphabetical_sort($tags, false, true); | 788 | alphabetical_sort($tags, false, true); |
783 | } | 789 | } |
784 | 790 | ||
791 | $searchTags = implode(' ', escape($filteringTags)); | ||
785 | $data = [ | 792 | $data = [ |
786 | 'search_tags' => implode(' ', escape($filteringTags)), | 793 | 'search_tags' => $searchTags, |
787 | 'tags' => $tags, | 794 | 'tags' => $tags, |
788 | ]; | 795 | ]; |
789 | $pluginManager->executeHooks('render_taglist', $data, ['loggedin' => isLoggedIn()]); | 796 | $pluginManager->executeHooks('render_taglist', $data, ['loggedin' => isLoggedIn()]); |
@@ -792,6 +799,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
792 | $PAGE->assign($key, $value); | 799 | $PAGE->assign($key, $value); |
793 | } | 800 | } |
794 | 801 | ||
802 | $searchTags = ! empty($searchTags) ? $searchTags .' - ' : ''; | ||
803 | $PAGE->assign('pagetitle', $searchTags . t('Tag list') .' - '. $conf->get('general.title', 'Shaarli')); | ||
795 | $PAGE->renderPage('tag.list'); | 804 | $PAGE->renderPage('tag.list'); |
796 | exit; | 805 | exit; |
797 | } | 806 | } |
@@ -1016,6 +1025,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1016 | $PAGE->assign($key, $value); | 1025 | $PAGE->assign($key, $value); |
1017 | } | 1026 | } |
1018 | 1027 | ||
1028 | $PAGE->assign('pagetitle', t('Tools') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1019 | $PAGE->renderPage('tools'); | 1029 | $PAGE->renderPage('tools'); |
1020 | exit; | 1030 | exit; |
1021 | } | 1031 | } |
@@ -1059,6 +1069,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1059 | } | 1069 | } |
1060 | else // show the change password form. | 1070 | else // show the change password form. |
1061 | { | 1071 | { |
1072 | $PAGE->assign('pagetitle', t('Change password') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1062 | $PAGE->renderPage('changepassword'); | 1073 | $PAGE->renderPage('changepassword'); |
1063 | exit; | 1074 | exit; |
1064 | } | 1075 | } |
@@ -1131,6 +1142,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1131 | $PAGE->assign('api_secret', $conf->get('api.secret')); | 1142 | $PAGE->assign('api_secret', $conf->get('api.secret')); |
1132 | $PAGE->assign('languages', Languages::getAvailableLanguages()); | 1143 | $PAGE->assign('languages', Languages::getAvailableLanguages()); |
1133 | $PAGE->assign('language', $conf->get('translation.language')); | 1144 | $PAGE->assign('language', $conf->get('translation.language')); |
1145 | $PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1134 | $PAGE->renderPage('configure'); | 1146 | $PAGE->renderPage('configure'); |
1135 | exit; | 1147 | exit; |
1136 | } | 1148 | } |
@@ -1141,6 +1153,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1141 | { | 1153 | { |
1142 | if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { | 1154 | if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { |
1143 | $PAGE->assign('fromtag', ! empty($_GET['fromtag']) ? escape($_GET['fromtag']) : ''); | 1155 | $PAGE->assign('fromtag', ! empty($_GET['fromtag']) ? escape($_GET['fromtag']) : ''); |
1156 | $PAGE->assign('pagetitle', t('Manage tags') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1144 | $PAGE->renderPage('changetag'); | 1157 | $PAGE->renderPage('changetag'); |
1145 | exit; | 1158 | exit; |
1146 | } | 1159 | } |
@@ -1167,6 +1180,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1167 | // -------- User wants to add a link without using the bookmarklet: Show form. | 1180 | // -------- User wants to add a link without using the bookmarklet: Show form. |
1168 | if ($targetPage == Router::$PAGE_ADDLINK) | 1181 | if ($targetPage == Router::$PAGE_ADDLINK) |
1169 | { | 1182 | { |
1183 | $PAGE->assign('pagetitle', t('Shaare a new link') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1170 | $PAGE->renderPage('addlink'); | 1184 | $PAGE->renderPage('addlink'); |
1171 | exit; | 1185 | exit; |
1172 | } | 1186 | } |
@@ -1336,6 +1350,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1336 | $PAGE->assign($key, $value); | 1350 | $PAGE->assign($key, $value); |
1337 | } | 1351 | } |
1338 | 1352 | ||
1353 | $PAGE->assign('pagetitle', t('Edit') .' '. t('Shaare') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1339 | $PAGE->renderPage('editlink'); | 1354 | $PAGE->renderPage('editlink'); |
1340 | exit; | 1355 | exit; |
1341 | } | 1356 | } |
@@ -1400,6 +1415,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1400 | $PAGE->assign($key, $value); | 1415 | $PAGE->assign($key, $value); |
1401 | } | 1416 | } |
1402 | 1417 | ||
1418 | $PAGE->assign('pagetitle', t('Shaare') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1403 | $PAGE->renderPage('editlink'); | 1419 | $PAGE->renderPage('editlink'); |
1404 | exit; | 1420 | exit; |
1405 | } | 1421 | } |
@@ -1408,6 +1424,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1408 | // Export links as a Netscape Bookmarks file | 1424 | // Export links as a Netscape Bookmarks file |
1409 | 1425 | ||
1410 | if (empty($_GET['selection'])) { | 1426 | if (empty($_GET['selection'])) { |
1427 | $PAGE->assign('pagetitle', t('Export') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1411 | $PAGE->renderPage('export'); | 1428 | $PAGE->renderPage('export'); |
1412 | exit; | 1429 | exit; |
1413 | } | 1430 | } |
@@ -1469,6 +1486,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1469 | true | 1486 | true |
1470 | ) | 1487 | ) |
1471 | ); | 1488 | ); |
1489 | $PAGE->assign('pagetitle', t('Import') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1472 | $PAGE->renderPage('import'); | 1490 | $PAGE->renderPage('import'); |
1473 | exit; | 1491 | exit; |
1474 | } | 1492 | } |
@@ -1517,6 +1535,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1517 | 1535 | ||
1518 | $PAGE->assign('enabledPlugins', $enabledPlugins); | 1536 | $PAGE->assign('enabledPlugins', $enabledPlugins); |
1519 | $PAGE->assign('disabledPlugins', $disabledPlugins); | 1537 | $PAGE->assign('disabledPlugins', $disabledPlugins); |
1538 | $PAGE->assign('pagetitle', t('Plugin administration') .' - '. $conf->get('general.title', 'Shaarli')); | ||
1520 | $PAGE->renderPage('pluginsadmin'); | 1539 | $PAGE->renderPage('pluginsadmin'); |
1521 | exit; | 1540 | exit; |
1522 | } | 1541 | } |
@@ -1680,6 +1699,16 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1680 | // If there is only a single link, we change on-the-fly the title of the page. | 1699 | // If there is only a single link, we change on-the-fly the title of the page. |
1681 | if (count($linksToDisplay) == 1) { | 1700 | if (count($linksToDisplay) == 1) { |
1682 | $data['pagetitle'] = $linksToDisplay[$keys[0]]['title'] .' - '. $conf->get('general.title'); | 1701 | $data['pagetitle'] = $linksToDisplay[$keys[0]]['title'] .' - '. $conf->get('general.title'); |
1702 | } elseif (! empty($searchterm) || ! empty($searchtags)) { | ||
1703 | $data['pagetitle'] = t('Search: '); | ||
1704 | $data['pagetitle'] .= ! empty($searchterm) ? $searchterm .' ' : ''; | ||
1705 | $bracketWrap = function ($tag) { | ||
1706 | return '['. $tag .']'; | ||
1707 | }; | ||
1708 | $data['pagetitle'] .= ! empty($searchtags) | ||
1709 | ? implode(' ', array_map($bracketWrap, preg_split('/\s+/', $searchtags))).' ' | ||
1710 | : ''; | ||
1711 | $data['pagetitle'] .= '- '. $conf->get('general.title'); | ||
1683 | } | 1712 | } |
1684 | 1713 | ||
1685 | $pluginManager->executeHooks('render_linklist', $data, array('loggedin' => isLoggedIn())); | 1714 | $pluginManager->executeHooks('render_linklist', $data, array('loggedin' => isLoggedIn())); |