PHP Class WP_Async_Request, wp-background-processing

Show file Open project: A5hleyRich/wp-background-processing Class Usage Examples

Protected Properties

Property Type Description
$action string (default value: 'async_request')
$data array (default value: array())
$identifier mixed Identifier
$prefix string (default value: 'wp')

Public Methods

Method Description
__construct ( ) Initiate new async request
data ( array $data ) Set data used during the request
dispatch ( ) : array | WP_Error Dispatch the async request
maybe_handle ( ) Maybe handle

Protected Methods

Method Description
get_post_args ( ) : array Get post args
get_query_args ( ) : array Get query args
get_query_url ( ) : string Get query URL
handle ( ) Handle

Method Details

__construct() public method

Initiate new async request
public __construct ( )

data() public method

Set data used during the request
public data ( array $data )
$data array Data.

dispatch() public method

Dispatch the async request
public dispatch ( ) : array | WP_Error
return array | WP_Error

get_post_args() protected method

Get post args
protected get_post_args ( ) : array
return array

get_query_args() protected method

Get query args
protected get_query_args ( ) : array
return array

get_query_url() protected method

Get query URL
protected get_query_url ( ) : string
return string

handle() abstract protected method

Override this method to perform any actions required during the async request.
abstract protected handle ( )

maybe_handle() public method

Check for correct nonce and pass to handler.
public maybe_handle ( )

Property Details

$action protected property

(default value: 'async_request')
protected string $action
return string

$data protected property

(default value: array())
protected array $data
return array

$identifier protected property

Identifier
protected mixed $identifier
return mixed

$prefix protected property

(default value: 'wp')
protected string $prefix
return string