AllaerdAsyncRequest

The Woocommerce CSV Import Allaerd AsyncRequest class.

Defined (1)

The class is defined in the following location(s).

/import/abstracts/AsyncRequest.php  
  1. abstract class AsyncRequest 
  2.  
  3. protected $startTime; 
  4.  
  5. protected $data = array ('action' => 'aem_async_request'); 
  6.  
  7. public function dispatch() 
  8. $url = add_query_arg($this->get_query_args(), $this->get_query_url()); 
  9. $args = $this->get_post_args(); 
  10. wp_remote_post(esc_url_raw($url), $args); 
  11.  
  12. public function setStartTime() 
  13. $this->startTime = time(); 
  14.  
  15. public function unlockProcess() 
  16. delete_site_option('aem_async_request'); 
  17.  
  18. public function lockProcess() 
  19. update_site_option('aem_async_request', 'running'); 
  20.  
  21. public function are_we_running() 
  22. if (get_site_option('aem_async_request')) { 
  23. return true; 
  24. } else { 
  25. return false; 
  26.  
  27. protected function get_query_args() 
  28. return array ( 
  29. 'action' => 'aem_async_request',  
  30. 'nonce' => wp_create_nonce('aem_async_request'),  
  31. ); 
  32.  
  33. protected function get_query_url() 
  34. return admin_url('admin-ajax.php'); 
  35.  
  36. protected function get_post_args() 
  37. return array ( 
  38. 'action' => 'aem_async_request',  
  39. 'timeout' => 0.01,  
  40. 'blocking' => false,  
  41. 'body' => $this->data,  
  42. 'cookies' => $_COOKIE,  
  43. 'sslverify' => apply_filters('https_local_ssl_verify', false),  
  44. ); 
  45.  
  46. public function maybe_handle() 
  47. $this->handle(); 
  48. wp_die(); 
  49.  
  50. abstract protected function handle(); 
  51.