Merge pull request #6184 from MrPetovan/task/normalize-bbcode-hashtags

Normalize BBCode hashtags links
This commit is contained in:
Michael Vogel 2018-11-24 13:14:50 +01:00 committed by GitHub
commit 42a3610a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 35 deletions

View file

@ -350,7 +350,7 @@ class Feed {
$tags .= ', ';
}
$taglink = "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url]";
$taglink = "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
$tags .= $taglink;
}

View file

@ -634,15 +634,15 @@ class OStatus
if ($categories) {
foreach ($categories as $category) {
foreach ($category->attributes as $attributes) {
if ($attributes->name == "term") {
if ($attributes->name == 'term') {
$term = $attributes->textContent;
if (!empty($item["tag"])) {
$item["tag"] .= ',';
if (!empty($item['tag'])) {
$item['tag'] .= ',';
} else {
$item["tag"] = '';
$item['tag'] = '';
}
$item["tag"] .= "#[url=".System::baseUrl()."/search?tag=".$term."]".$term."[/url]";
$item['tag'] .= '#[url=' . System::baseUrl() . '/search?tag=' . $term . ']' . $term . '[/url]';
}
}
}