Compare commits

...

2 commits

Author SHA1 Message Date
Matthias Pfefferle
fbffb66b58 fix readme 2023-07-27 21:42:25 +02:00
Matthias Pfefferle
686dbd0f9f workaround for special chars 2023-07-27 19:27:01 +02:00
3 changed files with 27 additions and 11 deletions

View file

@ -1,12 +1,12 @@
# 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/)
**Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 4.7
**Tested up to:** 6.3
**Stable tag:** 1.0.0
**Requires PHP:** 5.6
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
**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
**Requires at least:** 4.7
**Tested up to:** 6.3
**Stable tag:** 1.0.0
**Requires PHP:** 5.6
**License:** 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.

View file

@ -33,6 +33,19 @@ class Follower extends Actor {
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.
*
@ -122,11 +135,11 @@ class Follower extends Actor {
$args = array(
'ID' => $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_type' => Followers::POST_TYPE,
'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',
'meta_input' => $this->get_post_meta_input(),
);
@ -266,6 +279,8 @@ class Follower extends Actor {
$object = self::init_from_json( $actor_json );
$object->set__id( $post->ID );
$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_updated( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) ) );

View file

@ -40,7 +40,7 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
'id' => 'https://user2.example.com',
'url' => 'https://user2.example.com',
'inbox' => 'https://user2.example.com/inbox',
'name' => 'user2',
'name' => 'úser2',
'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' );
$this->assertEquals( 'https://user2.example.com', $follower2->get_url() );
$this->assertEquals( 'úser2', $follower2->get_name() );
}
public function test_delete_follower() {