diff --git a/include/text.php b/include/text.php index 232cbc5c9e..4636334e8b 100644 --- a/include/text.php +++ b/include/text.php @@ -1034,22 +1034,34 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { } /** - * search box + * Search box. * - * @param string $s search query - * @param string $id html id - * @param string $url search url - * @param boolean $savedsearch show save search button + * @param string $s Search query. + * @param string $id HTML id + * @param string $url Search url. + * @param bool $save Show save search button. + * @param bool $aside Display the search widgit aside. + * + * @return string Formatted HTML. */ -function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true) { +function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true) +{ + $mode = 'text'; + + if (strpos($s, '#') === 0) { + $mode = 'tag'; + } + $save_label = $mode === 'text' ? t('Save') : t('Follow'); + $values = array( '$s' => htmlspecialchars($s), '$id' => $id, '$action_url' => $url, '$search_label' => t('Search'), - '$save_label' => t('Save'), + '$save_label' => $save_label, '$savedsearch' => Feature::isEnabled(local_user(),'savedsearch'), '$search_hint' => t('@name, !forum, #tags, content'), + '$mode' => $mode ); if (!$aside) { diff --git a/view/theme/frio/templates/searchbox.tpl b/view/theme/frio/templates/searchbox.tpl index d95d1a4114..5c80f9b6a3 100644 --- a/view/theme/frio/templates/searchbox.tpl +++ b/view/theme/frio/templates/searchbox.tpl @@ -50,7 +50,12 @@ Some parts of this template will be moved by js to other places (see theme.js) - {{if $savedsearch}}
- + {{* In dependence of the search content we show different buttons *}} + {{if $mode == "tag"}} + + {{else}} + + {{/if}}
{{/if}}