namespace Friendica\Module\Api\Mastodon;
-use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Markdown;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
// The imput is defined as text. So we can use Markdown for some enhancements
$body = Markdown::toBBCode($request['status']);
- // Avoids potential double expansion of existing links
- $body = BBCode::performWithEscapedTags($body, ['url'], function ($body) {
- return BBCode::expandTags($body);
- });
-
- $item = [];
+ $item = [];
+ $item['network'] = Protocol::DFRN;
$item['uid'] = $uid;
$item['verb'] = Activity::POST;
$item['contact-id'] = $owner['id'];
$item['object-type'] = Activity\ObjectType::NOTE;
}
+ $item = DI::contentItem()->expandTags($item);
+
if (!empty($request['media_ids'])) {
$item['object-type'] = Activity\ObjectType::IMAGE;
$item['post-type'] = Item::PT_IMAGE;
namespace Friendica\Module\Api\Twitter\Statuses;
-use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Content\Text\Markdown;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
}
$item = [];
+ $item['network'] = Protocol::DFRN;
$item['uid'] = $uid;
$item['verb'] = Activity::POST;
$item['contact-id'] = $owner['id'];
- $item['author-id'] = Contact::getPublicIdByUserId($uid);
- $item['owner-id'] = $item['author-id'];
+ $item['author-id'] = $item['owner-id'] = Contact::getPublicIdByUserId($uid);
$item['title'] = $request['title'];
$item['body'] = $body;
$item['app'] = $request['source'];