Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions includes/class-receiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static function init() {
// Support Webmention delete
add_action( 'webmention_data_error', array( static::class, 'delete' ) );

// Add scheduler for async processing
add_action( 'webmention_process_schedule', array( static::class, 'process' ) );

self::register_meta();
}

Expand Down Expand Up @@ -215,10 +218,6 @@ public static function get( $request ) {
* @param WP_REST_Request $request Full data about the request.
*
* @return WP_Error|WP_REST_Response
*
* @uses apply_filters calls "webmention_comment_data" on the comment data
* @uses apply_filters calls "webmention_update" on the comment data
* @uses apply_filters calls "webmention_success_message" on the success message
*/
public static function post( $request ) {
$source = $request->get_param( 'source' );
Expand Down Expand Up @@ -317,6 +316,17 @@ public static function post( $request ) {
return new WP_REST_Response( $return, 202 );
}

return self::process( $commentdata );
}

/**
* Process the Webmention.
*
* @param array $commentdata The comment data.
*
* @return WP_REST_Response|WP_Error The response or an error.
*/
public static function process( $commentdata ) {
/**
* Filter Comment Data for Webmentions.
*
Expand Down