]> git.mxchange.org Git - friendica.git/commitdiff
Avoid warnings, added documentation
authorMichael <heluecht@pirati.ca>
Wed, 26 Sep 2018 22:45:13 +0000 (22:45 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 26 Sep 2018 22:45:13 +0000 (22:45 +0000)
src/Protocol/ActivityPub.php
src/Util/JsonLD.php

index 3bf304adc9b988b0ee8389ae30fd71aab9ce4c94..78e7b9bf23e9f6b37084fdc95f4912f6a8d0b5be 100644 (file)
@@ -77,8 +77,7 @@ class ActivityPub
 {
        const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';
        const CONTEXT = ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
-               ['ostatus' => 'http://ostatus.org#', 'uuid' => 'http://schema.org/identifier',
-               'vcard' => 'http://www.w3.org/2006/vcard/ns#',
+               ['vcard' => 'http://www.w3.org/2006/vcard/ns#',
                'diaspora' => 'https://diasporafoundation.org#',
                'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
                'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag']];
@@ -346,11 +345,11 @@ class ActivityPub
        }
 
        /**
-        * @brief 
+        * @brief Creates an array of permissions from an item thread
         *
         * @param array $item
         *
-        * @return 
+        * @return permission array
         */
        public static function createPermissionBlockForItem($item)
        {
@@ -445,7 +444,7 @@ class ActivityPub
         * @param array $item
         * @param $uid
         *
-        * @return 
+        * @return array with inboxes
         */
        public static function fetchTargetInboxes($item, $uid)
        {
@@ -1393,7 +1392,7 @@ class ActivityPub
                        $actor = defaults($object, 'actor', null);
                }
 
-               $object_data['uuid'] = defaults($object, 'uuid', null);
+               $object_data['diaspora:guid'] = defaults($object, 'diaspora:guid', null);
                $object_data['owner'] = $object_data['author'] = $actor;
                $object_data['context'] = defaults($object, 'context', null);
                $object_data['conversation'] = defaults($object, 'conversation', null);
index 4917c3c015dfc26bafdc6976ad00ded5753e97db..4100b258bb26f91f2076ad084f9891d33854a5a0 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Util;
 
 use Friendica\Core\Cache;
 use digitalbazaar\jsonld as DBJsonLD;
+use Exception;
 
 /**
  * @brief This class contain methods to work with JsonLD data
@@ -60,7 +61,14 @@ class JsonLD
 
                $jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
 
-               return jsonld_normalize($jsonobj, array('algorithm' => 'URDNA2015', 'format' => 'application/nquads'));
+               try {
+                       $normalized = jsonld_normalize($jsonobj, array('algorithm' => 'URDNA2015', 'format' => 'application/nquads'));
+               }
+               catch (Exception $e) {
+                       logger('normalise error:' . print_r($e, true), LOGGER_DEBUG);
+               }
+
+               return $normalized;
        }
 
        /**