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