]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/JsonLD.php
Friendica copyright changed from 2023 to 2034
[friendica.git] / src / Util / JsonLD.php
index 63787db08b8eb37c97ae775fb16e84eb6698ea49..f1d4da3f5b4d91852ebf3a9a9002720ac011cf73 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -58,6 +58,9 @@ class JsonLD
                        case 'https://www.w3.org/ns/activitystreams':
                                $url = DI::basePath() . '/static/activitystreams.jsonld';
                                break;
+                       case 'https://www.w3.org/ns/did/v1':
+                               $url = DI::basePath() . '/static/did-v1.jsonld';
+                               break;
                        case 'https://funkwhale.audio/ns':
                                $url = DI::basePath() . '/static/funkwhale.audio.jsonld';
                                break;
@@ -101,7 +104,7 @@ class JsonLD
 
                $result = DI::cache()->get('documentLoader:' . $url);
                if (!is_null($result)) {
-                       //return $result;
+                       return $result;
                }
 
                $data = jsonld_default_document_loader($url);
@@ -171,6 +174,7 @@ class JsonLD
                        'mobilizon' => (object)['@id' => 'https://joinmobilizon.org/ns#', '@type' => '@id'],
                        'fedibird' => (object)['@id' => 'http://fedibird.com/ns#', '@type' => '@id'],
                        'misskey' => (object)['@id' => 'https://misskey-hub.net/ns#', '@type' => '@id'],
+                       'pixelfed' => (object)['@id' => 'http://pixelfed.org/ns#', '@type' => '@id'],
                ];
 
                $orig_json = $json;
@@ -208,7 +212,7 @@ class JsonLD
                        Logger::notice('compacting error', ['msg' => $e->getMessage(), 'previous' => $e->getPrevious(), 'line' => $e->getLine()]);
                        if ($logfailed && DI::config()->get('debug', 'ap_log_failure')) {
                                $tempfile = tempnam(System::getTempPath(), 'failed-jsonld');
-                               file_put_contents($tempfile, json_encode(['json' => $orig_json, 'callstack' => System::callstack(20), 'msg' => $e->getMessage(), 'previous' => $e->getPrevious()], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
+                               file_put_contents($tempfile, json_encode(['json' => $orig_json, 'msg' => $e->getMessage(), 'previous' => $e->getPrevious()], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
                                Logger::notice('Failed message stored', ['file' => $tempfile]);
                        }
                }