PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.3.1
GiveWP – Donation Plugin and Fundraising Platform v2.3.1
4.18.0 4.17.0 4.16.9 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 All 257 releases
give / includes / class-give-async-process.php

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

69 lines 1.2 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 *
26 * @var string
27 * @access protected
28 */
29 protected $prefix = 'give';
30
31 /**
32 * Dispatch updater.
33 *
34 * Updater will still run via cron job if this fails for any reason.
35 */
36 public function dispatch() {
37 /* @var WP_Async_Request $dispatched */
38 parent::dispatch();
39 }
40
41 /**
42 * Handle
43 *
44 * Override this method to perform any actions required
45 * during the async request.
46 */
47 protected function handle() {
48 /*
49 * $data = array(
50 * 'hook' => '', // required
51 * 'data' => {mixed} // required
52 * )
53 */
54
55 $_post = give_clean( $_POST );
56
57 if ( empty( $_post ) || empty( $_post['data'] ) || empty( $_post['hook'] ) ) {
58 exit();
59 }
60
61 /**
62 * Fire the hook.
63 */
64 do_action( $_post['hook'], $_post['data'] );
65
66 exit();
67 }
68 }
69