_Posts_Controller( $this->get_post_type() ); $formatted_posts = []; foreach ( $posts as $post ) { if ( ! $rest_controller->check_read_permission( $post ) ) { continue; } $formatted_posts[] = $this->get_formatted_entity( $post ); } return $formatted_posts; } /** * Formats a post into a post entity. * * @since 6.9.0 * * @param WP_Post $post The post to format. * * @return array */ public function get_formatted_entity( WP_Post $post ): array { $rest_controller = new WP_REST_Posts_Controller( $this->get_post_type() ); $request = $this->get_request(); $data = $rest_controller->prepare_item_for_response( $post, $request ); return $this->transform_entity( $this->add_properties_to_model( $rest_controller->prepare_response_for_collection( $data ), $post ) ); } /** * Adds properties to the model. * * @since 6.9.0 * * @param array $formatted_post The formatted post. * @param WP_Post $original_post The original post. * * @return array The response with the properties added. */ protected function add_properties_to_model( array $formatted_post, WP_Post $original_post ): array { $properties_to_add = $this->get_model_class()::get_properties_to_add(); $data = array_merge( (array) $formatted_post, array_intersect_key( (array) $original_post, $properties_to_add ) ); $data['link'] = $data['permalink'] ?? $data['link']; unset( $data['permalink'], $data['meta'], $data['_links'] ); return $data; } /** * Validates the status parameter. * * @since 6.9.0 * * @param mixed $value The value to validate. * * @return bool Whether the value is valid. */ public function validate_status( $value ): bool { $value = is_string( $value ) ? explode( ',', $value ) : $value; if ( ! is_array( $value ) ) { return false; } $invalid_statuses = array_diff( $value, self::ALLOWED_STATUS ); if ( ! empty( $invalid_statuses ) ) { return false; } return true; } /** * Transforms the entity. * * @since 6.9.0 * * @param array $entity The entity to transform. * * @return array */ protected function transform_entity( array $entity ): array { $post_type = $this->get_post_type(); /** * Filter to allow modification of the entity data for a specific post type. * The dynamic portion of the hook name, `$post_type`, refers to the post type slug. * * @since 6.9.0 * * @param array $entity The entity data. * @param Post_Entity_Endpoint $this The endpoint instance. */ $entity = apply_filters( "tec_rest_v1_{$post_type}_transform_entity", $entity, $this ); /** * Filter to allow modification of the entity data globally for all post types. * * @since 6.9.0 * * @param array $entity The entity data. * @param string $post_type The post type being transformed. * @param Post_Entity_Endpoint $this The endpoint instance. */ $entity = apply_filters( 'tec_rest_v1_post_entity_transform', $entity, $post_type, $this ); return $entity; } }
Fatal error: Uncaught Error: Class "TEC\Common\REST\TEC\V1\Abstracts\Post_Entity_Endpoint" not found in /htdocs/wp-content/plugins/the-events-calendar/src/Events/REST/TEC/V1/Endpoints/Events.php:49 Stack trace: #0 /htdocs/wp-content/plugins/fluent-smtp/vendor/composer/ClassLoader.php(576): include() #1 /htdocs/wp-content/plugins/fluent-smtp/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/htdocs/wp-cont...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('TEC\\Events\\REST...') #3 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Builders/Factory.php(62): class_exists('TEC\\Events\\REST...') #4 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(150): TEC\Common\lucatume\DI52\Builders\Factory->getBuilder('TEC\\Events\\REST...', 'TEC\\Events\\REST...', NULL) #5 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/REST/TEC/V1/Abstracts/Endpoints_Controller.php(39): TEC\Common\lucatume\DI52\Container->singleton('TEC\\Events\\REST...') #6 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Provider/Controller.php(49): TEC\Common\REST\TEC\V1\Abstracts\Endpoints_Controller->do_register() #7 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(427): TEC\Common\Contracts\Provider\Controller->register() #8 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php(63): TEC\Common\lucatume\DI52\Container->register('TEC\\Events\\REST...') #9 /htdocs/wp-content/plugins/the-events-calendar/src/Events/REST/TEC/V1/Controller.php(32): TEC\Common\Contracts\Container->register('TEC\\Events\\REST...') #10 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Provider/Controller.php(49): TEC\Events\REST\TEC\V1\Controller->do_register() #11 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(427): TEC\Common\Contracts\Provider\Controller->register() #12 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php(63): TEC\Common\lucatume\DI52\Container->register('TEC\\Events\\REST...') #13 /htdocs/wp-content/plugins/the-events-calendar/src/Events/REST/Controller.php(34): TEC\Common\Contracts\Container->register('TEC\\Events\\REST...') #14 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Provider/Controller.php(49): TEC\Events\REST\Controller->do_register() #15 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(427): TEC\Common\Contracts\Provider\Controller->register() #16 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php(63): TEC\Common\lucatume\DI52\Container->register('TEC\\Events\\REST...') #17 /htdocs/wp-content/plugins/the-events-calendar/src/Events/Controller.php(102): TEC\Common\Contracts\Container->register('TEC\\Events\\REST...') #18 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Provider/Controller.php(49): TEC\Events\Controller->do_register() #19 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(427): TEC\Common\Contracts\Provider\Controller->register() #20 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php(63): TEC\Common\lucatume\DI52\Container->register('TEC\\Events\\Cont...') #21 /htdocs/wp-content/plugins/the-events-calendar/common/src/Tribe/Container.php(306): TEC\Common\Contracts\Container->register('TEC\\Events\\Cont...') #22 /htdocs/wp-content/plugins/the-events-calendar/src/Tribe/Main.php(705): tribe_register_provider('TEC\\Events\\Cont...') #23 /htdocs/wp-content/plugins/the-events-calendar/src/Tribe/Main.php(552): Tribe__Events__Main->bind_implementations() #24 /htdocs/wp-includes/class-wp-hook.php(341): Tribe__Events__Main->bootstrap('') #25 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters('', Array) #26 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #27 /htdocs/wp-content/plugins/the-events-calendar/common/src/Tribe/Main.php(131): do_action('tribe_common_lo...') #28 /htdocs/wp-includes/class-wp-hook.php(341): Tribe__Main->plugins_loaded('') #29 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #30 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #31 /htdocs/wp-settings.php(593): do_action('plugins_loaded') #32 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #33 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #34 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #35 /htdocs/index.php(17): require('/htdocs/wp-blog...') #36 {main} thrown in /htdocs/wp-content/plugins/the-events-calendar/src/Events/REST/TEC/V1/Endpoints/Events.php on line 49