Skip to content

Commit

Permalink
fix ActivityPub @context (Automattic#682)
Browse files Browse the repository at this point in the history
The `call_user_func` version seem to not work properly in this case.

/cc @Menrath
  • Loading branch information
pfefferle authored Jan 31, 2024
1 parent c3c987a commit 484cc56
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions includes/activity/class-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ public function set_object( $object ) {
*/
public function get_json_ld_context() {
if ( $this->object instanceof Base_Object ) {
// Without php 5.6 support this could be just: 'return $this->object::JSON_LD_CONTEXT;'
return call_user_func( array( get_class( $this->object ), 'CONTEXT' ) );
} else {
return self::JSON_LD_CONTEXT;
$class = get_class( $this->object );
if ( $class && $class::JSON_LD_CONTEXT ) {
// Without php 5.6 support this could be just: 'return $this->object::JSON_LD_CONTEXT;'
return $class::JSON_LD_CONTEXT;
}
}

return static::JSON_LD_CONTEXT;
}
}

0 comments on commit 484cc56

Please sign in to comment.