← All changes
|
core/base/background-process/wp-async-request.php
+11
-10
4.1.0-dev1
→
3.6.7
View file →
| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | - * Link https://github.com/A5hleyRich/wp-background-processing GPL v2.0 | |
| 9 | + * https://github.com/A5hleyRich/wp-background-processing GPL v2.0 | |
| 10 | 10 | * |
| 11 | 11 | * WP Async Request |
| 12 | 12 | * |
| 13 | 13 | * @package WP-Background-Processing |
| @@ -50,14 +50,14 @@ | ||
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Data |
| 53 | 53 | * |
| 54 | - * (default value: []) | |
| 54 | + * (default value: array()) | |
| 55 | 55 | * |
| 56 | 56 | * @var array |
| 57 | 57 | * @access protected |
| 58 | 58 | */ |
| 59 | - protected $data = []; | |
| 59 | + protected $data = array(); | |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Initiate new async request |
| 63 | 63 | */ |
| @@ -63,10 +63,10 @@ | ||
| 63 | 63 | */ |
| 64 | 64 | public function __construct() { |
| 65 | 65 | $this->identifier = $this->prefix . '_' . $this->action; |
| 66 | 66 | |
| 67 | - add_action( 'wp_ajax_' . $this->identifier, [ $this, 'maybe_handle' ] ); | |
| 68 | - add_action( 'wp_ajax_nopriv_' . $this->identifier, [ $this, 'maybe_handle' ] ); | |
| 67 | + add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) ); | |
| 68 | + add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) ); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Set data used during the request |
| @@ -102,12 +102,12 @@ | ||
| 102 | 102 | if ( property_exists( $this, 'query_args' ) ) { |
| 103 | 103 | return $this->query_args; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return [ | |
| 106 | + return array( | |
| 107 | 107 | 'action' => $this->identifier, |
| 108 | 108 | 'nonce' => wp_create_nonce( $this->identifier ), |
| 109 | - ]; | |
| 109 | + ); | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * Get query URL |
| @@ -131,16 +131,16 @@ | ||
| 131 | 131 | if ( property_exists( $this, 'post_args' ) ) { |
| 132 | 132 | return $this->post_args; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return [ | |
| 136 | - 'timeout' => 5, | |
| 135 | + return array( | |
| 136 | + 'timeout' => 0.01, | |
| 137 | 137 | 'blocking' => false, |
| 138 | 138 | 'body' => $this->data, |
| 139 | 139 | 'cookies' => $_COOKIE, |
| 140 | 140 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
| 141 | 141 | 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), |
| 142 | - ]; | |
| 142 | + ); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * Maybe handle |
| @@ -164,5 +164,6 @@ | ||
| 164 | 164 | * Override this method to perform any actions required |
| 165 | 165 | * during the async request. |
| 166 | 166 | */ |
| 167 | 167 | abstract protected function handle(); |
| 168 | + | |
| 168 | 169 | } |