updated plugin ActivityPub
version 5.8.0
This commit is contained in:
@ -21,6 +21,18 @@ use Activitypub\Collection\Followers;
|
||||
* @author Matthias Pfefferle
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitypub/#follow-activity-inbox
|
||||
*
|
||||
* @method int get__id() Gets the post ID of the follower record.
|
||||
* @method string[]|null get_image() Gets the follower's profile image data.
|
||||
* @method string|null get_inbox() Gets the follower's ActivityPub inbox URL.
|
||||
* @method string[]|null get_endpoints() Gets the follower's ActivityPub endpoints.
|
||||
*
|
||||
* @method Follower set__id( int $id ) Sets the post ID of the follower record.
|
||||
* @method Follower set_id( string $guid ) Sets the follower's GUID.
|
||||
* @method Follower set_name( string $name ) Sets the follower's display name.
|
||||
* @method Follower set_summary( string $summary ) Sets the follower's bio/summary.
|
||||
* @method Follower set_published( string $datetime ) Sets the follower's published datetime in ISO 8601 format.
|
||||
* @method Follower set_updated( string $datetime ) Sets the follower's last updated datetime in ISO 8601 format.
|
||||
*/
|
||||
class Follower extends Actor {
|
||||
/**
|
||||
@ -36,7 +48,7 @@ class Follower extends Actor {
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_errors() {
|
||||
return get_post_meta( $this->_id, 'activitypub_errors', false );
|
||||
return get_post_meta( $this->_id, '_activitypub_errors', false );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +84,7 @@ class Follower extends Actor {
|
||||
* Reset (delete) all errors.
|
||||
*/
|
||||
public function reset_errors() {
|
||||
delete_post_meta( $this->_id, 'activitypub_errors' );
|
||||
delete_post_meta( $this->_id, '_activitypub_errors' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,9 +228,9 @@ class Follower extends Actor {
|
||||
* Update the post meta.
|
||||
*/
|
||||
protected function get_post_meta_input() {
|
||||
$meta_input = array();
|
||||
$meta_input['activitypub_inbox'] = $this->get_shared_inbox();
|
||||
$meta_input['activitypub_actor_json'] = $this->to_json();
|
||||
$meta_input = array();
|
||||
$meta_input['_activitypub_inbox'] = $this->get_shared_inbox();
|
||||
$meta_input['_activitypub_actor_json'] = wp_slash( $this->to_json() );
|
||||
|
||||
return $meta_input;
|
||||
}
|
||||
@ -228,7 +240,7 @@ class Follower extends Actor {
|
||||
*
|
||||
* Sets a fallback to better handle API and HTML outputs.
|
||||
*
|
||||
* @return array The icon.
|
||||
* @return string[] The icon.
|
||||
*/
|
||||
public function get_icon() {
|
||||
if ( isset( $this->icon['url'] ) ) {
|
||||
@ -331,11 +343,18 @@ class Follower extends Actor {
|
||||
* Convert a Custom-Post-Type input to an Activitypub\Model\Follower.
|
||||
*
|
||||
* @param \WP_Post $post The post object.
|
||||
* @return \Activitypub\Activity\Base_Object|WP_Error
|
||||
* @return Follower|false The Follower object or false on failure.
|
||||
*/
|
||||
public static function init_from_cpt( $post ) {
|
||||
$actor_json = get_post_meta( $post->ID, 'activitypub_actor_json', true );
|
||||
$object = self::init_from_json( $actor_json );
|
||||
$actor_json = get_post_meta( $post->ID, '_activitypub_actor_json', true );
|
||||
|
||||
/* @var Follower $object Follower object. */
|
||||
$object = self::init_from_json( $actor_json );
|
||||
|
||||
if ( is_wp_error( $object ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$object->set__id( $post->ID );
|
||||
$object->set_id( $post->guid );
|
||||
$object->set_name( $post->post_title );
|
||||
|
Reference in New Issue
Block a user