mirror of
https://github.com/Automattic/wordpress-activitypub
synced 2024-10-18 14:23:31 +00:00
update readme.md
This commit is contained in:
parent
7f2e3754c9
commit
7baa93ce3a
2 changed files with 6 additions and 137 deletions
|
@ -135,7 +135,12 @@ For reasons of data protection, it is not possible to see the followers of other
|
|||
|
||||
### 2.7.0 ###
|
||||
|
||||
*
|
||||
* Added: "Reply Context" suppot, you can now reply to posts on the Fediverse through a WordPress post
|
||||
* Added: Bookmarklet to automatically pre-fill the "Reply Context" block
|
||||
* Added: "Header Image" support and ability to edit other profile informations for Authors and the Blog-User
|
||||
* Added: ActivityPub link HTML/HTTP-Header support
|
||||
* Added: Tag support for Actors (only auto generated for now)
|
||||
* Improved: Add setting to enable/disable the `fediverse:creator` OGP tag
|
||||
|
||||
### 2.6.1 ###
|
||||
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
<?php
|
||||
namespace Activitypub\Model;
|
||||
|
||||
use Activitypub\Collection\Users;
|
||||
use Activitypub\Transformer\Factory;
|
||||
|
||||
/**
|
||||
* ActivityPub Post Class
|
||||
*
|
||||
* @author Matthias Pfefferle
|
||||
*/
|
||||
class Post {
|
||||
/**
|
||||
* The \Activitypub\Activity\Base_Object object.
|
||||
*
|
||||
* @var \Activitypub\Activity\Base_Object
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* The WordPress Post Object.
|
||||
*
|
||||
* @var WP_Post
|
||||
*/
|
||||
private $post;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param WP_Post $post
|
||||
* @param int $post_author
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
public function __construct( $post, $post_author = null ) {
|
||||
_deprecated_function( __METHOD__, '1.0.0', '\Activitypub\Transformer\Factory::get_transformer' );
|
||||
|
||||
$transformer = Factory::get_transformer( $post );
|
||||
|
||||
if ( ! \is_wp_error( $transformer ) ) {
|
||||
$this->post = $post;
|
||||
$this->object = $transformer->to_object();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the User ID.
|
||||
*
|
||||
* @return int the User ID.
|
||||
*/
|
||||
public function get_user_id() {
|
||||
return apply_filters( 'activitypub_post_user_id', $this->post->post_author, $this->post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this Object into an Array.
|
||||
*
|
||||
* @return array the array representation of a Post.
|
||||
*/
|
||||
public function to_array() {
|
||||
return \apply_filters( 'activitypub_post', $this->object->to_array(), $this->post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Actor of this Object.
|
||||
*
|
||||
* @return string The URL of the Actor.
|
||||
*/
|
||||
public function get_actor() {
|
||||
$user = Users::get_by_id( $this->get_user_id() );
|
||||
|
||||
return $user->get_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this Object into a JSON String
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function to_json() {
|
||||
return \wp_json_encode( $this->to_array(), \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL of an Activity Object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_url() {
|
||||
return $this->object->get_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of an Activity Object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_id() {
|
||||
return $this->object->get_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Image Attachments
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_attachments() {
|
||||
return $this->object->get_attachment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Tags, used in the Post
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_tags() {
|
||||
return $this->object->get_tag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the as2 object-type for a given post
|
||||
*
|
||||
* @return string the object-type
|
||||
*/
|
||||
public function get_object_type() {
|
||||
return $this->object->get_type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content for the ActivityPub Item.
|
||||
*
|
||||
* @return string the content
|
||||
*/
|
||||
public function get_content() {
|
||||
return $this->object->get_content();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue