updated plugin ActivityPub version 2.6.1

This commit is contained in:
2024-07-19 19:46:05 +00:00
committed by Gitium
parent 19e351ef3b
commit 3b4e169a1e
39 changed files with 718 additions and 143 deletions

View File

@ -101,6 +101,9 @@ class Post extends Base {
if ( 'trash' === get_post_status( $post ) ) {
$permalink = \get_post_meta( $post->ID, 'activitypub_canonical_url', true );
} elseif ( 'draft' === get_post_status( $post ) && get_sample_permalink( $post->ID ) ) {
$sample = get_sample_permalink( $post->ID );
$permalink = str_replace( array( '%pagename%', '%postname%' ), $sample[1], $sample[0] );
} else {
$permalink = \get_permalink( $post );
}
@ -137,6 +140,11 @@ class Post extends Base {
* @return array The Attachments.
*/
protected function get_attachment() {
// Remove attachments from drafts.
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
return array();
}
// Once upon a time we only supported images, but we now support audio/video as well.
// We maintain the image-centric naming for backwards compatibility.
$max_media = \intval(
@ -692,6 +700,11 @@ class Post extends Base {
return null;
}
// Remove Teaser from drafts.
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
return \__( '(This post is being modified)', 'activitypub' );
}
$content = \get_post_field( 'post_content', $this->wp_object->ID );
$content = \html_entity_decode( $content );
$content = \wp_strip_all_tags( $content );
@ -746,6 +759,11 @@ class Post extends Base {
* @return string The content.
*/
protected function get_content() {
// Remove Content from drafts.
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
return \__( '(This post is being modified)', 'activitypub' );
}
global $post;
/**