PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 2.3.2 2.30.0 All 255 releases
give / includes / class-give-async-process.php

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

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