From: Philipp Holzer <admin+github@philipp.info> Date: Thu, 24 Oct 2019 22:34:46 +0000 (+0200) Subject: Move Namespace of ActivityNamespace X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7343ee510826e981a80c8db1da86d2aa524a488d;p=friendica.git Move Namespace of ActivityNamespace --- diff --git a/mod/salmon.php b/mod/salmon.php index 2a7c4a4b3d..313c2cb0bb 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -9,7 +9,7 @@ use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\Model\Contact; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\OStatus; use Friendica\Protocol\Salmon; use Friendica\Util\Crypto; diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 77fa3959a5..1028bfd531 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -8,7 +8,7 @@ use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Photo; use Friendica\Model\User; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\Salmon; use Friendica\Util\Strings; diff --git a/src/Network/Probe.php b/src/Network/Probe.php index e63224411f..80fa641ed4 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -18,7 +18,7 @@ use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Profile; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\ActivityPub; use Friendica\Protocol\Email; use Friendica\Protocol\Feed; diff --git a/src/Protocol/Activity.php b/src/Protocol/Activity.php index d2c5eec4b3..bea2dedb09 100644 --- a/src/Protocol/Activity.php +++ b/src/Protocol/Activity.php @@ -2,7 +2,7 @@ namespace Friendica\Protocol; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; /** * Base class for the Activity Verbs diff --git a/src/Protocol/Activity/ActivityNamespace.php b/src/Protocol/Activity/ActivityNamespace.php deleted file mode 100644 index a821f069e1..0000000000 --- a/src/Protocol/Activity/ActivityNamespace.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php - -namespace Friendica\Protocol\Activity; - -/** - * Activity namespaces constants - */ -final class ActivityNamespace -{ - /** - * Zot is a WebMTA which provides a decentralised identity and communications protocol using HTTPS/JSON. - * - * @var string - * @see https://zotlabs.org/page/zotlabs/specs+zot6+home - */ - const ZOT = 'http://purl.org/zot'; - /** - * Friendica is using ActivityStreams in version 1.0 for its activities and object types. - * Additional types are used for non standard activities. - * - * @var string - * @see https://github.com/friendica/friendica/wiki/ActivityStreams - */ - const DFRN = 'http://purl.org/macgirvin/dfrn/1.0'; - /** - * This namespace defines an extension for expressing threaded - * discussions within the Atom Syndication Format [RFC4287] - * - * @see https://tools.ietf.org/rfc/rfc4685.txt - * @var string - */ - const THREAD = 'http://purl.org/syndication/thread/1.0'; - /** - * This namespace adds mechanisms to the Atom Syndication Format - * that publishers of Atom Feed and Entry documents can use to - * explicitly identify Atom entries that have been removed. - * - * @see https://tools.ietf.org/html/rfc6721 - * @var string - */ - const TOMB = 'http://purl.org/atompub/tombstones/1.0'; - /** - * This specification details a model for representing potential and completed activities - * using the JSON format. - * - * @see https://www.w3.org/ns/activitystreams - * @var string - */ - const ACTIVITY2 = 'https://www.w3.org/ns/activitystreams#'; - /** - * Atom Activities 1.0 - * - * This namespace presents an XML format that allows activities on social objects - * to be expressed within the Atom Syndication Format. - * - * @see http://activitystrea.ms/spec/1.0 - * @var string - */ - const ACTIVITY = 'http://activitystrea.ms/spec/1.0/'; - /** - * This namespace presents a base set of Object types and Verbs for use with Activity Streams. - * - * @see http://activitystrea.ms/head/activity-schema.html - * @var string - */ - const ACTIVITY_SCHEMA = 'http://activitystrea.ms/schema/1.0/'; - /** - * Atom Media Extensions - * - * @var string - */ - const MEDIA = 'http://purl.org/syndication/atommedia'; - /** - * The Salmon Protocol is an open, simple, standards-based solution that lets - * aggregators and sources unify the conversations. - * - * @see http://www.salmon-protocol.org/salmon-protocol-summary - * @var string - */ - const SALMON_ME = 'http://salmon-protocol.org/ns/magic-env'; - /** - * OStatus is a minimal specification for distributed status updates or microblogging. - * - * @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html - * @var string - */ - const OSTATUSSUB = 'http://ostatus.org/schema/1.0/subscribe'; - /** - * GeoRSS was designed as a lightweight, community driven way to extend existing feeds with geographic information. - * - * @see http://www.georss.org/ - * @var string - */ - const GEORSS = 'http://www.georss.org/georss'; - /** - * The Portable Contacts specification is designed to make it easier for developers - * to give their users a secure way to access the address books and friends lists - * they have built up all over the web. - * - * @see http://portablecontacts.net/draft-spec/ - * @var string - */ - const POCO = 'http://portablecontacts.net/spec/1.0'; - /** - * @var string - */ - const FEED = 'http://schemas.google.com/g/2010#updates-from'; - /** - * OStatus is a minimal specification for distributed status updates or microblogging. - * - * @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html - * @var string - */ - const OSTATUS = 'http://ostatus.org/schema/1.0'; - /** - * @var string - */ - const STATUSNET = 'http://status.net/schema/api/1/'; - /** - * This namespace describes the Atom Activity Streams in RDF Vocabulary (AAIR), - * defined as a dictionary of named properties and classes using W3C's RDF technology, - * and specifically a mapping of the Atom Activity Streams work to RDF. - * - * @see http://xmlns.notu.be/aair/#RFC4287 - * @var string - */ - const ATOM1 = 'http://www.w3.org/2005/Atom'; - /** - * @var string - */ - const MASTODON = 'http://mastodon.social/schema/1.0'; -} diff --git a/src/Protocol/Activity/ObjectType.php b/src/Protocol/Activity/ObjectType.php index 7bed40d87d..313378b3e9 100644 --- a/src/Protocol/Activity/ObjectType.php +++ b/src/Protocol/Activity/ObjectType.php @@ -2,6 +2,8 @@ namespace Friendica\Protocol\Activity; +use Friendica\Protocol\ActivityNamespace; + /** * This class contains the different object types in activities */ diff --git a/src/Protocol/ActivityNamespace.php b/src/Protocol/ActivityNamespace.php new file mode 100644 index 0000000000..c504f28339 --- /dev/null +++ b/src/Protocol/ActivityNamespace.php @@ -0,0 +1,132 @@ +<?php + +namespace Friendica\Protocol; + +/** + * Activity namespaces constants + */ +final class ActivityNamespace +{ + /** + * Zot is a WebMTA which provides a decentralised identity and communications protocol using HTTPS/JSON. + * + * @var string + * @see https://zotlabs.org/page/zotlabs/specs+zot6+home + */ + const ZOT = 'http://purl.org/zot'; + /** + * Friendica is using ActivityStreams in version 1.0 for its activities and object types. + * Additional types are used for non standard activities. + * + * @var string + * @see https://github.com/friendica/friendica/wiki/ActivityStreams + */ + const DFRN = 'http://purl.org/macgirvin/dfrn/1.0'; + /** + * This namespace defines an extension for expressing threaded + * discussions within the Atom Syndication Format [RFC4287] + * + * @see https://tools.ietf.org/rfc/rfc4685.txt + * @var string + */ + const THREAD = 'http://purl.org/syndication/thread/1.0'; + /** + * This namespace adds mechanisms to the Atom Syndication Format + * that publishers of Atom Feed and Entry documents can use to + * explicitly identify Atom entries that have been removed. + * + * @see https://tools.ietf.org/html/rfc6721 + * @var string + */ + const TOMB = 'http://purl.org/atompub/tombstones/1.0'; + /** + * This specification details a model for representing potential and completed activities + * using the JSON format. + * + * @see https://www.w3.org/ns/activitystreams + * @var string + */ + const ACTIVITY2 = 'https://www.w3.org/ns/activitystreams#'; + /** + * Atom Activities 1.0 + * + * This namespace presents an XML format that allows activities on social objects + * to be expressed within the Atom Syndication Format. + * + * @see http://activitystrea.ms/spec/1.0 + * @var string + */ + const ACTIVITY = 'http://activitystrea.ms/spec/1.0/'; + /** + * This namespace presents a base set of Object types and Verbs for use with Activity Streams. + * + * @see http://activitystrea.ms/head/activity-schema.html + * @var string + */ + const ACTIVITY_SCHEMA = 'http://activitystrea.ms/schema/1.0/'; + /** + * Atom Media Extensions + * + * @var string + */ + const MEDIA = 'http://purl.org/syndication/atommedia'; + /** + * The Salmon Protocol is an open, simple, standards-based solution that lets + * aggregators and sources unify the conversations. + * + * @see http://www.salmon-protocol.org/salmon-protocol-summary + * @var string + */ + const SALMON_ME = 'http://salmon-protocol.org/ns/magic-env'; + /** + * OStatus is a minimal specification for distributed status updates or microblogging. + * + * @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html + * @var string + */ + const OSTATUSSUB = 'http://ostatus.org/schema/1.0/subscribe'; + /** + * GeoRSS was designed as a lightweight, community driven way to extend existing feeds with geographic information. + * + * @see http://www.georss.org/ + * @var string + */ + const GEORSS = 'http://www.georss.org/georss'; + /** + * The Portable Contacts specification is designed to make it easier for developers + * to give their users a secure way to access the address books and friends lists + * they have built up all over the web. + * + * @see http://portablecontacts.net/draft-spec/ + * @var string + */ + const POCO = 'http://portablecontacts.net/spec/1.0'; + /** + * @var string + */ + const FEED = 'http://schemas.google.com/g/2010#updates-from'; + /** + * OStatus is a minimal specification for distributed status updates or microblogging. + * + * @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html + * @var string + */ + const OSTATUS = 'http://ostatus.org/schema/1.0'; + /** + * @var string + */ + const STATUSNET = 'http://status.net/schema/api/1/'; + /** + * This namespace describes the Atom Activity Streams in RDF Vocabulary (AAIR), + * defined as a dictionary of named properties and classes using W3C's RDF technology, + * and specifically a mapping of the Atom Activity Streams work to RDF. + * + * @see http://xmlns.notu.be/aair/#RFC4287 + * @var string + */ + const ATOM1 = 'http://www.w3.org/2005/Atom'; + /** + * @var string + */ + const MASTODON = 'http://mastodon.social/schema/1.0'; +} diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 6e84fdbb34..2016c7339d 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -32,7 +32,7 @@ use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Network\Probe; use Friendica\Object\Image; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 6fcfa36bdb..dc02366cb1 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -32,7 +32,7 @@ use Friendica\Model\Mail; use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Network\Probe; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 31f54e50c5..b7e7ce9201 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -14,7 +14,7 @@ use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Item; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Util\Network; use Friendica\Util\XML; diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 9a41920ae8..c88a740c0e 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -25,7 +25,7 @@ use Friendica\Model\Item; use Friendica\Model\User; use Friendica\Network\Probe; use Friendica\Object\Image; -use Friendica\Protocol\Activity\ActivityNamespace; +use Friendica\Protocol\ActivityNamespace; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\Proxy as ProxyUtils; @@ -1760,7 +1760,7 @@ class OStatus $entry = self::entryHeader($doc, $owner, $item, $toplevel); - $verb = Activity\ActivityNamespace::ACTIVITY_SCHEMA . "favorite"; + $verb = ActivityNamespace::ACTIVITY_SCHEMA . "favorite"; self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false); $parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]); diff --git a/tests/src/Protocol/ActivityTest.php b/tests/src/Protocol/ActivityTest.php index 5249ebefaf..a3e9c11487 100644 --- a/tests/src/Protocol/ActivityTest.php +++ b/tests/src/Protocol/ActivityTest.php @@ -3,6 +3,7 @@ namespace Friendica\Test\Protocol; use Friendica\Protocol\Activity; +use Friendica\Protocol\ActivityNamespace; use Friendica\Test\MockedTest; class ActivityTest extends MockedTest @@ -22,7 +23,7 @@ class ActivityTest extends MockedTest ], 'withNamespace' => [ 'haystack' => 'tagterm', - 'needle' => Activity\ActivityNamespace::ACTIVITY_SCHEMA . Activity\ObjectType::TAGTERM, + 'needle' => ActivityNamespace::ACTIVITY_SCHEMA . Activity\ObjectType::TAGTERM, 'assert' => true, ], 'invalidSimple' => [ @@ -37,7 +38,7 @@ class ActivityTest extends MockedTest ], 'withSubPath' => [ 'haystack' => 'tagterm', - 'needle' => Activity\ActivityNamespace::ACTIVITY_SCHEMA . '/bla/' . Activity\ObjectType::TAGTERM, + 'needle' => ActivityNamespace::ACTIVITY_SCHEMA . '/bla/' . Activity\ObjectType::TAGTERM, 'assert' => true, ], ];