admin
5 years ago
api
5 years ago
database
6 years ago
deprecated
5 years ago
donors
5 years ago
emails
6 years ago
forms
5 years ago
frontend
6 years ago
gateways
5 years ago
libraries
6 years ago
payments
5 years ago
actions.php
6 years ago
ajax-functions.php
5 years ago
class-give-async-process.php
6 years ago
class-give-background-updater.php
6 years ago
class-give-cache-setting.php
5 years ago
class-give-cache.php
6 years ago
class-give-cli-commands.php
6 years ago
class-give-comment.php
6 years ago
class-give-cron.php
6 years ago
class-give-donate-form.php
6 years ago
class-give-donor.php
6 years ago
class-give-email-access.php
6 years ago
class-give-license-handler.php
5 years ago
class-give-logging.php
6 years ago
class-give-readme-parser.php
6 years ago
class-give-roles.php
6 years ago
class-give-scripts.php
5 years ago
class-give-session.php
5 years ago
class-give-stats.php
6 years ago
class-give-template-loader.php
6 years ago
class-give-tooltips.php
6 years ago
class-give-translation.php
6 years ago
class-notices.php
5 years ago
country-functions.php
5 years ago
currencies-list.php
6 years ago
currency-functions.php
6 years ago
error-tracking.php
6 years ago
filters.php
6 years ago
formatting.php
6 years ago
install.php
5 years ago
login-register.php
6 years ago
misc-functions.php
5 years ago
plugin-compatibility.php
6 years ago
post-types.php
5 years ago
price-functions.php
6 years ago
process-donation.php
5 years ago
setting-functions.php
6 years ago
shortcodes.php
6 years ago
template-functions.php
6 years ago
user-functions.php
6 years ago
class-give-async-process.php
68 lines
| 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 |