mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:50:17 +00:00
The old tag handling is removed
This commit is contained in:
parent
92cf4879e5
commit
b0cb6536dd
14 changed files with 40 additions and 543 deletions
|
@ -1080,21 +1080,15 @@ class DFRN
|
|||
$entry->appendChild($actarg);
|
||||
}
|
||||
|
||||
$tags = Item::getFeedTags($item);
|
||||
$tags = Tag::getByURIId($item['uri-id']);
|
||||
|
||||
/// @TODO Combine this with similar below if() block?
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
if (($type != 'html') || ($t[0] != "@")) {
|
||||
XML::addElement($doc, $entry, "category", "", ["scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]]);
|
||||
foreach ($tags as $tag) {
|
||||
if (($type != 'html') || ($tag['type'] == Tag::HASHTAG)) {
|
||||
XML::addElement($doc, $entry, "category", "", ["scheme" => "X-DFRN:" . Tag::TAG_CHARACTER[$tag['type']] . ":" . $tag['url'], "term" => $tag['name']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
if ($t[0] == "@") {
|
||||
$mentioned[$t[1]] = $t[1];
|
||||
if ($tag['type'] != Tag::HASHTAG) {
|
||||
$mentioned[$tag['url']] = $tag['url'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2238,11 +2232,6 @@ class DFRN
|
|||
// extract tag, if not duplicate, add to parent item
|
||||
if ($xo->content) {
|
||||
Tag::store($item_tag['uri-id'], Tag::HASHTAG, $xo->content);
|
||||
|
||||
if (!stristr($item_tag["tag"], trim($xo->content))) {
|
||||
$tag = $item_tag["tag"] . (strlen($item_tag["tag"]) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
|
||||
Item::update(['tag' => $tag], ['id' => $item_tag["id"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2440,17 +2429,7 @@ class DFRN
|
|||
if (($term != "") && ($scheme != "")) {
|
||||
$parts = explode(":", $scheme);
|
||||
if ((count($parts) >= 4) && (array_shift($parts) == "X-DFRN")) {
|
||||
$termhash = array_shift($parts);
|
||||
$termurl = implode(":", $parts);
|
||||
|
||||
if (!empty($item["tag"])) {
|
||||
$item["tag"] .= ",";
|
||||
} else {
|
||||
$item["tag"] = "";
|
||||
}
|
||||
|
||||
$item["tag"] .= $termhash . "[url=" . $termurl . "]" . $term . "[/url]";
|
||||
|
||||
Tag::store($item['uri-id'], Tag::IMPLICIT_MENTION, $term, $termurl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2582,7 +2582,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
// Do we already have this item?
|
||||
$fields = ['body', 'title', 'attach', 'tag', 'app', 'created', 'object-type', 'uri', 'guid',
|
||||
$fields = ['body', 'title', 'attach', 'app', 'created', 'object-type', 'uri', 'guid',
|
||||
'author-name', 'author-link', 'author-avatar'];
|
||||
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
|
@ -2626,7 +2626,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($stored) {
|
||||
$fields = ['body', 'title', 'attach', 'tag', 'app', 'created', 'object-type', 'uri', 'guid',
|
||||
$fields = ['body', 'title', 'attach', 'app', 'created', 'object-type', 'uri', 'guid',
|
||||
'author-name', 'author-link', 'author-avatar'];
|
||||
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
|
@ -2772,7 +2772,6 @@ class Diaspora
|
|||
|
||||
Tag::storeFromBody($datarray['uri-id'], $datarray["body"]);
|
||||
|
||||
$datarray["tag"] = $original_item["tag"];
|
||||
$datarray["attach"] = $original_item["attach"];
|
||||
$datarray["app"] = $original_item["app"];
|
||||
|
||||
|
|
|
@ -385,18 +385,10 @@ class Feed {
|
|||
$item["attach"] .= '[attach]href="' . $href . '" length="' . $length . '" type="' . $type . '"[/attach]';
|
||||
}
|
||||
|
||||
$tags = '';
|
||||
$taglist = [];
|
||||
$categories = $xpath->query("category", $entry);
|
||||
foreach ($categories AS $category) {
|
||||
$hashtag = $category->nodeValue;
|
||||
if ($tags != '') {
|
||||
$tags .= ', ';
|
||||
}
|
||||
|
||||
$taglink = "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
|
||||
$tags .= $taglink;
|
||||
$taglist[] = $hashtag;
|
||||
$taglist[] = $category->nodeValue;
|
||||
}
|
||||
|
||||
$body = trim(XML::getFirstNodeValue($xpath, 'atom:content/text()', $entry));
|
||||
|
@ -477,7 +469,6 @@ class Feed {
|
|||
// We always strip the title since it will be added in the page information
|
||||
$item["title"] = "";
|
||||
$item["body"] = $item["body"] . add_page_info($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
|
||||
$item["tag"] = add_page_keywords($item["plink"], $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
|
||||
$taglist = get_page_keywords($item["plink"], $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
|
||||
$item["object-type"] = Activity\ObjectType::BOOKMARK;
|
||||
unset($item["attach"]);
|
||||
|
@ -487,14 +478,10 @@ class Feed {
|
|||
}
|
||||
|
||||
if (!empty($contact["fetch_further_information"]) && ($contact["fetch_further_information"] == 3)) {
|
||||
if (!empty($tags)) {
|
||||
$item["tag"] = $tags;
|
||||
} else {
|
||||
// @todo $preview is never set in this case, is it intended? - @MrPetovan 2018-02-13
|
||||
$item["tag"] = add_page_keywords($item["plink"], $preview, true, $contact["ffi_keyword_blacklist"]);
|
||||
if (empty($taglist)) {
|
||||
$taglist = get_page_keywords($item["plink"], $preview, true, $contact["ffi_keyword_blacklist"]);
|
||||
}
|
||||
$item["body"] .= "\n" . $item['tag'];
|
||||
/// @todo $item["body"] .= "\n" . $tags;
|
||||
} else {
|
||||
$taglist = [];
|
||||
}
|
||||
|
|
|
@ -2081,13 +2081,10 @@ class OStatus
|
|||
XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);
|
||||
}
|
||||
|
||||
$tags = item::getFeedTags($item);
|
||||
|
||||
$tags = Tag::getByURIId($item['uri-id']);
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
if ($t[0] == "@") {
|
||||
$mentioned[$t[1]] = $t[1];
|
||||
}
|
||||
foreach ($tags as $tag) {
|
||||
$mentioned[$tag['url']] = $tag['url'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2138,9 +2135,9 @@ class OStatus
|
|||
}
|
||||
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
if ($t[0] != "@") {
|
||||
XML::addElement($doc, $entry, "category", "", ["term" => $t[2]]);
|
||||
foreach ($tags as $tag) {
|
||||
if ($tag['type'] == Tag::HASHTAG) {
|
||||
XML::addElement($doc, $entry, "category", "", ["term" => $tag['name']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue