Compare commits
2 commits
main
...
fix/specia
Author | SHA1 | Date | |
---|---|---|---|
|
fbffb66b58 | ||
|
686dbd0f9f |
3 changed files with 27 additions and 11 deletions
16
README.md
16
README.md
|
@ -1,12 +1,12 @@
|
||||||
# ActivityPub #
|
# ActivityPub #
|
||||||
**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/)
|
**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/)
|
||||||
**Tags:** OStatus, fediverse, activitypub, activitystream
|
**Tags:** OStatus, fediverse, activitypub, activitystream
|
||||||
**Requires at least:** 4.7
|
**Requires at least:** 4.7
|
||||||
**Tested up to:** 6.3
|
**Tested up to:** 6.3
|
||||||
**Stable tag:** 1.0.0
|
**Stable tag:** 1.0.0
|
||||||
**Requires PHP:** 5.6
|
**Requires PHP:** 5.6
|
||||||
**License:** MIT
|
**License:** MIT
|
||||||
**License URI:** http://opensource.org/licenses/MIT
|
**License URI:** http://opensource.org/licenses/MIT
|
||||||
|
|
||||||
The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,19 @@ class Follower extends Actor {
|
||||||
return get_post_meta( $this->_id, 'activitypub_errors' );
|
return get_post_meta( $this->_id, 'activitypub_errors' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Summary.
|
||||||
|
*
|
||||||
|
* @return int The Summary.
|
||||||
|
*/
|
||||||
|
public function get_summary() {
|
||||||
|
if ( isset( $this->summary ) ) {
|
||||||
|
return $this->summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for URL attribute.
|
* Getter for URL attribute.
|
||||||
*
|
*
|
||||||
|
@ -122,11 +135,11 @@ class Follower extends Actor {
|
||||||
$args = array(
|
$args = array(
|
||||||
'ID' => $this->get__id(),
|
'ID' => $this->get__id(),
|
||||||
'guid' => esc_url_raw( $this->get_id() ),
|
'guid' => esc_url_raw( $this->get_id() ),
|
||||||
'post_title' => esc_html( $this->get_name() ),
|
'post_title' => wp_strip_all_tags( sanitize_text_field( $this->get_name() ) ),
|
||||||
'post_author' => 0,
|
'post_author' => 0,
|
||||||
'post_type' => Followers::POST_TYPE,
|
'post_type' => Followers::POST_TYPE,
|
||||||
'post_name' => esc_url_raw( $this->get_id() ),
|
'post_name' => esc_url_raw( $this->get_id() ),
|
||||||
'post_excerpt' => $this->get_summary() ? esc_html( $this->get_summary() ) : '',
|
'post_excerpt' => sanitize_text_field( wp_kses( $this->get_summary(), 'user_description' ) ),
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'meta_input' => $this->get_post_meta_input(),
|
'meta_input' => $this->get_post_meta_input(),
|
||||||
);
|
);
|
||||||
|
@ -266,6 +279,8 @@ class Follower extends Actor {
|
||||||
$object = self::init_from_json( $actor_json );
|
$object = self::init_from_json( $actor_json );
|
||||||
$object->set__id( $post->ID );
|
$object->set__id( $post->ID );
|
||||||
$object->set_id( $post->guid );
|
$object->set_id( $post->guid );
|
||||||
|
$object->set_name( $post->post_title );
|
||||||
|
$object->set_summary( $post->post_excerpt );
|
||||||
$object->set_published( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_published ) ) );
|
$object->set_published( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_published ) ) );
|
||||||
$object->set_updated( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) ) );
|
$object->set_updated( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) ) );
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
|
||||||
'id' => 'https://user2.example.com',
|
'id' => 'https://user2.example.com',
|
||||||
'url' => 'https://user2.example.com',
|
'url' => 'https://user2.example.com',
|
||||||
'inbox' => 'https://user2.example.com/inbox',
|
'inbox' => 'https://user2.example.com/inbox',
|
||||||
'name' => 'user2',
|
'name' => 'úser2',
|
||||||
'preferredUsername' => 'user2',
|
'preferredUsername' => 'user2',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -126,6 +126,7 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
|
||||||
|
|
||||||
$follower2 = \Activitypub\Collection\Followers::get_follower( 2, 'https://user2.example.com' );
|
$follower2 = \Activitypub\Collection\Followers::get_follower( 2, 'https://user2.example.com' );
|
||||||
$this->assertEquals( 'https://user2.example.com', $follower2->get_url() );
|
$this->assertEquals( 'https://user2.example.com', $follower2->get_url() );
|
||||||
|
$this->assertEquals( 'úser2', $follower2->get_name() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_delete_follower() {
|
public function test_delete_follower() {
|
||||||
|
|
Loading…
Reference in a new issue