updated plugin ActivityPub
version 0.12.0
This commit is contained in:
@ -47,15 +47,31 @@ class Activity {
|
||||
|
||||
public function from_post( $object ) {
|
||||
$this->object = $object;
|
||||
$this->published = $object['published'];
|
||||
$this->actor = $object['attributedTo'];
|
||||
$this->id = $object['id'];
|
||||
if ( isset( $object['published'] ) ) {
|
||||
$this->published = $object['published'];
|
||||
}
|
||||
|
||||
if ( isset( $object['attributedTo'] ) ) {
|
||||
$this->actor = $object['attributedTo'];
|
||||
}
|
||||
|
||||
if ( isset( $object['id'] ) ) {
|
||||
$this->id = $object['id'];
|
||||
}
|
||||
}
|
||||
|
||||
public function from_comment( $object ) {
|
||||
|
||||
}
|
||||
|
||||
public function to_comment() {
|
||||
|
||||
}
|
||||
|
||||
public function from_remote_array( $array ) {
|
||||
|
||||
}
|
||||
|
||||
public function to_array() {
|
||||
$array = \get_object_vars( $this );
|
||||
|
||||
@ -68,8 +84,13 @@ class Activity {
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to JSON
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
return \wp_json_encode( $this->to_array(), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_QUOT );
|
||||
return \wp_json_encode( $this->to_array(), \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT );
|
||||
}
|
||||
|
||||
public function to_simple_array() {
|
||||
@ -90,6 +111,6 @@ class Activity {
|
||||
}
|
||||
|
||||
public function to_simple_json() {
|
||||
return \wp_json_encode( $this->to_simple_array(), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_QUOT );
|
||||
return \wp_json_encode( $this->to_simple_array(), \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user