move transofmrer function get_post_content_template to base class
fix: make in_array comparison strict
This commit is contained in:
parent
9c20c8fced
commit
768d190be0
2 changed files with 21 additions and 20 deletions
|
@ -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.
|
||||
|
|
|
@ -107,24 +107,5 @@ class Post extends Base {
|
|||
return $object_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue