n' => __( 'Timestamp of the share.', 'jetpack-publicize-pkg' ), 'type' => 'integer', ), 'service' => array( 'description' => __( 'The service to which it was shared.', 'jetpack-publicize-pkg' ), 'type' => 'string', ), 'connection_id' => array( 'description' => __( 'Connection ID for the share.', 'jetpack-publicize-pkg' ), 'type' => 'integer', ), 'external_id' => array( 'description' => __( 'External ID of the shared post.', 'jetpack-publicize-pkg' ), 'type' => 'string', ), 'external_name' => array( 'description' => __( 'External name of the shared post.', 'jetpack-publicize-pkg' ), 'type' => 'string', ), 'profile_picture' => array( 'description' => __( 'Profile picture URL of the account sharing.', 'jetpack-publicize-pkg' ), 'type' => 'string', ), 'profile_link' => array( 'description' => __( 'Profile link of the sharing account.', 'jetpack-publicize-pkg' ), 'type' => 'string', ), 'wpcom_user_id' => array( 'type' => 'integer', 'description' => __( 'wordpress.com ID of the user the connection belongs to.', 'jetpack-publicize-pkg' ), ), ); } /** * Schema for the endpoint. * * @return array */ public function get_item_schema() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'jetpack-social-share-status', 'type' => 'object', 'properties' => array( 'shares' => array( 'description' => __( 'List of shares.', 'jetpack-publicize-pkg' ), 'type' => 'array', 'items' => array( 'type' => 'object', 'properties' => $this->get_share_item_schema(), ), ), 'done' => array( 'description' => __( 'Indicates if the process is completed.', 'jetpack-publicize-pkg' ), 'type' => 'boolean', ), ), ); return $this->add_additional_fields_schema( $schema ); } /** * Receive share status from WPCOM. * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error */ public function receive_share_status( $request ) { $post_id = $request->get_param( 'post_id' ); $post = get_post( $post_id ); if ( empty( $post ) ) { return new WP_Error( 'post_not_found', __( 'Cannot find that post.', 'jetpack-publicize-pkg' ), array( 'status' => 404 ) ); } if ( 'publish' !== $post->post_status ) { return new WP_Error( 'post_not_published', __( 'Cannot update share status for an unpublished post.', 'jetpack-publicize-pkg' ), array( 'status' => 400 ) ); } $shares = $request->get_param( 'shares' ); // This check ensures that the shares data is in the expected format. if ( ! empty( $shares ) && empty( $shares[0]['status'] ) ) { return new WP_Error( 'invalid_shares', __( 'Invalid shares data.', 'jetpack-publicize-pkg' ), array( 'status' => 400 ) ); } update_post_meta( $post_id, Share_Status::SHARES_META_KEY, $shares ); $urls = array(); foreach ( $shares as $share ) { if ( isset( $share['status'] ) && 'success' === $share['status'] ) { $urls[] = array( 'url' => $share['message'], 'service' => $share['service'], ); } } /** * Fires after Publicize Shares post meta has been saved. * * @param array $urls { * An array of social media shares. * @type array $url URL to the social media post. * @type string $service Social media service shared to. * } */ do_action( 'jetpack_publicize_share_urls_saved', $urls ); return rest_ensure_response( new WP_REST_Response() ); } }
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Publicize\REST_API\Share_Status_Controller" not found in /htdocs/x/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-publicize/src/class-publicize-setup.php:151 Stack trace: #0 /htdocs/x/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Publicize\Publicize_Setup::on_jetpack_feature_publicize_enabled('') #1 /htdocs/x/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #2 /htdocs/x/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /htdocs/x/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-config/src/class-config.php(224): do_action('jetpack_feature...') #4 /htdocs/x/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-config/src/class-config.php(139): Automattic\Jetpack\Config->ensure_feature('publicize') #5 /htdocs/x/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Config->on_plugins_loaded('') #6 /htdocs/x/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #7 /htdocs/x/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /htdocs/x/wp-settings.php(578): do_action('plugins_loaded') #9 /htdocs/x/wp-config.php(98): require_once('/htdocs/x/wp-se...') #10 /htdocs/x/wp-load.php(50): require_once('/htdocs/x/wp-co...') #11 /htdocs/x/wp-blog-header.php(13): require_once('/htdocs/x/wp-lo...') #12 /htdocs/x/index.php(17): require('/htdocs/x/wp-bl...') #13 {main} thrown in /htdocs/x/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-publicize/src/class-publicize-setup.php on line 151