diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-22 16:21:03 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-05 17:54:42 +0100 |
commit | b3bd8c3e8d367975980043e772f7cd78b7f96bc6 (patch) | |
tree | ec79899ea564c093d8b0578f3e614881a4ea7c3d /application/front/controller/visitor/BookmarkListController.php | |
parent | 48df9f45b8c4b2995c1e04146071628668531b37 (diff) | |
download | Shaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.tar.gz Shaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.tar.zst Shaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.zip |
Feature: support any tag separator
So it allows to have multiple words tags.
Breaking change: commas ',' are no longer a default separator.
Fixes #594
Diffstat (limited to 'application/front/controller/visitor/BookmarkListController.php')
-rw-r--r-- | application/front/controller/visitor/BookmarkListController.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/application/front/controller/visitor/BookmarkListController.php b/application/front/controller/visitor/BookmarkListController.php index 78c474c9..cc3837ce 100644 --- a/application/front/controller/visitor/BookmarkListController.php +++ b/application/front/controller/visitor/BookmarkListController.php | |||
@@ -95,6 +95,10 @@ class BookmarkListController extends ShaarliVisitorController | |||
95 | $next_page_url = '?page=' . ($page - 1) . $searchtermUrl . $searchtagsUrl; | 95 | $next_page_url = '?page=' . ($page - 1) . $searchtermUrl . $searchtagsUrl; |
96 | } | 96 | } |
97 | 97 | ||
98 | $tagsSeparator = $this->container->conf->get('general.tags_separator', ' '); | ||
99 | $searchTagsUrlEncoded = array_map('urlencode', tags_str2array($searchTags, $tagsSeparator)); | ||
100 | $searchTags = !empty($searchTags) ? trim($searchTags, $tagsSeparator) . $tagsSeparator : ''; | ||
101 | |||
98 | // Fill all template fields. | 102 | // Fill all template fields. |
99 | $data = array_merge( | 103 | $data = array_merge( |
100 | $this->initializeTemplateVars(), | 104 | $this->initializeTemplateVars(), |
@@ -106,7 +110,7 @@ class BookmarkListController extends ShaarliVisitorController | |||
106 | 'result_count' => count($linksToDisplay), | 110 | 'result_count' => count($linksToDisplay), |
107 | 'search_term' => escape($searchTerm), | 111 | 'search_term' => escape($searchTerm), |
108 | 'search_tags' => escape($searchTags), | 112 | 'search_tags' => escape($searchTags), |
109 | 'search_tags_url' => array_map('urlencode', explode(' ', $searchTags)), | 113 | 'search_tags_url' => $searchTagsUrlEncoded, |
110 | 'visibility' => $visibility, | 114 | 'visibility' => $visibility, |
111 | 'links' => $linkDisp, | 115 | 'links' => $linkDisp, |
112 | ] | 116 | ] |
@@ -119,8 +123,9 @@ class BookmarkListController extends ShaarliVisitorController | |||
119 | return '[' . $tag . ']'; | 123 | return '[' . $tag . ']'; |
120 | }; | 124 | }; |
121 | $data['pagetitle'] .= ! empty($searchTags) | 125 | $data['pagetitle'] .= ! empty($searchTags) |
122 | ? implode(' ', array_map($bracketWrap, preg_split('/\s+/', $searchTags))) . ' ' | 126 | ? implode(' ', array_map($bracketWrap, tags_str2array($searchTags, $tagsSeparator))) . ' ' |
123 | : ''; | 127 | : '' |
128 | ; | ||
124 | $data['pagetitle'] .= '- '; | 129 | $data['pagetitle'] .= '- '; |
125 | } | 130 | } |
126 | 131 | ||