use DOMDocument;
use DOMElement;
use DOMXPath;
+use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Cache\Enum\Duration;
$header['network'] = Protocol::OSTATUS;
$header['wall'] = 0;
$header['origin'] = 0;
- $header['gravity'] = GRAVITY_COMMENT;
+ $header['gravity'] = Item::GRAVITY_COMMENT;
if (!is_object($doc->firstChild) || empty($doc->firstChild->tagName)) {
return false;
$item['verb'] = Activity::LIKE;
$item['thr-parent'] = $orig_uri;
- $item['gravity'] = GRAVITY_ACTIVITY;
+ $item['gravity'] = Item::GRAVITY_ACTIVITY;
$item['object-type'] = Activity\ObjectType::NOTE;
}
}
} else {
$item['thr-parent'] = $item['uri'];
- $item['gravity'] = GRAVITY_PARENT;
+ $item['gravity'] = Item::GRAVITY_PARENT;
}
self::$itemlist[] = $item;
break;
default:
- Logger::warning('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']);
+ Logger::notice('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']);
}
}
}
$attributes = [
'uri' => 'https://friendi.ca',
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
];
- XML::addElement($doc, $root, 'generator', FRIENDICA_PLATFORM, $attributes);
+ XML::addElement($doc, $root, 'generator', App::PLATFORM, $attributes);
XML::addElement($doc, $root, 'id', DI::baseUrl() . '/profile/' . $owner['nick']);
XML::addElement($doc, $root, 'title', $title);
XML::addElement($doc, $root, 'subtitle', sprintf("Updates from %s on %s", $owner['name'], DI::config()->get('config', 'sitename')));
];
XML::addElement($doc, $root, 'link', '', $attributes);
break;
-
- default:
- Logger::warning('Unsupported type', ['type' => $siteinfo['type'], 'url' => $siteinfo['url'] ?? '']);
- break;
}
if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) {
*/
private static function likeEntry(DOMDocument $doc, array $item, array $owner, bool $toplevel): DOMElement
{
- if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) {
+ if (($item['gravity'] != Item::GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) {
Logger::info('OStatus entry is from author ' . $owner['url'] . ' - not from ' . $item['author-link'] . '. Quitting.');
}
*/
private static function noteEntry(DOMDocument $doc, array $item, array $owner, bool $toplevel): DOMElement
{
- if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) {
+ if (($item['gravity'] != Item::GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) {
Logger::info('OStatus entry is from author ' . $owner['url'] . ' - not from ' . $item['author-link'] . '. Quitting.');
}
XML::addElement($doc, $entry, 'id', $item['uri']);
XML::addElement($doc, $entry, 'title', html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
- $body = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
+ $body = Post\Media::addAttachmentsToBody($item['uri-id'], DI::contentItem()->addSharedPost($item));
$body = self::formatPicturePost($body, $item['uri-id']);
if (!empty($item['title'])) {
{
$mentioned = [];
- if ($item['gravity'] != GRAVITY_PARENT) {
+ if ($item['gravity'] != Item::GRAVITY_PARENT) {
$parent = Post::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]);
$thrparent = Post::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner['uid'], 'uri' => $item['thr-parent']]);