@@ -43,7 +43,7 @@ public function to_array() {
4343 }
4444
4545 public function to_json () {
46- return wp_json_encode ( $ this ->to_array (), JSON_UNESCAPED_UNICODE );
46+ return wp_json_encode ( $ this ->to_array (), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_QUOT );
4747 }
4848
4949 public function get_attachments () {
@@ -262,9 +262,9 @@ public function get_the_post_content( $with_link = true ) {
262262
263263 $ decoded_content = html_entity_decode ( $ filtered_content , ENT_QUOTES , 'UTF-8 ' );
264264
265- $ allowed_html = apply_filters ( 'activitypub_allowed_html ' , '<a> ' );
265+ $ allowed_html = apply_filters ( 'activitypub_allowed_html ' , '<a><p> ' );
266266
267- return trim ( preg_replace ( '/[\r\n]{2,}/ ' , "\n\n" , strip_tags ( $ decoded_content , $ allowed_html ) ) );
267+ return trim ( preg_replace ( '/[\r\n]{2,}/ ' , '' , strip_tags ( $ decoded_content , $ allowed_html ) ) );
268268 }
269269
270270 /**
@@ -282,9 +282,9 @@ public function get_the_post_summary( $summary_length = 400 ) {
282282
283283 $ decoded_summary = html_entity_decode ( $ filtered_summary , ENT_QUOTES , 'UTF-8 ' );
284284
285- $ allowed_html = apply_filters ( 'activitypub_allowed_html ' , '<a> ' );
285+ $ allowed_html = apply_filters ( 'activitypub_allowed_html ' , '<a><p> ' );
286286
287- return trim ( preg_replace ( '/[\r\n]{2,}/ ' , "\n\n" , strip_tags ( $ decoded_summary , $ allowed_html ) ) );
287+ return trim ( preg_replace ( '/[\r\n]{2,}/ ' , '' , strip_tags ( $ decoded_summary , $ allowed_html ) ) );
288288 }
289289
290290 public static function add_backlink ( $ content , $ post ) {
@@ -296,6 +296,6 @@ public static function add_backlink( $content, $post ) {
296296 $ link = esc_url ( get_permalink ( $ post ->ID ) );
297297 }
298298
299- return $ content . "\n\n" . ' < a href=" ' . $ link . '"> ' . $ link . '</a> ' ;
299+ return $ content . ' <p>< a href=" ' . $ link . '"> ' . $ link . '</a></p > ' ;
300300 }
301301}
0 commit comments