Merge pull request #981 from MrPetovan/task/remove-item-tag
[various] Remove references to obsolete virtual tag item.tag
This commit is contained in:
commit
5b9bba32bb
|
@ -14,6 +14,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -191,7 +192,7 @@ function dwpost_send(App $a, array &$b)
|
|||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = XML::escape($post);
|
||||
$tags = dwpost_get_tags($b['tag']);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||
$year = intval(substr($date,0,4));
|
||||
|
@ -236,12 +237,3 @@ EOT;
|
|||
Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
function dwpost_get_tags($post)
|
||||
{
|
||||
preg_match_all("/\]([^\[#]+)\[/", $post, $matches);
|
||||
|
||||
$tags = implode(', ', $matches[1]);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -189,7 +190,7 @@ function ijpost_send(&$a, &$b)
|
|||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = XML::escape($post);
|
||||
$tags = ijpost_get_tags($b['tag']);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||
$year = intval(substr($date,0,4));
|
||||
|
@ -233,10 +234,3 @@ EOT;
|
|||
Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
function ijpost_get_tags($post)
|
||||
{
|
||||
preg_match_all("/\]([^\[#]+)\[/", $post, $matches);
|
||||
$tags = implode(', ', $matches[1]);
|
||||
return $tags;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -188,7 +189,7 @@ function ljpost_send(&$a,&$b) {
|
|||
$title = XML::escape($b['title']);
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = XML::escape($post);
|
||||
$tags = ljpost_get_tags($b['tag']);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||
$year = intval(substr($date,0,4));
|
||||
|
@ -245,10 +246,3 @@ EOT;
|
|||
Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
function ljpost_get_tags($post)
|
||||
{
|
||||
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
|
||||
$tags = implode(', ',$matches[1]);
|
||||
return $tags;
|
||||
}
|
||||
|
|
|
@ -1202,9 +1202,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
|
||||
$postarray['body'] = HTML::toBBCode($content->statusnet_html);
|
||||
|
||||
$converted = statusnet_convertmsg($a, $postarray['body'], false);
|
||||
$postarray['body'] = $converted["body"];
|
||||
$postarray['tag'] = $converted["tags"];
|
||||
$postarray['body'] = statusnet_convertmsg($a, $postarray['body']);
|
||||
|
||||
$postarray['created'] = DateTimeFormat::utc($content->created_at);
|
||||
$postarray['edited'] = DateTimeFormat::utc($content->created_at);
|
||||
|
@ -1433,7 +1431,7 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic
|
|||
}
|
||||
}
|
||||
|
||||
function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
||||
function statusnet_convertmsg(App $a, $body)
|
||||
{
|
||||
$body = preg_replace("=\[url\=https?://([0-9]*).([0-9]*).([0-9]*).([0-9]*)/([0-9]*)\](.*?)\[\/url\]=ism", "$1.$2.$3.$4/$5", $body);
|
||||
|
||||
|
@ -1510,36 +1508,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
|||
}
|
||||
}
|
||||
|
||||
if ($no_tags) {
|
||||
return ["body" => $body, "tags" => ""];
|
||||
}
|
||||
|
||||
$str_tags = '';
|
||||
|
||||
$cnt = preg_match_all("/([!#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
if (strlen($str_tags)) {
|
||||
$str_tags .= ',';
|
||||
}
|
||||
|
||||
if ($mtch[1] == "#") {
|
||||
// Replacing the hash tags that are directed to the GNU Social server with internal links
|
||||
$snhash = "#[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]";
|
||||
$frdchash = '#[url=' . DI::baseUrl()->get() . '/search?tag=' . $mtch[3] . ']' . $mtch[3] . '[/url]';
|
||||
$body = str_replace($snhash, $frdchash, $body);
|
||||
|
||||
$str_tags .= $frdchash;
|
||||
} else {
|
||||
$str_tags .= "@[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]";
|
||||
}
|
||||
// To-Do:
|
||||
// There is a problem with links with to GNU Social groups, so these links are stored with "@" like friendica groups
|
||||
//$str_tags .= $mtch[1]."[url=".$mtch[2]."]".$mtch[3]."[/url]";
|
||||
}
|
||||
}
|
||||
|
||||
return ["body" => $body, "tags" => $str_tags];
|
||||
return $body;
|
||||
}
|
||||
|
||||
function statusnet_fetch_own_contact(App $a, $uid)
|
||||
|
|
|
@ -1224,14 +1224,12 @@ function twitter_expand_entities($body, stdClass $status, $picture)
|
|||
{
|
||||
$plain = $body;
|
||||
|
||||
$tags = [];
|
||||
$taglist = [];
|
||||
|
||||
$replacementList = [];
|
||||
|
||||
foreach ($status->entities->hashtags AS $hashtag) {
|
||||
$replace = '#[url=' . DI::baseUrl()->get() . '/search?tag=' . $hashtag->text . ']' . $hashtag->text . '[/url]';
|
||||
$tags['#' . $hashtag->text] = $replace;
|
||||
$taglist['#' . $hashtag->text] = ['#', $hashtag->text, ''];
|
||||
|
||||
$replacementList[$hashtag->indices[0]] = [
|
||||
|
@ -1242,7 +1240,6 @@ function twitter_expand_entities($body, stdClass $status, $picture)
|
|||
|
||||
foreach ($status->entities->user_mentions AS $mention) {
|
||||
$replace = '@[url=https://twitter.com/' . rawurlencode($mention->screen_name) . ']' . $mention->screen_name . '[/url]';
|
||||
$tags['@' . $mention->screen_name] = $replace;
|
||||
$taglist['@' . $mention->screen_name] = ['@', $mention->screen_name, 'https://twitter.com/' . rawurlencode($mention->screen_name)];
|
||||
|
||||
$replacementList[$mention->indices[0]] = [
|
||||
|
@ -1344,7 +1341,7 @@ function twitter_expand_entities($body, stdClass $status, $picture)
|
|||
}
|
||||
}
|
||||
|
||||
return ['body' => $body, 'tags' => $tags, 'plain' => $plain, 'taglist' => $taglist];
|
||||
return ['body' => $body, 'plain' => $plain, 'taglist' => $taglist];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1557,7 +1554,6 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
|||
|
||||
$converted = twitter_expand_entities($postarray['body'], $post, $picture);
|
||||
$postarray['body'] = $converted['body'];
|
||||
$postarray['tag'] = implode(',', $converted['tags']);
|
||||
$postarray['created'] = DateTimeFormat::utc($post->created_at);
|
||||
$postarray['edited'] = DateTimeFormat::utc($post->created_at);
|
||||
|
||||
|
|
Loading…
Reference in a new issue