fix creation of new transformer instance
This commit is contained in:
parent
2a7929719b
commit
81f971b477
3 changed files with 7 additions and 5 deletions
|
@ -65,7 +65,7 @@ class Activity_Dispatcher {
|
|||
return;
|
||||
}
|
||||
|
||||
$transformer = \Activitypub\Transformer\Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$transformer = Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$object = $transformer->to_object();
|
||||
|
||||
$activity = new Activity();
|
||||
|
@ -102,7 +102,7 @@ class Activity_Dispatcher {
|
|||
return;
|
||||
}
|
||||
|
||||
$transformer = \Activitypub\Transformer\Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$transformer = Transformers_Manager::instance()->get_transformer( $wp_post );
|
||||
$object = $transformer->to_object();
|
||||
|
||||
$activity = new Activity();
|
||||
|
|
|
@ -33,8 +33,9 @@ class Post {
|
|||
public function __construct( $post, $post_author = null ) {
|
||||
_deprecated_function( __CLASS__, '1.0.0', '\Activitypub\Transformer\Post' );
|
||||
|
||||
$this->post = $post;
|
||||
$this->object = Transformer_Post->set_wp_post( $post )->to_object();
|
||||
$this->post = $post;
|
||||
$transformer = new Transformer_Post();
|
||||
$this->object = $transformer->set_wp_post( $post )->to_object();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -284,7 +284,8 @@ 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_instance = new ( $this->get_transformers( $transformer_name ) );
|
||||
$transformer_class = $this->get_transformers( $transformer_name );
|
||||
$transformer_instance = new $transformer_class();
|
||||
$transformer_instance->set_wp_post( $object );
|
||||
return $transformer_instance;
|
||||
case 'WP_Comment':
|
||||
|
|
Loading…
Reference in a new issue