adding todo's and reformatting
Some checks failed
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Failing after 7s

This commit is contained in:
ruru4143 2023-12-11 19:42:30 +01:00
parent da059c0d70
commit f61ccd7a18

View file

@ -16,9 +16,9 @@ require_once __DIR__ . '/class-place.php';
* *
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
*/ */
class Event extends \Activitypub\Activity\Base_Object { class Event extends \Activitypub\Activity\Base_Object { // todo maybe rename to mobilizon event?
const REPLIES_MODERATION_OPTION_TYPES = [ 'allow_all', 'closed']; const REPLIES_MODERATION_OPTION_TYPES = [ 'allow_all', 'closed' ];
const JOIN_MODE_TYPES = [ 'free', 'restricted', 'external']; const JOIN_MODE_TYPES = [ 'free', 'restricted', 'external' ]; // amd 'invite', but not used by mobilizon atm
/** /**
* Event is an implementation of one of the * Event is an implementation of one of the
@ -55,7 +55,7 @@ class Event extends \Activitypub\Activity\Base_Object {
/** /**
* @context https://joinmobilizon.org/ns#anonymousParticipationEnabled * @context https://joinmobilizon.org/ns#anonymousParticipationEnabled
* @see https://docs.joinmobilizon.org/contribute/activity_pub/#anonymousparticipationenabled * @see https://docs.joinmobilizon.org/contribute/activity_pub/#anonymousparticipationenabled
* @var bool * @var bool
*/ */
protected $anonymous_participation_enabled; protected $anonymous_participation_enabled;
@ -159,9 +159,9 @@ class Event extends \Activitypub\Activity\Base_Object {
public static function get_context() { public static function get_context() {
$class = self::class; $class = self::class;
$transient = "activitypub_json_context_object_{$class}"; $transient = "activitypub_json_context_object_{$class}";
$context = get_transient($transient); $context = get_transient( $transient );
// if ( $context ) { // if ( $context ) {
// return $context; // return $context;
// } // }
$reflection_class = new ReflectionClass( self::class ); $reflection_class = new ReflectionClass( self::class );
$context = array( $context = array(
@ -177,7 +177,7 @@ class Event extends \Activitypub\Activity\Base_Object {
// Extract context information from the doc comment. // Extract context information from the doc comment.
preg_match( '/@context\s+([^\s]+)/', $doc_omment, $matches ); preg_match( '/@context\s+([^\s]+)/', $doc_omment, $matches );
if ( !empty( $matches[1] ) ) { if ( ! empty( $matches[1] ) ) {
$key_context[ snake_to_camel_case( $property->name ) ] = $matches[1]; $key_context[ snake_to_camel_case( $property->name ) ] = $matches[1];
} }
} }
@ -196,7 +196,7 @@ class Event extends \Activitypub\Activity\Base_Object {
$context[] = $key_context; $context[] = $key_context;
set_transient( $transient, $context ); set_transient( $transient, $context );
return $context; return $context;
} }