workaround for special chars
This commit is contained in:
parent
be26a18214
commit
686dbd0f9f
2 changed files with 19 additions and 3 deletions
|
@ -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