@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -116,34 +116,34 @@ discard block |
||
116 | 116 | $donor_ids = array(); |
117 | 117 | |
118 | 118 | // Check if the ajax request if running for the first time. |
119 | - if ( 1 === (int) $this->step ) { |
|
119 | + if (1 === (int) $this->step) { |
|
120 | 120 | // Delete all the form ids. |
121 | - $this->delete_option( $this->form_key ); |
|
121 | + $this->delete_option($this->form_key); |
|
122 | 122 | // Delete all the donation ids. |
123 | - $this->delete_option( $this->donation_key ); |
|
123 | + $this->delete_option($this->donation_key); |
|
124 | 124 | // Delete all the donor ids. |
125 | - $this->delete_option( $this->donor_key ); |
|
125 | + $this->delete_option($this->donor_key); |
|
126 | 126 | |
127 | 127 | // Delete all the step and set to 'count' which if the first step in the process of deleting the donors. |
128 | - $this->update_option( $this->step_key, 'count' ); |
|
128 | + $this->update_option($this->step_key, 'count'); |
|
129 | 129 | |
130 | 130 | // Delete tha page count of the step. |
131 | - $this->update_option( $this->step_on_key, '0' ); |
|
131 | + $this->update_option($this->step_on_key, '0'); |
|
132 | 132 | } else { |
133 | 133 | // Get the old donors list. |
134 | - $donor_ids = $this->get_option( $this->donor_key ); |
|
134 | + $donor_ids = $this->get_option($this->donor_key); |
|
135 | 135 | |
136 | 136 | // Get the old donation list. |
137 | - $donation_ids = $this->get_option( $this->donation_key ); |
|
137 | + $donation_ids = $this->get_option($this->donation_key); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Get the step and check for it if it's on the first step( 'count' ) or not. |
141 | 141 | $step = (int) $this->get_step(); |
142 | - if ( 1 === $step ) { |
|
142 | + if (1 === $step) { |
|
143 | 143 | /** |
144 | 144 | * Will add or update the donation and donor data by running wp query. |
145 | 145 | */ |
146 | - $this->count( $step, $donation_ids, $donor_ids ); |
|
146 | + $this->count($step, $donation_ids, $donor_ids); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | * @param array $donation_ids Contain the list of all the donation id's that has being add before this |
155 | 155 | * @param array $donor_ids Contain the list of all the donors id's that has being add before this |
156 | 156 | */ |
157 | - private function count( $step, $donation_ids = array(), $donor_ids = array() ) { |
|
157 | + private function count($step, $donation_ids = array(), $donor_ids = array()) { |
|
158 | 158 | |
159 | 159 | // Get the Page count by default it's zero. |
160 | 160 | $paged = (int) $this->get_step_page(); |
161 | 161 | // Incresed the page count by one. |
162 | - ++ $paged; |
|
162 | + ++$paged; |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Filter add to alter the argument before the wp quest run |
166 | 166 | */ |
167 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
167 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
168 | 168 | 'post_type' => 'give_payment', |
169 | 169 | 'post_status' => 'any', |
170 | 170 | 'posts_per_page' => $this->per_step, |
@@ -172,40 +172,40 @@ discard block |
||
172 | 172 | 'meta_key' => '_give_payment_import', |
173 | 173 | 'meta_value_num' => 1, |
174 | 174 | 'meta_compare' => '=', |
175 | - ) ); |
|
175 | + )); |
|
176 | 176 | |
177 | 177 | // Reset the post data. |
178 | 178 | wp_reset_postdata(); |
179 | 179 | // Getting the new donation. |
180 | - $donation_posts = new WP_Query( $args ); |
|
180 | + $donation_posts = new WP_Query($args); |
|
181 | 181 | |
182 | 182 | // The Loop. |
183 | - if ( $donation_posts->have_posts() ) { |
|
184 | - while ( $donation_posts->have_posts() ) { |
|
183 | + if ($donation_posts->have_posts()) { |
|
184 | + while ($donation_posts->have_posts()) { |
|
185 | 185 | $add_author = true; |
186 | 186 | $donation_posts->the_post(); |
187 | 187 | global $post; |
188 | 188 | // Add the donation id in side the array. |
189 | 189 | $donation_ids[] = $post->ID; |
190 | 190 | |
191 | - $donor_id = (int) get_post_meta( $post->ID, '_give_payment_customer_id', true ); |
|
192 | - if ( ! empty( $donor_id ) ) { |
|
193 | - $donor = new Give_Donor( $donor_id ); |
|
194 | - if ( ! empty( $donor->id ) ) { |
|
195 | - if ( empty( $donor->user_id ) && ! empty( $donor->payment_ids ) ) { |
|
191 | + $donor_id = (int) get_post_meta($post->ID, '_give_payment_customer_id', true); |
|
192 | + if ( ! empty($donor_id)) { |
|
193 | + $donor = new Give_Donor($donor_id); |
|
194 | + if ( ! empty($donor->id)) { |
|
195 | + if (empty($donor->user_id) && ! empty($donor->payment_ids)) { |
|
196 | 196 | $add_author = false; |
197 | - $count = (int) count( $donor->payment_ids ); |
|
198 | - if ( 1 === $count ) { |
|
199 | - Give()->donors->delete( $donor->id ); |
|
197 | + $count = (int) count($donor->payment_ids); |
|
198 | + if (1 === $count) { |
|
199 | + Give()->donors->delete($donor->id); |
|
200 | 200 | } else { |
201 | - $donor->remove_payment( $post->ID ); |
|
201 | + $donor->remove_payment($post->ID); |
|
202 | 202 | $donor->decrease_donation_count(); |
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - if ( ! empty( $add_author ) ) { |
|
208 | + if ( ! empty($add_author)) { |
|
209 | 209 | // Add the donor id in side the array. |
210 | 210 | $donor_ids[] = (int) $post->post_author; |
211 | 211 | } |
@@ -220,23 +220,23 @@ discard block |
||
220 | 220 | $max_num_pages = (int) $donation_posts->max_num_pages; |
221 | 221 | |
222 | 222 | // Check current page is less then max number of page or not |
223 | - if ( $paged < $max_num_pages ) { |
|
223 | + if ($paged < $max_num_pages) { |
|
224 | 224 | // Update the curretn page virable for the next step |
225 | - $this->update_option( $this->step_on_key, $paged ); |
|
225 | + $this->update_option($this->step_on_key, $paged); |
|
226 | 226 | |
227 | 227 | // Calculating percentage. |
228 | 228 | $page_remain = $max_num_pages - $paged; |
229 | - $this->total_step = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) ); |
|
229 | + $this->total_step = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids)); |
|
230 | 230 | $this->step_completed = $paged; |
231 | 231 | } else { |
232 | - $donation_ids_count = count( $donor_ids ); |
|
233 | - $this->update_option( $this->step_key, 'donation' ); |
|
234 | - $this->update_option( $this->step_on_key, '0' ); |
|
232 | + $donation_ids_count = count($donor_ids); |
|
233 | + $this->update_option($this->step_key, 'donation'); |
|
234 | + $this->update_option($this->step_on_key, '0'); |
|
235 | 235 | } |
236 | 236 | |
237 | - $donor_ids = array_unique( $donor_ids ); |
|
238 | - $this->update_option( $this->donor_key, $donor_ids ); |
|
239 | - $this->update_option( $this->donation_key, $donation_ids ); |
|
237 | + $donor_ids = array_unique($donor_ids); |
|
238 | + $this->update_option($this->donor_key, $donor_ids); |
|
239 | + $this->update_option($this->donation_key, $donation_ids); |
|
240 | 240 | |
241 | 241 | wp_reset_postdata(); |
242 | 242 | } |
@@ -248,34 +248,34 @@ discard block |
||
248 | 248 | * @return int |
249 | 249 | */ |
250 | 250 | public function get_percentage_complete() { |
251 | - return ceil( ( 100 * $this->step_completed ) / $this->total_step ); |
|
251 | + return ceil((100 * $this->step_completed) / $this->total_step); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | public function process_step() { |
255 | 255 | |
256 | - if ( ! $this->can_export() ) { |
|
257 | - wp_die( __( 'You do not have permission to delete Import transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
256 | + if ( ! $this->can_export()) { |
|
257 | + wp_die(__('You do not have permission to delete Import transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | $had_data = $this->get_data(); |
261 | 261 | |
262 | - if ( $had_data ) { |
|
262 | + if ($had_data) { |
|
263 | 263 | $this->done = false; |
264 | 264 | |
265 | 265 | return true; |
266 | 266 | } else { |
267 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
268 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
267 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
268 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
269 | 269 | |
270 | - $this->delete_option( $this->donation_key ); |
|
270 | + $this->delete_option($this->donation_key); |
|
271 | 271 | |
272 | 272 | // Reset the sequential order numbers |
273 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
274 | - delete_option( 'give_last_payment_number' ); |
|
273 | + if (give_get_option('enable_sequential')) { |
|
274 | + delete_option('give_last_payment_number'); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | $this->done = true; |
278 | - $this->message = __( 'Imported donor and transactions successfully deleted.', 'give' ); |
|
278 | + $this->message = __('Imported donor and transactions successfully deleted.', 'give'); |
|
279 | 279 | |
280 | 280 | return false; |
281 | 281 | } |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | public function get_data() { |
294 | 294 | |
295 | 295 | // Get the donation id's. |
296 | - $donation_ids = $this->get_option( $this->donation_key ); |
|
296 | + $donation_ids = $this->get_option($this->donation_key); |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Return false id not Import donation is found. |
300 | 300 | */ |
301 | - if ( empty( $donation_ids ) ) { |
|
301 | + if (empty($donation_ids)) { |
|
302 | 302 | $this->is_empty = true; |
303 | 303 | $this->total_step = 1; |
304 | 304 | |
@@ -309,108 +309,108 @@ discard block |
||
309 | 309 | $step = (int) $this->get_step(); |
310 | 310 | |
311 | 311 | // get teh donor ids. |
312 | - $donor_ids = $this->get_option( $this->donor_key ); |
|
312 | + $donor_ids = $this->get_option($this->donor_key); |
|
313 | 313 | |
314 | 314 | // In step to we delete all the donation in loop. |
315 | - if ( 2 === $step ) { |
|
315 | + if (2 === $step) { |
|
316 | 316 | $pass_to_donor = false; |
317 | 317 | $page = (int) $this->get_step_page(); |
318 | - $page ++; |
|
319 | - $count = count( $donation_ids ); |
|
318 | + $page++; |
|
319 | + $count = count($donation_ids); |
|
320 | 320 | |
321 | - $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids ); |
|
321 | + $this->total_step = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids); |
|
322 | 322 | $this->step_completed = $page; |
323 | 323 | |
324 | 324 | |
325 | - if ( $count > $this->per_step ) { |
|
325 | + if ($count > $this->per_step) { |
|
326 | 326 | |
327 | - $this->update_option( $this->step_on_key, $page ); |
|
328 | - $donation_ids = $this->get_delete_ids( $donation_ids, $page ); |
|
329 | - $current_page = (int) ceil( $count / $this->per_step ); |
|
327 | + $this->update_option($this->step_on_key, $page); |
|
328 | + $donation_ids = $this->get_delete_ids($donation_ids, $page); |
|
329 | + $current_page = (int) ceil($count / $this->per_step); |
|
330 | 330 | |
331 | - if ( $page === $current_page ) { |
|
331 | + if ($page === $current_page) { |
|
332 | 332 | $pass_to_donor = true; |
333 | 333 | } |
334 | 334 | } else { |
335 | 335 | $pass_to_donor = true; |
336 | 336 | } |
337 | 337 | |
338 | - if ( true === $pass_to_donor ) { |
|
339 | - $this->update_option( $this->step_key, 'donor' ); |
|
340 | - $this->update_option( $this->step_on_key, '0' ); |
|
338 | + if (true === $pass_to_donor) { |
|
339 | + $this->update_option($this->step_key, 'donor'); |
|
340 | + $this->update_option($this->step_on_key, '0'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | // Get the old form list. |
344 | - $form_ids = (array) $this->get_option( $this->form_key ); |
|
344 | + $form_ids = (array) $this->get_option($this->form_key); |
|
345 | 345 | |
346 | - foreach ( $donation_ids as $item ) { |
|
347 | - $form_ids[] = get_post_meta( $item, '_give_payment_form_id', true ); |
|
348 | - wp_delete_post( $item, true ); |
|
346 | + foreach ($donation_ids as $item) { |
|
347 | + $form_ids[] = get_post_meta($item, '_give_payment_form_id', true); |
|
348 | + wp_delete_post($item, true); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | // update the new form list. |
352 | - $this->update_option( $this->form_key, $form_ids ); |
|
352 | + $this->update_option($this->form_key, $form_ids); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | 356 | // Here we delete all the donor |
357 | - if ( 3 === $step ) { |
|
357 | + if (3 === $step) { |
|
358 | 358 | |
359 | 359 | // Get the old form list. |
360 | - $form_ids = (array) $this->get_option( $this->form_key ); |
|
361 | - if ( ! empty( $form_ids ) ) { |
|
362 | - $form_ids = array_unique( $form_ids ); |
|
363 | - foreach ( $form_ids as $form_id ) { |
|
364 | - give_recount_form_income_donation( (int) $form_id ); |
|
360 | + $form_ids = (array) $this->get_option($this->form_key); |
|
361 | + if ( ! empty($form_ids)) { |
|
362 | + $form_ids = array_unique($form_ids); |
|
363 | + foreach ($form_ids as $form_id) { |
|
364 | + give_recount_form_income_donation((int) $form_id); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | // update the new form list. |
368 | - $this->update_option( $this->form_key, array() ); |
|
368 | + $this->update_option($this->form_key, array()); |
|
369 | 369 | |
370 | 370 | $page = (int) $this->get_step_page(); |
371 | - $count = count( $donor_ids ); |
|
371 | + $count = count($donor_ids); |
|
372 | 372 | |
373 | - $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids ); |
|
374 | - $this->step_completed = $page + ( count( $donation_ids ) / $this->per_step ); |
|
373 | + $this->total_step = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids); |
|
374 | + $this->step_completed = $page + (count($donation_ids) / $this->per_step); |
|
375 | 375 | |
376 | - if ( ! empty( $donor_ids[ $page ] ) ) { |
|
377 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
376 | + if ( ! empty($donor_ids[$page])) { |
|
377 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
378 | 378 | 'post_status' => 'any', |
379 | 379 | 'posts_per_page' => 1, |
380 | - 'author' => $donor_ids[ $page ] |
|
381 | - ) ); |
|
380 | + 'author' => $donor_ids[$page] |
|
381 | + )); |
|
382 | 382 | |
383 | 383 | $donations = array(); |
384 | - $payments = new Give_Payments_Query( $args ); |
|
384 | + $payments = new Give_Payments_Query($args); |
|
385 | 385 | $payments = $payments->get_payments(); |
386 | - if ( empty( $payments ) ) { |
|
387 | - Give()->donors->delete_by_user_id( $donor_ids[ $page ] ); |
|
386 | + if (empty($payments)) { |
|
387 | + Give()->donors->delete_by_user_id($donor_ids[$page]); |
|
388 | 388 | |
389 | 389 | /** |
390 | 390 | * If Checked then delete WP user. |
391 | 391 | * |
392 | 392 | * @since 1.8.14 |
393 | 393 | */ |
394 | - if ( 'on' === (string) $_REQUEST['delete-import-donors'] ) { |
|
395 | - wp_delete_user( $donor_ids[ $page ] ); |
|
394 | + if ('on' === (string) $_REQUEST['delete-import-donors']) { |
|
395 | + wp_delete_user($donor_ids[$page]); |
|
396 | 396 | } |
397 | 397 | } else { |
398 | - foreach ( $payments as $payment ) { |
|
398 | + foreach ($payments as $payment) { |
|
399 | 399 | $donations[] = $payment->ID; |
400 | 400 | } |
401 | 401 | |
402 | - $donor = new Give_Donor( $donor_ids[ $page ], true ); |
|
402 | + $donor = new Give_Donor($donor_ids[$page], true); |
|
403 | 403 | $data_to_update = array( |
404 | - 'purchase_count' => count( $donations ), |
|
405 | - 'payment_ids' => implode( ',', $donations ), |
|
404 | + 'purchase_count' => count($donations), |
|
405 | + 'payment_ids' => implode(',', $donations), |
|
406 | 406 | ); |
407 | - $donor->update( $data_to_update ); |
|
407 | + $donor->update($data_to_update); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
411 | - $page ++; |
|
412 | - $this->update_option( $this->step_on_key, $page ); |
|
413 | - if ( $count === $page ) { |
|
411 | + $page++; |
|
412 | + $this->update_option($this->step_on_key, $page); |
|
413 | + if ($count === $page) { |
|
414 | 414 | $this->is_empty = false; |
415 | 415 | |
416 | 416 | return false; |
@@ -422,24 +422,24 @@ discard block |
||
422 | 422 | return true; |
423 | 423 | } |
424 | 424 | |
425 | - public function get_delete_ids( $donation_ids, $page ) { |
|
426 | - $index = $page --; |
|
427 | - $count = count( $donation_ids ); |
|
425 | + public function get_delete_ids($donation_ids, $page) { |
|
426 | + $index = $page--; |
|
427 | + $count = count($donation_ids); |
|
428 | 428 | $temp = 0; |
429 | 429 | $current_page = 0; |
430 | 430 | $post_delete = $this->per_step; |
431 | 431 | $page_donation_id = array(); |
432 | 432 | |
433 | - foreach ( $donation_ids as $item ) { |
|
434 | - $temp ++; |
|
435 | - $page_donation_id[ $current_page ][] = $item; |
|
436 | - if ( $temp === $post_delete ) { |
|
437 | - $current_page ++; |
|
433 | + foreach ($donation_ids as $item) { |
|
434 | + $temp++; |
|
435 | + $page_donation_id[$current_page][] = $item; |
|
436 | + if ($temp === $post_delete) { |
|
437 | + $current_page++; |
|
438 | 438 | $temp = 0; |
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | - return $page_donation_id[ $page ]; |
|
442 | + return $page_donation_id[$page]; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @return mixed Returns the data from the database |
453 | 453 | */ |
454 | - public function get_option( $key, $defalut_value = false ) { |
|
455 | - return get_option( $key, $defalut_value ); |
|
454 | + public function get_option($key, $defalut_value = false) { |
|
455 | + return get_option($key, $defalut_value); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return void |
467 | 467 | */ |
468 | - public function update_option( $key, $value ) { |
|
469 | - update_option( $key, $value, false ); |
|
468 | + public function update_option($key, $value) { |
|
469 | + update_option($key, $value, false); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return void |
480 | 480 | */ |
481 | - public function delete_option( $key ) { |
|
482 | - delete_option( $key ); |
|
481 | + public function delete_option($key) { |
|
482 | + delete_option($key); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | * @return int|string |
491 | 491 | */ |
492 | 492 | private function get_step() { |
493 | - $step_key = (string) $this->get_option( $this->step_key, false ); |
|
494 | - if ( 'count' === $step_key ) { |
|
493 | + $step_key = (string) $this->get_option($this->step_key, false); |
|
494 | + if ('count' === $step_key) { |
|
495 | 495 | return 1; |
496 | - } elseif ( 'donation' === $step_key ) { |
|
496 | + } elseif ('donation' === $step_key) { |
|
497 | 497 | return 2; |
498 | - } elseif ( 'donor' === $step_key ) { |
|
498 | + } elseif ('donor' === $step_key) { |
|
499 | 499 | return 3; |
500 | 500 | } else { |
501 | 501 | return $step_key; |
@@ -506,6 +506,6 @@ discard block |
||
506 | 506 | * Get the current $page value in the ajax. |
507 | 507 | */ |
508 | 508 | private function get_step_page() { |
509 | - return $this->get_option( $this->step_on_key, false ); |
|
509 | + return $this->get_option($this->step_on_key, false); |
|
510 | 510 | } |
511 | 511 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | * @since 1.8 |
21 | 21 | */ |
22 | 22 | function give_load_wp_editor() { |
23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
23 | + if ( ! isset($_POST['wp_editor'])) { |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
29 | 29 | |
30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
31 | 31 | |
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Register admin notices. |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function _give_register_admin_notices() { |
125 | 125 | // Bailout. |
126 | - if ( ! is_admin() ) { |
|
126 | + if ( ! is_admin()) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Add payment bulk notice. |
131 | 131 | if ( |
132 | - current_user_can( 'edit_give_payments' ) |
|
133 | - && isset( $_GET['action'] ) |
|
134 | - && ! empty( $_GET['action'] ) |
|
135 | - && isset( $_GET['payment'] ) |
|
136 | - && ! empty( $_GET['payment'] ) |
|
132 | + current_user_can('edit_give_payments') |
|
133 | + && isset($_GET['action']) |
|
134 | + && ! empty($_GET['action']) |
|
135 | + && isset($_GET['payment']) |
|
136 | + && ! empty($_GET['payment']) |
|
137 | 137 | ) { |
138 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
138 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
139 | 139 | |
140 | - switch ( $_GET['action'] ) { |
|
140 | + switch ($_GET['action']) { |
|
141 | 141 | case 'delete': |
142 | - Give()->notices->register_notice( array( |
|
142 | + Give()->notices->register_notice(array( |
|
143 | 143 | 'id' => 'bulk_action_delete', |
144 | 144 | 'type' => 'updated', |
145 | 145 | 'description' => sprintf( |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | ), |
152 | 152 | $payment_count ), |
153 | 153 | 'show' => true, |
154 | - ) ); |
|
154 | + )); |
|
155 | 155 | |
156 | 156 | break; |
157 | 157 | |
158 | 158 | case 'resend-receipt': |
159 | - Give()->notices->register_notice( array( |
|
159 | + Give()->notices->register_notice(array( |
|
160 | 160 | 'id' => 'bulk_action_resend_receipt', |
161 | 161 | 'type' => 'updated', |
162 | 162 | 'description' => sprintf( |
@@ -169,205 +169,205 @@ discard block |
||
169 | 169 | $payment_count |
170 | 170 | ), |
171 | 171 | 'show' => true, |
172 | - ) ); |
|
172 | + )); |
|
173 | 173 | break; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | // Add give message notices. |
178 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
178 | + if ( ! empty($_GET['give-message'])) { |
|
179 | 179 | // Donation reports errors. |
180 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
181 | - switch ( $_GET['give-message'] ) { |
|
180 | + if (current_user_can('view_give_reports')) { |
|
181 | + switch ($_GET['give-message']) { |
|
182 | 182 | case 'donation_deleted' : |
183 | - Give()->notices->register_notice( array( |
|
183 | + Give()->notices->register_notice(array( |
|
184 | 184 | 'id' => 'give-donation-deleted', |
185 | 185 | 'type' => 'updated', |
186 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
186 | + 'description' => __('The donation has been deleted.', 'give'), |
|
187 | 187 | 'show' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | break; |
190 | 190 | case 'email_sent' : |
191 | - Give()->notices->register_notice( array( |
|
191 | + Give()->notices->register_notice(array( |
|
192 | 192 | 'id' => 'give-payment-sent', |
193 | 193 | 'type' => 'updated', |
194 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
194 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
195 | 195 | 'show' => true, |
196 | - ) ); |
|
196 | + )); |
|
197 | 197 | break; |
198 | 198 | case 'refreshed-reports' : |
199 | - Give()->notices->register_notice( array( |
|
199 | + Give()->notices->register_notice(array( |
|
200 | 200 | 'id' => 'give-refreshed-reports', |
201 | 201 | 'type' => 'updated', |
202 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
202 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
203 | 203 | 'show' => true, |
204 | - ) ); |
|
204 | + )); |
|
205 | 205 | break; |
206 | 206 | case 'donation-note-deleted' : |
207 | - Give()->notices->register_notice( array( |
|
207 | + Give()->notices->register_notice(array( |
|
208 | 208 | 'id' => 'give-donation-note-deleted', |
209 | 209 | 'type' => 'updated', |
210 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
210 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
211 | 211 | 'show' => true, |
212 | - ) ); |
|
212 | + )); |
|
213 | 213 | break; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Give settings notices and errors. |
218 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
219 | - switch ( $_GET['give-message'] ) { |
|
218 | + if (current_user_can('manage_give_settings')) { |
|
219 | + switch ($_GET['give-message']) { |
|
220 | 220 | case 'settings-imported' : |
221 | - Give()->notices->register_notice( array( |
|
221 | + Give()->notices->register_notice(array( |
|
222 | 222 | 'id' => 'give-settings-imported', |
223 | 223 | 'type' => 'updated', |
224 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
224 | + 'description' => __('The settings have been imported.', 'give'), |
|
225 | 225 | 'show' => true, |
226 | - ) ); |
|
226 | + )); |
|
227 | 227 | break; |
228 | 228 | case 'api-key-generated' : |
229 | - Give()->notices->register_notice( array( |
|
229 | + Give()->notices->register_notice(array( |
|
230 | 230 | 'id' => 'give-api-key-generated', |
231 | 231 | 'type' => 'updated', |
232 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
232 | + 'description' => __('API keys have been generated.', 'give'), |
|
233 | 233 | 'show' => true, |
234 | - ) ); |
|
234 | + )); |
|
235 | 235 | break; |
236 | 236 | case 'api-key-exists' : |
237 | - Give()->notices->register_notice( array( |
|
237 | + Give()->notices->register_notice(array( |
|
238 | 238 | 'id' => 'give-api-key-exists', |
239 | 239 | 'type' => 'updated', |
240 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
240 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
241 | 241 | 'show' => true, |
242 | - ) ); |
|
242 | + )); |
|
243 | 243 | break; |
244 | 244 | case 'api-key-regenerated' : |
245 | - Give()->notices->register_notice( array( |
|
245 | + Give()->notices->register_notice(array( |
|
246 | 246 | 'id' => 'give-api-key-regenerated', |
247 | 247 | 'type' => 'updated', |
248 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
248 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
249 | 249 | 'show' => true, |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | break; |
252 | 252 | case 'api-key-revoked' : |
253 | - Give()->notices->register_notice( array( |
|
253 | + Give()->notices->register_notice(array( |
|
254 | 254 | 'id' => 'give-api-key-revoked', |
255 | 255 | 'type' => 'updated', |
256 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
256 | + 'description' => __('API keys have been revoked.', 'give'), |
|
257 | 257 | 'show' => true, |
258 | - ) ); |
|
258 | + )); |
|
259 | 259 | break; |
260 | 260 | case 'sent-test-email' : |
261 | - Give()->notices->register_notice( array( |
|
261 | + Give()->notices->register_notice(array( |
|
262 | 262 | 'id' => 'give-sent-test-email', |
263 | 263 | 'type' => 'updated', |
264 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
264 | + 'description' => __('The test email has been sent.', 'give'), |
|
265 | 265 | 'show' => true, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | break; |
268 | 268 | case 'matched-success-failure-page': |
269 | - Give()->notices->register_notice( array( |
|
269 | + Give()->notices->register_notice(array( |
|
270 | 270 | 'id' => 'give-matched-success-failure-page', |
271 | 271 | 'type' => 'updated', |
272 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
272 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
273 | 273 | 'show' => true, |
274 | - ) ); |
|
274 | + )); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | // Payments errors. |
279 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
280 | - switch ( $_GET['give-message'] ) { |
|
279 | + if (current_user_can('edit_give_payments')) { |
|
280 | + switch ($_GET['give-message']) { |
|
281 | 281 | case 'note-added' : |
282 | - Give()->notices->register_notice( array( |
|
282 | + Give()->notices->register_notice(array( |
|
283 | 283 | 'id' => 'give-note-added', |
284 | 284 | 'type' => 'updated', |
285 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
285 | + 'description' => __('The donation note has been added.', 'give'), |
|
286 | 286 | 'show' => true, |
287 | - ) ); |
|
287 | + )); |
|
288 | 288 | break; |
289 | 289 | case 'payment-updated' : |
290 | - Give()->notices->register_notice( array( |
|
290 | + Give()->notices->register_notice(array( |
|
291 | 291 | 'id' => 'give-payment-updated', |
292 | 292 | 'type' => 'updated', |
293 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
293 | + 'description' => __('The donation has been updated.', 'give'), |
|
294 | 294 | 'show' => true, |
295 | - ) ); |
|
295 | + )); |
|
296 | 296 | break; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | // Donor Notices. |
301 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
302 | - switch ( $_GET['give-message'] ) { |
|
301 | + if (current_user_can('edit_give_payments')) { |
|
302 | + switch ($_GET['give-message']) { |
|
303 | 303 | case 'donor-deleted' : |
304 | - Give()->notices->register_notice( array( |
|
304 | + Give()->notices->register_notice(array( |
|
305 | 305 | 'id' => 'give-donor-deleted', |
306 | 306 | 'type' => 'updated', |
307 | - 'description' => __( 'The donor has been deleted.', 'give' ), |
|
307 | + 'description' => __('The donor has been deleted.', 'give'), |
|
308 | 308 | 'show' => true, |
309 | - ) ); |
|
309 | + )); |
|
310 | 310 | break; |
311 | 311 | |
312 | 312 | case 'email-added' : |
313 | - Give()->notices->register_notice( array( |
|
313 | + Give()->notices->register_notice(array( |
|
314 | 314 | 'id' => 'give-donor-email-added', |
315 | 315 | 'type' => 'updated', |
316 | - 'description' => __( 'Donor email added.', 'give' ), |
|
316 | + 'description' => __('Donor email added.', 'give'), |
|
317 | 317 | 'show' => true, |
318 | - ) ); |
|
318 | + )); |
|
319 | 319 | break; |
320 | 320 | |
321 | 321 | case 'email-removed' : |
322 | - Give()->notices->register_notice( array( |
|
322 | + Give()->notices->register_notice(array( |
|
323 | 323 | 'id' => 'give-donor-email-removed', |
324 | 324 | 'type' => 'updated', |
325 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
325 | + 'description' => __('Donor email removed.', 'give'), |
|
326 | 326 | 'show' => true, |
327 | - ) ); |
|
327 | + )); |
|
328 | 328 | break; |
329 | 329 | |
330 | 330 | case 'email-remove-failed' : |
331 | - Give()->notices->register_notice( array( |
|
331 | + Give()->notices->register_notice(array( |
|
332 | 332 | 'id' => 'give-donor-email-remove-failed', |
333 | 333 | 'type' => 'updated', |
334 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
334 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
335 | 335 | 'show' => true, |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | break; |
338 | 338 | |
339 | 339 | case 'primary-email-updated' : |
340 | - Give()->notices->register_notice( array( |
|
340 | + Give()->notices->register_notice(array( |
|
341 | 341 | 'id' => 'give-donor-primary-email-updated', |
342 | 342 | 'type' => 'updated', |
343 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
343 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
344 | 344 | 'show' => true, |
345 | - ) ); |
|
345 | + )); |
|
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'primary-email-failed' : |
349 | - Give()->notices->register_notice( array( |
|
349 | + Give()->notices->register_notice(array( |
|
350 | 350 | 'id' => 'give-donor-primary-email-failed', |
351 | 351 | 'type' => 'updated', |
352 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
352 | + 'description' => __('Failed to set primary email.', 'give'), |
|
353 | 353 | 'show' => true, |
354 | - ) ); |
|
354 | + )); |
|
355 | 355 | break; |
356 | 356 | |
357 | 357 | case 'reconnect-user' : |
358 | - Give()->notices->register_notice( array( |
|
358 | + Give()->notices->register_notice(array( |
|
359 | 359 | 'id' => 'give-donor-reconnect-user', |
360 | 360 | 'type' => 'updated', |
361 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
361 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
362 | 362 | 'show' => true, |
363 | - ) ); |
|
363 | + )); |
|
364 | 364 | break; |
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
370 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
370 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -377,31 +377,30 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return bool |
379 | 379 | */ |
380 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
381 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
382 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
383 | - give_is_test_mode(); |
|
380 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
381 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
382 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
384 | 383 | |
385 | 384 | if ( |
386 | - ! current_user_can( 'view_give_reports' ) || |
|
385 | + ! current_user_can('view_give_reports') || |
|
387 | 386 | ! $is_test_mode |
388 | 387 | ) { |
389 | 388 | return false; |
390 | 389 | } |
391 | 390 | |
392 | 391 | // Add the main siteadmin menu item. |
393 | - $wp_admin_bar->add_menu( array( |
|
392 | + $wp_admin_bar->add_menu(array( |
|
394 | 393 | 'id' => 'give-test-notice', |
395 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
394 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
396 | 395 | 'parent' => 'top-secondary', |
397 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), |
|
398 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
399 | - ) ); |
|
396 | + 'title' => esc_html__('Give Test Mode Active', 'give'), |
|
397 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
398 | + )); |
|
400 | 399 | |
401 | 400 | return true; |
402 | 401 | } |
403 | 402 | |
404 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
403 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
405 | 404 | |
406 | 405 | /** |
407 | 406 | * Add Link to Import page in from donation archive and donation single page |
@@ -410,12 +409,12 @@ discard block |
||
410 | 409 | */ |
411 | 410 | function give_import_page_link_callback() { |
412 | 411 | ?> |
413 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
414 | - class="page-import-action page-title-action"><?php esc_html_e( 'Import Donations', 'give' ); ?></a> |
|
412 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
413 | + class="page-import-action page-title-action"><?php esc_html_e('Import Donations', 'give'); ?></a> |
|
415 | 414 | |
416 | 415 | <?php |
417 | 416 | // Check if view donation single page only. |
418 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
417 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
419 | 418 | ?> |
420 | 419 | <style type="text/css"> |
421 | 420 | .wrap #transaction-details-heading { |
@@ -426,7 +425,7 @@ discard block |
||
426 | 425 | } |
427 | 426 | } |
428 | 427 | |
429 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
428 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
430 | 429 | |
431 | 430 | /** |
432 | 431 | * Load donation import ajax callback |
@@ -438,9 +437,9 @@ discard block |
||
438 | 437 | */ |
439 | 438 | function give_donation_import_callback() { |
440 | 439 | $import_setting = array(); |
441 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
440 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
442 | 441 | |
443 | - parse_str( $fields ); |
|
442 | + parse_str($fields); |
|
444 | 443 | |
445 | 444 | $import_setting['create_user'] = $create_user; |
446 | 445 | $import_setting['mode'] = $mode; |
@@ -449,54 +448,54 @@ discard block |
||
449 | 448 | $import_setting['delete_csv'] = $delete_csv; |
450 | 449 | |
451 | 450 | // Parent key id. |
452 | - $main_key = maybe_unserialize( $main_key ); |
|
453 | - |
|
454 | - $current = absint( $_REQUEST['current'] ); |
|
455 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
456 | - $start = absint( $_REQUEST['start'] ); |
|
457 | - $end = absint( $_REQUEST['end'] ); |
|
458 | - $next = absint( $_REQUEST['next'] ); |
|
459 | - $total = absint( $_REQUEST['total'] ); |
|
460 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
461 | - if ( empty( $delimiter ) ) { |
|
451 | + $main_key = maybe_unserialize($main_key); |
|
452 | + |
|
453 | + $current = absint($_REQUEST['current']); |
|
454 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
455 | + $start = absint($_REQUEST['start']); |
|
456 | + $end = absint($_REQUEST['end']); |
|
457 | + $next = absint($_REQUEST['next']); |
|
458 | + $total = absint($_REQUEST['total']); |
|
459 | + $per_page = absint($_REQUEST['per_page']); |
|
460 | + if (empty($delimiter)) { |
|
462 | 461 | $delimiter = ','; |
463 | 462 | } |
464 | 463 | |
465 | 464 | // processing done here. |
466 | - $raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter ); |
|
467 | - $raw_key = maybe_unserialize( $mapto ); |
|
465 | + $raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter); |
|
466 | + $raw_key = maybe_unserialize($mapto); |
|
468 | 467 | |
469 | 468 | //Prevent normal emails |
470 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
471 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
472 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
469 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
470 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
471 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
473 | 472 | |
474 | - foreach ( $raw_data as $row_data ) { |
|
475 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
473 | + foreach ($raw_data as $row_data) { |
|
474 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
476 | 475 | } |
477 | 476 | |
478 | 477 | // Check if function exists or not. |
479 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
480 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
478 | + if (function_exists('give_payment_save_page_data')) { |
|
479 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
481 | 480 | } |
482 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
483 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
481 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
482 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
484 | 483 | |
485 | - if ( $next == false ) { |
|
484 | + if ($next == false) { |
|
486 | 485 | $json_data = array( |
487 | 486 | 'success' => true, |
488 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
487 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
489 | 488 | ); |
490 | 489 | } else { |
491 | 490 | $index_start = $start; |
492 | 491 | $index_end = $end; |
493 | 492 | $last = false; |
494 | 493 | $next = true; |
495 | - if ( $next ) { |
|
494 | + if ($next) { |
|
496 | 495 | $index_start = $index_start + $per_page; |
497 | - $index_end = $per_page + ( $index_start - 1 ); |
|
496 | + $index_end = $per_page + ($index_start - 1); |
|
498 | 497 | } |
499 | - if ( $index_end >= $total ) { |
|
498 | + if ($index_end >= $total) { |
|
500 | 499 | $index_end = $total; |
501 | 500 | $last = true; |
502 | 501 | } |
@@ -510,27 +509,27 @@ discard block |
||
510 | 509 | ); |
511 | 510 | } |
512 | 511 | |
513 | - $url = give_import_page_url( array( |
|
512 | + $url = give_import_page_url(array( |
|
514 | 513 | 'step' => '4', |
515 | 514 | 'importer-type' => 'import_donations', |
516 | 515 | 'csv' => $csv, |
517 | 516 | 'total' => $total, |
518 | 517 | 'delete_csv' => $import_setting['delete_csv'], |
519 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
520 | - ) ); |
|
518 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
519 | + )); |
|
521 | 520 | $json_data['url'] = $url; |
522 | 521 | |
523 | - $current ++; |
|
522 | + $current++; |
|
524 | 523 | $json_data['current'] = $current; |
525 | 524 | |
526 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
525 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
527 | 526 | $json_data['percentage'] = $percentage; |
528 | 527 | |
529 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
530 | - wp_die( json_encode( $json_data ) ); |
|
528 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
529 | + wp_die(json_encode($json_data)); |
|
531 | 530 | } |
532 | 531 | |
533 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
532 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
534 | 533 | |
535 | 534 | |
536 | 535 | /** |
@@ -543,7 +542,7 @@ discard block |
||
543 | 542 | $blank_slate->init(); |
544 | 543 | } |
545 | 544 | |
546 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
545 | +add_action('current_screen', 'give_blank_slate'); |
|
547 | 546 | |
548 | 547 | /** |
549 | 548 | * Get Array of WP User Roles. |
@@ -556,8 +555,8 @@ discard block |
||
556 | 555 | $user_roles = array(); |
557 | 556 | |
558 | 557 | // Loop through User Roles. |
559 | - foreach ( get_editable_roles() as $role_name => $role_info ): |
|
560 | - $user_roles[ $role_name ] = $role_info['name']; |
|
558 | + foreach (get_editable_roles() as $role_name => $role_info): |
|
559 | + $user_roles[$role_name] = $role_info['name']; |
|
561 | 560 | endforeach; |
562 | 561 | |
563 | 562 | return $user_roles; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | 33 | <hr class="wp-header-end"> |
34 | 34 | |
35 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
35 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
36 | 36 | <?php echo give_add_ons_get_feed(); ?> |
37 | 37 | </div> |
38 | 38 | <?php |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | function give_add_ons_get_feed() { |
51 | 51 | |
52 | 52 | $addons_debug = false; //set to true to debug |
53 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
53 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
54 | 54 | |
55 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
56 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
55 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
56 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
57 | 57 | |
58 | - if ( ! is_wp_error( $feed ) ) { |
|
59 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
60 | - $cache = wp_remote_retrieve_body( $feed ); |
|
61 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
58 | + if ( ! is_wp_error($feed)) { |
|
59 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
60 | + $cache = wp_remote_retrieve_body($feed); |
|
61 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $cache = sprintf( |
65 | 65 | '<div class="error"><p>%s</p></div>', |
66 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
66 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - $views = apply_filters( 'give_report_views', $views ); |
|
108 | + $views = apply_filters('give_report_views', $views); |
|
109 | 109 | |
110 | 110 | return $views; |
111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @since 1.0 |
121 | 121 | * @return string $view Report View |
122 | 122 | */ |
123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
123 | +function give_get_reporting_view($default = 'earnings') { |
|
124 | 124 | |
125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
126 | 126 | $view = $default; |
127 | 127 | } else { |
128 | 128 | $view = $_GET['view']; |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
131 | + return apply_filters('give_get_reporting_view', $view); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $current_view = 'earnings'; |
142 | 142 | $views = give_reports_default_views(); |
143 | 143 | |
144 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
144 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
145 | 145 | $current_view = $_GET['tab']; |
146 | 146 | } |
147 | 147 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @since 1.0 |
152 | 152 | */ |
153 | - do_action( "give_reports_view_{$current_view}" ); |
|
153 | + do_action("give_reports_view_{$current_view}"); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
156 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Renders the Reports Page Views Drop Downs |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_report_views() { |
165 | 165 | $views = give_reports_default_views(); |
166 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
166 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
167 | 167 | /** |
168 | 168 | * Fires before the report page actions form. |
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_report_view_actions_before' ); |
|
172 | + do_action('give_report_view_actions_before'); |
|
173 | 173 | ?> |
174 | 174 | <form id="give-reports-filter" method="get"> |
175 | 175 | <select id="give-reports-view" name="view"> |
176 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
177 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
178 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
176 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
177 | + <?php foreach ($views as $view_id => $label) : ?> |
|
178 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
179 | 179 | <?php endforeach; ?> |
180 | 180 | </select> |
181 | 181 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @since 1.0 |
189 | 189 | */ |
190 | - do_action( 'give_report_view_actions' ); |
|
190 | + do_action('give_report_view_actions'); |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | <input type="hidden" name="post_type" value="give_forms"/> |
194 | 194 | <input type="hidden" name="page" value="give-reports"/> |
195 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
195 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
196 | 196 | </form> |
197 | 197 | <?php |
198 | 198 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 1.0 |
202 | 202 | */ |
203 | - do_action( 'give_report_view_actions_after' ); |
|
203 | + do_action('give_report_view_actions_after'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | function give_reports_forms_table() { |
215 | 215 | |
216 | - if ( isset( $_GET['form-id'] ) ) { |
|
216 | + if (isset($_GET['form-id'])) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
220 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
221 | 221 | |
222 | 222 | $give_table = new Give_Form_Reports_Table(); |
223 | 223 | $give_table->prepare_items(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | <?php |
230 | 230 | } |
231 | 231 | |
232 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
232 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Renders the detailed report for a specific give form. |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | * @return void |
239 | 239 | */ |
240 | 240 | function give_reports_form_details() { |
241 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
241 | + if ( ! isset($_GET['form-id'])) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | ?> |
245 | 245 | <div class="tablenav top reports-forms-details-wrap"> |
246 | 246 | <div class="actions bulkactions"> |
247 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
247 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <?php |
251 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
251 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
252 | 252 | } |
253 | 253 | |
254 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
254 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Renders the Gateways Table |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | function give_reports_gateways_table() { |
265 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
265 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
266 | 266 | |
267 | 267 | $give_table = new Give_Gateway_Reports_Table(); |
268 | 268 | $give_table->prepare_items(); |
269 | 269 | $give_table->display(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
272 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Renders the Reports Earnings Graphs |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | function give_reports_earnings() { |
281 | 281 | ?> |
282 | 282 | <div class="tablenav top reports-table-nav"> |
283 | - <h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2> |
|
283 | + <h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2> |
|
284 | 284 | </div> |
285 | 285 | <?php |
286 | 286 | give_reports_graph(); |
287 | 287 | } |
288 | 288 | |
289 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
289 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
290 | 290 | |
291 | 291 | |
292 | 292 | /** |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function give_estimated_monthly_stats() { |
299 | 299 | |
300 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
300 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
301 | 301 | |
302 | - if ( false === $estimated ) { |
|
302 | + if (false === $estimated) { |
|
303 | 303 | |
304 | 304 | $estimated = array( |
305 | 305 | 'earnings' => 0, |
@@ -308,22 +308,22 @@ discard block |
||
308 | 308 | |
309 | 309 | $stats = new Give_Payment_Stats; |
310 | 310 | |
311 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
312 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
311 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
312 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
313 | 313 | |
314 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
315 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
316 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
317 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
314 | + $current_day = date('d', current_time('timestamp')); |
|
315 | + $current_month = date('n', current_time('timestamp')); |
|
316 | + $current_year = date('Y', current_time('timestamp')); |
|
317 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
318 | 318 | |
319 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
320 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
319 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
320 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
321 | 321 | |
322 | 322 | // Cache for one day |
323 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
323 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
324 | 324 | } |
325 | 325 | |
326 | - return maybe_unserialize( $estimated ); |
|
326 | + return maybe_unserialize($estimated); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | function give_reports_set_form_method() { |
337 | 337 | return 'get'; |
338 | 338 | } |
339 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
340 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
339 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
340 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
341 | 341 | |
342 | 342 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
39 | - add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10 ); |
|
40 | - add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard'), 10 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | + add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10); |
|
40 | + add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | public function add_roles() { |
54 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
54 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
55 | 55 | 'read' => true, |
56 | 56 | 'edit_posts' => true, |
57 | 57 | 'delete_posts' => true, |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | 'publish_posts' => true, |
81 | 81 | 'read_private_pages' => true, |
82 | 82 | 'read_private_posts' => true, |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
85 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
86 | 86 | 'read' => true, |
87 | 87 | 'edit_posts' => false, |
88 | 88 | 'delete_posts' => false |
89 | - ) ); |
|
89 | + )); |
|
90 | 90 | |
91 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
91 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
92 | 92 | 'read' => true, |
93 | 93 | 'edit_posts' => true, |
94 | 94 | 'edit_pages' => true, |
95 | 95 | 'upload_files' => true, |
96 | 96 | 'delete_posts' => false, |
97 | - ) ); |
|
97 | + )); |
|
98 | 98 | |
99 | - add_role( 'give_donor', __( 'Give Donor', 'give' ), array( |
|
99 | + add_role('give_donor', __('Give Donor', 'give'), array( |
|
100 | 100 | 'read' => true, |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
@@ -117,38 +117,38 @@ discard block |
||
117 | 117 | public function add_caps() { |
118 | 118 | global $wp_roles; |
119 | 119 | |
120 | - if ( class_exists( 'WP_Roles' ) ) { |
|
121 | - if ( ! isset( $wp_roles ) ) { |
|
120 | + if (class_exists('WP_Roles')) { |
|
121 | + if ( ! isset($wp_roles)) { |
|
122 | 122 | $wp_roles = new WP_Roles(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if ( is_object( $wp_roles ) ) { |
|
127 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
129 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
130 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
126 | + if (is_object($wp_roles)) { |
|
127 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
128 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
129 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
130 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
131 | 131 | |
132 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
133 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
134 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
135 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
132 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
133 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
134 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
135 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
136 | 136 | |
137 | 137 | // Add the main post type capabilities. |
138 | 138 | $capabilities = $this->get_core_caps(); |
139 | - foreach ( $capabilities as $cap_group ) { |
|
140 | - foreach ( $cap_group as $cap ) { |
|
141 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
142 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
143 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
139 | + foreach ($capabilities as $cap_group) { |
|
140 | + foreach ($cap_group as $cap) { |
|
141 | + $wp_roles->add_cap('administrator', $cap); |
|
142 | + $wp_roles->add_cap('give_manager', $cap); |
|
143 | + $wp_roles->add_cap('give_worker', $cap); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
148 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
149 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
150 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
151 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
147 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
148 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
149 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
150 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
151 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function get_core_caps() { |
167 | 167 | $capabilities = array(); |
168 | 168 | |
169 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
169 | + $capability_types = array('give_form', 'give_payment'); |
|
170 | 170 | |
171 | - foreach ( $capability_types as $capability_type ) { |
|
172 | - $capabilities[ $capability_type ] = array( |
|
171 | + foreach ($capability_types as $capability_type) { |
|
172 | + $capabilities[$capability_type] = array( |
|
173 | 173 | // Post type. |
174 | 174 | "edit_{$capability_type}", |
175 | 175 | "read_{$capability_type}", |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return array $caps Meta capabilities. |
217 | 217 | */ |
218 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
218 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
219 | 219 | |
220 | - switch ( $cap ) { |
|
220 | + switch ($cap) { |
|
221 | 221 | |
222 | 222 | case 'view_give_form_stats' : |
223 | 223 | |
224 | - if ( empty( $args[0] ) ) { |
|
224 | + if (empty($args[0])) { |
|
225 | 225 | break; |
226 | 226 | } |
227 | 227 | |
228 | - $form = get_post( $args[0] ); |
|
229 | - if ( empty( $form ) ) { |
|
228 | + $form = get_post($args[0]); |
|
229 | + if (empty($form)) { |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | |
233 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
233 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
234 | 234 | $caps = array(); |
235 | 235 | } |
236 | 236 | |
@@ -257,41 +257,41 @@ discard block |
||
257 | 257 | |
258 | 258 | global $wp_roles; |
259 | 259 | |
260 | - if ( class_exists( 'WP_Roles' ) ) { |
|
261 | - if ( ! isset( $wp_roles ) ) { |
|
260 | + if (class_exists('WP_Roles')) { |
|
261 | + if ( ! isset($wp_roles)) { |
|
262 | 262 | $wp_roles = new WP_Roles(); |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( is_object( $wp_roles ) ) { |
|
266 | + if (is_object($wp_roles)) { |
|
267 | 267 | // Give Manager Capabilities. |
268 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
269 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
270 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
271 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
268 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
269 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
270 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
271 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
272 | 272 | |
273 | 273 | // Site Administrator Capabilities. |
274 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
275 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
276 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
277 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
274 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
275 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
276 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
277 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
278 | 278 | |
279 | 279 | // Remove the Main Post Type Capabilities. |
280 | 280 | $capabilities = $this->get_core_caps(); |
281 | 281 | |
282 | - foreach ( $capabilities as $cap_group ) { |
|
283 | - foreach ( $cap_group as $cap ) { |
|
284 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
285 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
286 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
282 | + foreach ($capabilities as $cap_group) { |
|
283 | + foreach ($cap_group as $cap) { |
|
284 | + $wp_roles->remove_cap('give_manager', $cap); |
|
285 | + $wp_roles->remove_cap('administrator', $cap); |
|
286 | + $wp_roles->remove_cap('give_worker', $cap); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | 290 | /** Give Accountant Capabilities */ |
291 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
292 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
293 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
294 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
291 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
292 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
293 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
294 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $current_user = wp_get_current_user(); |
312 | 312 | |
313 | 313 | // If user with "Give Accountant" user role is logged-in . |
314 | - if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) { |
|
314 | + if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) { |
|
315 | 315 | |
316 | 316 | // Return false, means no prevention. |
317 | 317 | return false; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | 39 | 'currency' => give_get_currency(), |
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => __('Loading...', 'give'), |
|
47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION, |
50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,81 +58,81 @@ discard block |
||
58 | 58 | 'give_form_translation_js', |
59 | 59 | array( |
60 | 60 | // Field name Validation message. |
61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
68 | 68 | ) |
69 | 69 | ), |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | |
72 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
72 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
73 | 73 | 'ajaxurl' => give_get_ajax_url(), |
74 | - 'loading' => __( 'Loading', 'give' ), |
|
74 | + 'loading' => __('Loading', 'give'), |
|
75 | 75 | // General loading message. |
76 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
76 | + 'select_option' => __('Please select an option', 'give'), |
|
77 | 77 | // Variable pricing error with multi-donation option enabled. |
78 | - 'default_gateway' => give_get_default_gateway( null ), |
|
79 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
78 | + 'default_gateway' => give_get_default_gateway(null), |
|
79 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
80 | 80 | 'number_decimals' => give_get_price_decimals(), |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | 83 | // DEBUG is On. |
84 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
84 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
85 | 85 | |
86 | - if ( give_is_cc_verify_enabled() ) { |
|
87 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-cc-validator' ); |
|
86 | + if (give_is_cc_verify_enabled()) { |
|
87 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-cc-validator'); |
|
89 | 89 | } |
90 | 90 | |
91 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-float-labels' ); |
|
91 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-float-labels'); |
|
93 | 93 | |
94 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
95 | - wp_enqueue_script( 'give-blockui' ); |
|
94 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
95 | + wp_enqueue_script('give-blockui'); |
|
96 | 96 | |
97 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
98 | - wp_enqueue_script( 'give-qtip' ); |
|
97 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
98 | + wp_enqueue_script('give-qtip'); |
|
99 | 99 | |
100 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
101 | - wp_enqueue_script( 'give-accounting' ); |
|
100 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
101 | + wp_enqueue_script('give-accounting'); |
|
102 | 102 | |
103 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
104 | - wp_enqueue_script( 'give-magnific' ); |
|
103 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
104 | + wp_enqueue_script('give-magnific'); |
|
105 | 105 | |
106 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give-checkout-global' ); |
|
106 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give-checkout-global'); |
|
108 | 108 | |
109 | 109 | // General scripts. |
110 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
111 | - wp_enqueue_script( 'give-scripts' ); |
|
110 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
111 | + wp_enqueue_script('give-scripts'); |
|
112 | 112 | |
113 | 113 | // Load AJAX scripts, if enabled. |
114 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
115 | - wp_enqueue_script( 'give-ajax' ); |
|
114 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
115 | + wp_enqueue_script('give-ajax'); |
|
116 | 116 | |
117 | 117 | // Localize / Pass AJAX vars from PHP, |
118 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
119 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
118 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
119 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
123 | 123 | // DEBUG is OFF (one JS file to rule them all!). |
124 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
125 | - wp_enqueue_script( 'give' ); |
|
124 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
125 | + wp_enqueue_script('give'); |
|
126 | 126 | |
127 | 127 | // Localize / Pass AJAX vars from PHP. |
128 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
129 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
128 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
129 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
135 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Register styles. |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function give_register_styles() { |
147 | 147 | |
148 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
148 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
153 | - wp_enqueue_style( 'give-styles' ); |
|
152 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
153 | + wp_enqueue_style('give-styles'); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
157 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | /** |
@@ -167,19 +167,19 @@ discard block |
||
167 | 167 | function give_get_stylesheet_uri() { |
168 | 168 | |
169 | 169 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
170 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
170 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
171 | 171 | |
172 | 172 | // LTR or RTL files. |
173 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
173 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
174 | 174 | |
175 | - $file = 'give' . $direction . $suffix . '.css'; |
|
175 | + $file = 'give'.$direction.$suffix.'.css'; |
|
176 | 176 | $templates_dir = give_get_theme_template_dir_name(); |
177 | 177 | |
178 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
179 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
180 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
181 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
178 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
179 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
180 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
181 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
182 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
183 | 183 | |
184 | 184 | $uri = false; |
185 | 185 | |
@@ -189,23 +189,23 @@ discard block |
||
189 | 189 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
190 | 190 | * This allows users to copy just give.css to their theme. |
191 | 191 | */ |
192 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
193 | - if ( ! empty( $nonmin ) ) { |
|
194 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
192 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
193 | + if ( ! empty($nonmin)) { |
|
194 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
195 | 195 | } else { |
196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
197 | 197 | } |
198 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
199 | - if ( ! empty( $nonmin ) ) { |
|
200 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
198 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
199 | + if ( ! empty($nonmin)) { |
|
200 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
201 | 201 | } else { |
202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
203 | 203 | } |
204 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
205 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
204 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
205 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
208 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -222,79 +222,79 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return void |
224 | 224 | */ |
225 | -function give_load_admin_scripts( $hook ) { |
|
225 | +function give_load_admin_scripts($hook) { |
|
226 | 226 | |
227 | 227 | global $post, $post_type; |
228 | 228 | |
229 | 229 | $give_options = give_get_settings(); |
230 | 230 | |
231 | 231 | // Directories of assets. |
232 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
233 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
234 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
232 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
233 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
234 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
235 | 235 | |
236 | 236 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
237 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
237 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
238 | 238 | |
239 | 239 | // LTR or RTL files. |
240 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
240 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
241 | 241 | |
242 | 242 | // Global Admin. |
243 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
244 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
243 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
244 | + wp_enqueue_style('give-admin-bar-notification'); |
|
245 | 245 | |
246 | 246 | // Give Admin Only. |
247 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
247 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | 251 | // CSS. |
252 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
253 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
254 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
255 | - wp_enqueue_style( 'give-admin' ); |
|
256 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
257 | - wp_enqueue_style( 'jquery-chosen' ); |
|
258 | - wp_enqueue_style( 'thickbox' ); |
|
259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
252 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
253 | + wp_enqueue_style('jquery-ui-css'); |
|
254 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
255 | + wp_enqueue_style('give-admin'); |
|
256 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
257 | + wp_enqueue_style('jquery-chosen'); |
|
258 | + wp_enqueue_style('thickbox'); |
|
259 | + wp_enqueue_style('wp-color-picker'); |
|
260 | 260 | |
261 | 261 | |
262 | 262 | // JS. |
263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-selector-cache'); |
|
265 | 265 | |
266 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
267 | - wp_enqueue_script( 'jquery-chosen' ); |
|
266 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
267 | + wp_enqueue_script('jquery-chosen'); |
|
268 | 268 | |
269 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
270 | - wp_enqueue_script( 'give-accounting' ); |
|
269 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
270 | + wp_enqueue_script('give-accounting'); |
|
271 | 271 | |
272 | - wp_enqueue_script( 'wp-color-picker' ); |
|
273 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
274 | - wp_enqueue_script( 'thickbox' ); |
|
272 | + wp_enqueue_script('wp-color-picker'); |
|
273 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
274 | + wp_enqueue_script('thickbox'); |
|
275 | 275 | |
276 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
277 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
276 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
277 | + wp_enqueue_script('give-admin-scripts'); |
|
278 | 278 | |
279 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
280 | - wp_enqueue_script( 'jquery-flot' ); |
|
279 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
280 | + wp_enqueue_script('jquery-flot'); |
|
281 | 281 | |
282 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
283 | - wp_enqueue_script( 'give-qtip' ); |
|
282 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
283 | + wp_enqueue_script('give-qtip'); |
|
284 | 284 | |
285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
286 | + wp_enqueue_script('give-repeatable-fields'); |
|
287 | 287 | |
288 | 288 | // Forms CPT Script. |
289 | - if ( $post_type === 'give_forms' ) { |
|
290 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
291 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
289 | + if ($post_type === 'give_forms') { |
|
290 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
291 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Settings Scripts. |
295 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
296 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
297 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
295 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
296 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
297 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // Price Separators. |
@@ -302,81 +302,81 @@ discard block |
||
302 | 302 | $decimal_separator = give_get_price_decimal_separator(); |
303 | 303 | |
304 | 304 | // Localize strings & variables for JS. |
305 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
306 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
305 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
306 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
307 | 307 | 'give_version' => GIVE_VERSION, |
308 | 308 | 'thousands_separator' => $thousand_separator, |
309 | 309 | 'decimal_separator' => $decimal_separator, |
310 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
311 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
312 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
313 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
314 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
315 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
316 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
317 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
318 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
319 | - 'currency_sign' => give_currency_filter( '' ), |
|
320 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
321 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
322 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
323 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
324 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
325 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
326 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
327 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
310 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
311 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
312 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
313 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
314 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
315 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
316 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
317 | + 'one_option' => __('Choose a form', 'give'), |
|
318 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
319 | + 'currency_sign' => give_currency_filter(''), |
|
320 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
321 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
322 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
323 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
324 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
325 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
326 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
327 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
328 | 328 | /* translators : %s: Donation form options metabox */ |
329 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
330 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
331 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
332 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
333 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
334 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
335 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
329 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
330 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
331 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
332 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
333 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
334 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
335 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
336 | 336 | 'bulk_action' => array( |
337 | 337 | 'delete' => array( |
338 | - 'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
339 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
340 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
338 | + 'zero' => __('You must choose at least one or more payments to delete.', 'give'), |
|
339 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
340 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
341 | 341 | ), |
342 | 342 | 'resend-receipt' => array( |
343 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
344 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
345 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
343 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
344 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
345 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
346 | 346 | ), |
347 | 347 | 'set-to-status' => array( |
348 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
349 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
350 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
348 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
349 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
350 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
351 | 351 | ), |
352 | 352 | ), |
353 | 353 | 'metabox_fields' => array( |
354 | 354 | 'media' => array( |
355 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
355 | + 'button_title' => __('Choose Image', 'give'), |
|
356 | 356 | ), |
357 | 357 | 'file' => array( |
358 | - 'button_title' => __( 'Choose File', 'give' ), |
|
358 | + 'button_title' => __('Choose File', 'give'), |
|
359 | 359 | ), |
360 | 360 | ), |
361 | 361 | 'chosen' => array( |
362 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
363 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
362 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
363 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
364 | 364 | ), |
365 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
366 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
367 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
365 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
366 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
367 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
368 | 368 | 'give_donation_import' => 'give_donation_import', |
369 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
370 | - ) ); |
|
369 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
370 | + )); |
|
371 | 371 | |
372 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
372 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
373 | 373 | // call for new media manager. |
374 | 374 | wp_enqueue_media(); |
375 | 375 | } |
376 | 376 | |
377 | 377 | } |
378 | 378 | |
379 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
379 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Admin Give Icon |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | ?> |
392 | 392 | <style type="text/css" media="screen"> |
393 | 393 | |
394 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
394 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
395 | 395 | @font-face { |
396 | 396 | font-family: 'give-icomoon'; |
397 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
398 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
399 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
400 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
397 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
398 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
399 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
400 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
401 | 401 | font-weight: normal; |
402 | 402 | font-style: normal; |
403 | 403 | } |
@@ -416,4 +416,4 @@ discard block |
||
416 | 416 | <?php |
417 | 417 | } |
418 | 418 | |
419 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
419 | +add_action('admin_head', 'give_admin_icon'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return bool true if has variable prices, false otherwise |
25 | 25 | */ |
26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
26 | +function give_has_variable_prices($form_id = 0) { |
|
27 | 27 | |
28 | - if ( empty( $form_id ) ) { |
|
28 | + if (empty($form_id)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - $form = new Give_Donate_Form( $form_id ); |
|
32 | + $form = new Give_Donate_Form($form_id); |
|
33 | 33 | |
34 | 34 | return $form->has_variable_prices(); |
35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array|bool Variable prices |
46 | 46 | */ |
47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
47 | +function give_get_variable_prices($form_id = 0) { |
|
48 | 48 | |
49 | - if ( empty( $form_id ) ) { |
|
49 | + if (empty($form_id)) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $form = new Give_Donate_Form( $form_id ); |
|
53 | + $form = new Give_Donate_Form($form_id); |
|
54 | 54 | |
55 | 55 | return $form->prices; |
56 | 56 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array Variable prices |
67 | 67 | */ |
68 | -function give_get_variable_price_ids( $form_id = 0 ) { |
|
69 | - if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) { |
|
68 | +function give_get_variable_price_ids($form_id = 0) { |
|
69 | + if ( ! ($prices = give_get_variable_prices($form_id))) { |
|
70 | 70 | return array(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $price_ids = array(); |
74 | - foreach ( $prices as $price ){ |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | $price_ids[] = $price['_give_id']['level_id']; |
76 | 76 | } |
77 | 77 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string $default_price |
91 | 91 | */ |
92 | -function give_get_default_multilevel_amount( $form_id ) { |
|
92 | +function give_get_default_multilevel_amount($form_id) { |
|
93 | 93 | $default_price = '1.00'; |
94 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
94 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
95 | 95 | |
96 | - foreach ( $prices as $price ) { |
|
96 | + foreach ($prices as $price) { |
|
97 | 97 | |
98 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
98 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
99 | 99 | $default_price = $price['_give_amount']; |
100 | 100 | } |
101 | 101 | |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | * @return string $default_price |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | -function give_get_default_form_amount( $form_id ) { |
|
119 | +function give_get_default_form_amount($form_id) { |
|
120 | 120 | |
121 | - if ( give_has_variable_prices( $form_id ) ) { |
|
121 | + if (give_has_variable_prices($form_id)) { |
|
122 | 122 | |
123 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
123 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
124 | 124 | |
125 | 125 | } else { |
126 | 126 | |
127 | - $default_amount = give_get_meta( $form_id, '_give_set_price', true ); |
|
127 | + $default_amount = give_get_meta($form_id, '_give_set_price', true); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_default_form_amount', $default_amount, $form_id ); |
|
131 | + return apply_filters('give_default_form_amount', $default_amount, $form_id); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
149 | +function give_is_custom_price_mode($form_id = 0) { |
|
150 | 150 | |
151 | - if ( empty( $form_id ) ) { |
|
151 | + if (empty($form_id)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | - $form = new Give_Donate_Form( $form_id ); |
|
155 | + $form = new Give_Donate_Form($form_id); |
|
156 | 156 | |
157 | 157 | return $form->is_custom_price_mode(); |
158 | 158 | } |
159 | 159 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /* @var WPDB $wpdb */ |
44 | 44 | global $wpdb; |
45 | 45 | |
46 | - $wpdb->customermeta = $this->table_name = $wpdb->prefix . 'give_customermeta'; |
|
46 | + $wpdb->customermeta = $this->table_name = $wpdb->prefix.'give_customermeta'; |
|
47 | 47 | $this->primary_key = 'meta_id'; |
48 | 48 | $this->version = '1.0'; |
49 | 49 | |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
83 | 83 | */ |
84 | - public function get_meta( $donor_id = 0, $meta_key = '', $single = false ) { |
|
85 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
86 | - if ( false === $donor_id ) { |
|
84 | + public function get_meta($donor_id = 0, $meta_key = '', $single = false) { |
|
85 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
86 | + if (false === $donor_id) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | |
90 | - return get_metadata( 'customer', $donor_id, $meta_key, $single ); |
|
90 | + return get_metadata('customer', $donor_id, $meta_key, $single); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return bool False for failure. True for success. |
107 | 107 | */ |
108 | - public function add_meta( $donor_id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
109 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
110 | - if ( false === $donor_id ) { |
|
108 | + public function add_meta($donor_id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
109 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
110 | + if (false === $donor_id) { |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 | |
114 | - return add_metadata( 'customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
114 | + return add_metadata('customer', $donor_id, $meta_key, $meta_value, $unique); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return bool False on failure, true if success. |
136 | 136 | */ |
137 | - public function update_meta( $donor_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
138 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
139 | - if ( false === $donor_id ) { |
|
137 | + public function update_meta($donor_id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
138 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
139 | + if (false === $donor_id) { |
|
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | |
143 | - return update_metadata( 'customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
143 | + return update_metadata('customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return bool False for failure. True for success. |
163 | 163 | */ |
164 | - public function delete_meta( $donor_id = 0, $meta_key = '', $meta_value = '' ) { |
|
165 | - return delete_metadata( 'customer', $donor_id, $meta_key, $meta_value ); |
|
164 | + public function delete_meta($donor_id = 0, $meta_key = '', $meta_value = '') { |
|
165 | + return delete_metadata('customer', $donor_id, $meta_key, $meta_value); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool False for failure. True for success. |
177 | 177 | */ |
178 | - public function delete_all_meta( $donor_id = 0 ) { |
|
178 | + public function delete_all_meta($donor_id = 0) { |
|
179 | 179 | global $wpdb; |
180 | - $wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) ); |
|
180 | + $wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d')); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function create_table() { |
192 | 192 | |
193 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
193 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
194 | 194 | |
195 | 195 | $sql = "CREATE TABLE {$this->table_name} ( |
196 | 196 | meta_id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | KEY meta_key (meta_key) |
203 | 203 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
204 | 204 | |
205 | - dbDelta( $sql ); |
|
205 | + dbDelta($sql); |
|
206 | 206 | |
207 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
207 | + update_option($this->table_name.'_db_version', $this->version); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -217,23 +217,23 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return int|bool The normalized donor ID or false if it's found to not be valid. |
219 | 219 | */ |
220 | - private function sanitize_donor_id( $donor_id ) { |
|
221 | - if ( ! is_numeric( $donor_id ) ) { |
|
220 | + private function sanitize_donor_id($donor_id) { |
|
221 | + if ( ! is_numeric($donor_id)) { |
|
222 | 222 | return false; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $donor_id = (int) $donor_id; |
226 | 226 | |
227 | 227 | // We were given a non positive number. |
228 | - if ( absint( $donor_id ) !== $donor_id ) { |
|
228 | + if (absint($donor_id) !== $donor_id) { |
|
229 | 229 | return false; |
230 | 230 | } |
231 | 231 | |
232 | - if ( empty( $donor_id ) ) { |
|
232 | + if (empty($donor_id)) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | - return absint( $donor_id ); |
|
236 | + return absint($donor_id); |
|
237 | 237 | |
238 | 238 | } |
239 | 239 |