Remove useless rawurlencode calls for building hashtag bbcode
- Fix some formatting
This commit is contained in:
parent
540321d0aa
commit
4874f7f8ab
|
@ -97,7 +97,7 @@ function add_page_info_data(array $data, $no_photos = false)
|
||||||
/// @TODO make a positive list of allowed characters
|
/// @TODO make a positive list of allowed characters
|
||||||
$hashtag = str_replace([" ", "+", "/", ".", "#", "'", "’", "`", "(", ")", "„", "“"],
|
$hashtag = str_replace([" ", "+", "/", ".", "#", "'", "’", "`", "(", ")", "„", "“"],
|
||||||
["", "", "", "", "", "", "", "", "", "", "", ""], $keyword);
|
["", "", "", "", "", "", "", "", "", "", "", ""], $keyword);
|
||||||
$hashtags .= "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url] ";
|
$hashtags .= "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url] ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blackl
|
||||||
$tags .= ", ";
|
$tags .= ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags .= "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url]";
|
$tags .= "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ function tagger_content(App $a) {
|
||||||
</target>
|
</target>
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
$tagid = System::baseUrl() . '/search?tag=' . $term;
|
$tagid = System::baseUrl() . '/search?tag=' . $xterm;
|
||||||
$objtype = ACTIVITY_OBJ_TAGTERM;
|
$objtype = ACTIVITY_OBJ_TAGTERM;
|
||||||
|
|
||||||
$obj = <<< EOT
|
$obj = <<< EOT
|
||||||
|
@ -113,7 +113,7 @@ EOT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$termlink = html_entity_decode('⌗') . '[url=' . System::baseUrl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]';
|
$termlink = html_entity_decode('⌗') . '[url=' . System::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
|
|
|
@ -2448,7 +2448,7 @@ class Item extends BaseObject
|
||||||
|
|
||||||
$basetag = str_replace('_',' ',substr($tag,1));
|
$basetag = str_replace('_',' ',substr($tag,1));
|
||||||
|
|
||||||
$newtag = '#[url=' . System::baseUrl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
|
$newtag = '#[url=' . System::baseUrl() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]';
|
||||||
|
|
||||||
$item["body"] = str_replace($tag, $newtag, $item["body"]);
|
$item["body"] = str_replace($tag, $newtag, $item["body"]);
|
||||||
|
|
||||||
|
|
|
@ -266,25 +266,25 @@ class Term
|
||||||
$tag["url"] = $searchpath . $tag["term"];
|
$tag["url"] = $searchpath . $tag["term"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$orig_tag = $tag["url"];
|
$orig_tag = $tag['url'];
|
||||||
|
|
||||||
$author = ['uid' => 0, 'id' => $item['author-id'],
|
$author = ['uid' => 0, 'id' => $item['author-id'],
|
||||||
'network' => $item['author-network'], 'url' => $item['author-link']];
|
'network' => $item['author-network'], 'url' => $item['author-link']];
|
||||||
$tag["url"] = Contact::magicLinkByContact($author, $tag['url']);
|
$tag['url'] = Contact::magicLinkByContact($author, $tag['url']);
|
||||||
|
|
||||||
if ($tag["type"] == TERM_HASHTAG) {
|
if ($tag['type'] == TERM_HASHTAG) {
|
||||||
if ($orig_tag != $tag["url"]) {
|
if ($orig_tag != $tag['url']) {
|
||||||
$item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
|
$item['body'] = str_replace($orig_tag, $tag['url'], $item['body']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['hashtags'][] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
|
$return['hashtags'][] = '#<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
|
||||||
$prefix = "#";
|
$prefix = '#';
|
||||||
} elseif ($tag["type"] == TERM_MENTION) {
|
} elseif ($tag['type'] == TERM_MENTION) {
|
||||||
$return['mentions'][] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
|
$return['mentions'][] = '@<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
|
||||||
$prefix = "@";
|
$prefix = '@';
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['tags'][] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
|
$return['tags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
|
||||||
}
|
}
|
||||||
DBA::close($taglist);
|
DBA::close($taglist);
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ class Feed {
|
||||||
$tags .= ', ';
|
$tags .= ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$taglink = "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url]";
|
$taglink = "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
|
||||||
$tags .= $taglink;
|
$tags .= $taglink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -634,15 +634,15 @@ class OStatus
|
||||||
if ($categories) {
|
if ($categories) {
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
foreach ($category->attributes as $attributes) {
|
foreach ($category->attributes as $attributes) {
|
||||||
if ($attributes->name == "term") {
|
if ($attributes->name == 'term') {
|
||||||
$term = $attributes->textContent;
|
$term = $attributes->textContent;
|
||||||
if (!empty($item["tag"])) {
|
if (!empty($item['tag'])) {
|
||||||
$item["tag"] .= ',';
|
$item['tag'] .= ',';
|
||||||
} else {
|
} 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]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user