PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.1
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / inc / Background / LPBackgroundAjax.php

LPBackgroundAjax.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.1, at inc/Background/LPBackgroundAjax.php

43 lines 891 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace LearnPress\Background;
3
4 use LP_Settings;
5
6 defined( 'ABSPATH' ) || exit;
7
8 /**
9 * Class LPBackgroundAjax
10 * To handle a function that can be run in background
11 * Via call class:method extends AbstractAjax
12 * $data_send: must have key 'lp-load-ajax' to call method handle
13 *
14 * @since 4.2.9.1
15 * @version 1.0.1
16 */
17 class LPBackgroundAjax {
18 /**
19 * Method async handle
20 */
21 public static function handle( array $data_send = [], array $args = [] ) {
22 $url = LP_Settings::url_handle_lp_ajax();
23 $data_send = array_merge(
24 [ 'nonce' => wp_create_nonce( 'wp_rest' ) ],
25 $data_send
26 );
27 $args = array_merge(
28 [
29 'timeout' => 0.01,
30 'blocking' => false,
31 'body' => $data_send,
32 'cookies' => $_COOKIE,
33 'sslverify' => is_ssl(),
34 'headers' => [
35 'Referer' => $url,
36 ],
37 ],
38 $args
39 );
40 wp_remote_post( $url, $args );
41 }
42 }
43