Compare commits
No commits in common. "47b7d8410fb69be1a5145c8dfb36cff01d876ec2" and "2a7929719b775141e1435d71ac4cb9e46082a29a" have entirely different histories.
47b7d8410f
...
2a7929719b
5 changed files with 25 additions and 28 deletions
|
@ -65,7 +65,7 @@ class Activity_Dispatcher {
|
|||
return;
|
||||
}
|
||||
|
||||
$transformer = Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$transformer = \Activitypub\Transformer\Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$object = $transformer->to_object();
|
||||
|
||||
$activity = new Activity();
|
||||
|
@ -102,7 +102,7 @@ class Activity_Dispatcher {
|
|||
return;
|
||||
}
|
||||
|
||||
$transformer = Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$transformer = \Activitypub\Transformer\Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$object = $transformer->to_object();
|
||||
|
||||
$activity = new Activity();
|
||||
|
|
|
@ -34,8 +34,7 @@ class Post {
|
|||
_deprecated_function( __CLASS__, '1.0.0', '\Activitypub\Transformer\Post' );
|
||||
|
||||
$this->post = $post;
|
||||
$transformer = new Transformer_Post();
|
||||
$this->object = $transformer->set_wp_post( $post )->to_object();
|
||||
$this->object = Transformer_Post->set_wp_post( $post )->to_object();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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(), true );
|
||||
return in_array( $post_type, $this->get_supported_post_types() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,26 +163,6 @@ 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,5 +107,24 @@ 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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,8 +284,7 @@ class Transformers_Manager {
|
|||
$post_type = get_post_type( $object );
|
||||
$transformer_mapping = \get_option( 'activitypub_transformer_mapping', self::DEFAULT_TRANSFORMER_MAPPING );
|
||||
$transformer_name = $transformer_mapping[ $post_type ];
|
||||
$transformer_class = $this->get_transformers( $transformer_name );
|
||||
$transformer_instance = new $transformer_class();
|
||||
$transformer_instance = new ( $this->get_transformers( $transformer_name ) );
|
||||
$transformer_instance->set_wp_post( $object );
|
||||
return $transformer_instance;
|
||||
case 'WP_Comment':
|
||||
|
|
Loading…
Reference in a new issue