PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.12.0
GiveWP – Donation Plugin and Fundraising Platform v2.12.0
4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 All 254 releases
give / includes / class-give-async-process.php

class-give-async-process.php in GiveWP – Donation Plugin and Fundraising Platform 2.12.0, at includes/class-give-async-process.php

68 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Background Process
4 *
5 * Uses https://github.com/A5hleyRich/wp-background-processing to handle DB
6 * updates in the background.
7 *
8 * @class Give_Async_Request
9 * @version 2.0.0
10 * @package Give/Classes
11 * @category Class
12 * @author GiveWP
13 */
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Give_Background_Updater Class.
20 */
21 class Give_Async_Process extends WP_Async_Request {
22 /**
23 * Prefix
24 *
25 * @var string
26 * @access protected
27 */
28 protected $prefix = 'give';
29
30 /**
31 * Dispatch updater.
32 *
33 * Updater will still run via cron job if this fails for any reason.
34 */
35 public function dispatch() {
36 /* @var WP_Async_Request $dispatched */
37 parent::dispatch();
38 }
39
40 /**
41 * Handle
42 *
43 * Override this method to perform any actions required
44 * during the async request.
45 */
46 protected function handle() {
47 /*
48 * $data = array(
49 * 'hook' => '', // required
50 * 'data' => {mixed} // required
51 * )
52 */
53
54 $_post = give_clean( $_POST );
55
56 if ( empty( $_post ) || empty( $_post['data'] ) || empty( $_post['hook'] ) ) {
57 exit();
58 }
59
60 /**
61 * Fire the hook.
62 */
63 do_action( $_post['hook'], $_post['data'] );
64
65 exit();
66 }
67 }
68