@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | License URI: https://github.com/deliciousbrains/wp-background-processing/commit/126d7945dd3d39f39cb6488ca08fe1fb66cb351a |
13 | 13 | */ |
14 | 14 | |
15 | -if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
15 | +if (!class_exists('WP_Async_Request')) { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Abstract WP_Async_Request class. |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | public function __construct() { |
66 | 66 | $this->identifier = $this->prefix . '_' . $this->action; |
67 | 67 | |
68 | - add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) ); |
|
69 | - add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) ); |
|
68 | + add_action('wp_ajax_' . $this->identifier, array($this, 'maybe_handle')); |
|
69 | + add_action('wp_ajax_nopriv_' . $this->identifier, array($this, 'maybe_handle')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return $this |
78 | 78 | */ |
79 | - public function data( $data ) { |
|
79 | + public function data($data) { |
|
80 | 80 | $this->data = $data; |
81 | 81 | |
82 | 82 | return $this; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @return array|WP_Error |
89 | 89 | */ |
90 | 90 | public function dispatch() { |
91 | - $url = add_query_arg( $this->get_query_args(), $this->get_query_url() ); |
|
91 | + $url = add_query_arg($this->get_query_args(), $this->get_query_url()); |
|
92 | 92 | $args = $this->get_post_args(); |
93 | 93 | |
94 | - return wp_remote_post( esc_url_raw( $url ), $args ); |
|
94 | + return wp_remote_post(esc_url_raw($url), $args); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | * @return array |
101 | 101 | */ |
102 | 102 | protected function get_query_args() { |
103 | - if ( property_exists( $this, 'query_args' ) ) { |
|
103 | + if (property_exists($this, 'query_args')) { |
|
104 | 104 | return $this->query_args; |
105 | 105 | } |
106 | 106 | |
107 | 107 | return array( |
108 | 108 | 'action' => $this->identifier, |
109 | - 'nonce' => wp_create_nonce( $this->identifier ), |
|
109 | + 'nonce' => wp_create_nonce($this->identifier), |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @return string |
117 | 117 | */ |
118 | 118 | protected function get_query_url() { |
119 | - if ( property_exists( $this, 'query_url' ) ) { |
|
119 | + if (property_exists($this, 'query_url')) { |
|
120 | 120 | return $this->query_url; |
121 | 121 | } |
122 | 122 | |
123 | - return admin_url( 'admin-ajax.php' ); |
|
123 | + return admin_url('admin-ajax.php'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return array |
130 | 130 | */ |
131 | 131 | protected function get_post_args() { |
132 | - if ( property_exists( $this, 'post_args' ) ) { |
|
132 | + if (property_exists($this, 'post_args')) { |
|
133 | 133 | return $this->post_args; |
134 | 134 | } |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | 'blocking' => false, |
139 | 139 | 'body' => $this->data, |
140 | 140 | 'cookies' => $_COOKIE, |
141 | - 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), |
|
141 | + 'sslverify' => apply_filters('https_local_ssl_verify', false), |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | // Don't lock up other requests while processing |
152 | 152 | session_write_close(); |
153 | 153 | |
154 | - check_ajax_referer( $this->identifier, 'nonce' ); |
|
154 | + check_ajax_referer($this->identifier, 'nonce'); |
|
155 | 155 | |
156 | 156 | $this->handle(); |
157 | 157 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | |
92 | - for ($i = $offset; $i <= $to; $i+= $stepSize) { |
|
92 | + for ($i = $offset; $i <= $to; $i += $stepSize) { |
|
93 | 93 | if ($i == $dateValue) { |
94 | 94 | return true; |
95 | 95 | } |
@@ -240,7 +240,7 @@ |
||
240 | 240 | $currentTime = new DateTime($currentTime); |
241 | 241 | $currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0); |
242 | 242 | $currentDate = $currentTime->format('Y-m-d H:i'); |
243 | - $currentTime = (int)($currentTime->getTimestamp()); |
|
243 | + $currentTime = (int) ($currentTime->getTimestamp()); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime; |