From 8338ea457042089ff0a6e62abc995381df0c7138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 25 Nov 2023 10:27:11 +0100 Subject: [PATCH] fix: make in_array comparison strict --- includes/transformer/class-base.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/includes/transformer/class-base.php b/includes/transformer/class-base.php index 27f4a67..14feed2 100644 --- a/includes/transformer/class-base.php +++ b/includes/transformer/class-base.php @@ -93,7 +93,7 @@ abstract class Base { * @return string post_type Post type name. */ final public function supports_post_type( $post_type ) { - return in_array( $post_type, $this->get_supported_post_types() ); + return in_array( $post_type, $this->get_supported_post_types(), true ); } /** @@ -163,6 +163,26 @@ abstract class Base { return $content; } + /** + * Gets the template to use to generate the content of the activitypub item. + * + * @return string The Template. + */ + protected function get_post_content_template() { + if ( 'excerpt' === \get_option( 'activitypub_post_content_type', 'content' ) ) { + return "[ap_excerpt]\n\n[ap_permalink type=\"html\"]"; + } + + if ( 'title' === \get_option( 'activitypub_post_content_type', 'content' ) ) { + return "[ap_title]\n\n[ap_permalink type=\"html\"]"; + } + + if ( 'content' === \get_option( 'activitypub_post_content_type', 'content' ) ) { + return "[ap_content]\n\n[ap_permalink type=\"html\"]\n\n[ap_hashtags]"; + } + + return \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); + } /** * Returns the ID of the Post.