@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include($located); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $slug Template part file slug {slug}.php. |
119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
120 | 120 | */ |
121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
122 | 122 | |
123 | 123 | // Setup possible parts |
124 | 124 | $templates = array(); |
125 | - if ( isset( $name ) ) { |
|
126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
125 | + if (isset($name)) { |
|
126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
127 | 127 | } |
128 | - $templates[] = $slug . '.php'; |
|
128 | + $templates[] = $slug.'.php'; |
|
129 | 129 | |
130 | 130 | // Allow template parts to be filtered |
131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
132 | 132 | |
133 | 133 | // Return the part that is found |
134 | - return give_locate_template( $templates, $load, false ); |
|
134 | + return give_locate_template($templates, $load, false); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string The template filename if one is located. |
154 | 154 | */ |
155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
156 | 156 | // No file found yet |
157 | 157 | $located = false; |
158 | 158 | |
159 | 159 | // Try to find a template file |
160 | - foreach ( (array) $template_names as $template_name ) { |
|
160 | + foreach ((array) $template_names as $template_name) { |
|
161 | 161 | |
162 | 162 | // Continue if template is empty |
163 | - if ( empty( $template_name ) ) { |
|
163 | + if (empty($template_name)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Trim off any slashes from the template name |
168 | - $template_name = ltrim( $template_name, '/' ); |
|
168 | + $template_name = ltrim($template_name, '/'); |
|
169 | 169 | |
170 | 170 | // try locating this template file by looping through the template paths |
171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
172 | 172 | |
173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
174 | - $located = $template_path . $template_name; |
|
173 | + if (file_exists($template_path.$template_name)) { |
|
174 | + $located = $template_path.$template_name; |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( $located ) { |
|
179 | + if ($located) { |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
185 | - load_template( $located, $require_once ); |
|
184 | + if ((true == $load) && ! empty($located)) { |
|
185 | + load_template($located, $require_once); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
200 | 200 | |
201 | 201 | $file_paths = array( |
202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
204 | 204 | 100 => give_get_templates_dir() |
205 | 205 | ); |
206 | 206 | |
207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
208 | 208 | |
209 | 209 | // sort the file paths based on priority |
210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
210 | + ksort($file_paths, SORT_NUMERIC); |
|
211 | 211 | |
212 | - return array_map( 'trailingslashit', $file_paths ); |
|
212 | + return array_map('trailingslashit', $file_paths); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | */ |
223 | 223 | function give_get_theme_template_dir_name() { |
224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @return void |
232 | 232 | */ |
233 | 233 | function give_version_in_header() { |
234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
237 | +add_action('wp_head', 'give_version_in_header'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function give_is_donation_history_page() { |
246 | 246 | |
247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
247 | + $ret = is_page(give_get_option('history_page')); |
|
248 | 248 | |
249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array Modified array of classes |
260 | 260 | */ |
261 | -function give_add_body_classes( $class ) { |
|
261 | +function give_add_body_classes($class) { |
|
262 | 262 | $classes = (array) $class; |
263 | 263 | |
264 | - if ( give_is_success_page() ) { |
|
264 | + if (give_is_success_page()) { |
|
265 | 265 | $classes[] = 'give-success'; |
266 | 266 | $classes[] = 'give-page'; |
267 | 267 | } |
268 | 268 | |
269 | - if ( give_is_failed_transaction_page() ) { |
|
269 | + if (give_is_failed_transaction_page()) { |
|
270 | 270 | $classes[] = 'give-failed-transaction'; |
271 | 271 | $classes[] = 'give-page'; |
272 | 272 | } |
273 | 273 | |
274 | - if ( give_is_donation_history_page() ) { |
|
274 | + if (give_is_donation_history_page()) { |
|
275 | 275 | $classes[] = 'give-donation-history'; |
276 | 276 | $classes[] = 'give-page'; |
277 | 277 | } |
278 | 278 | |
279 | - if ( give_is_test_mode() ) { |
|
279 | + if (give_is_test_mode()) { |
|
280 | 280 | $classes[] = 'give-test-mode'; |
281 | 281 | $classes[] = 'give-page'; |
282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
285 | 285 | $current_theme = wp_get_theme(); |
286 | 286 | |
287 | - switch ( $current_theme->template ) { |
|
287 | + switch ($current_theme->template) { |
|
288 | 288 | |
289 | 289 | case 'Divi': |
290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | - return array_unique( $classes ); |
|
301 | + return array_unique($classes); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
304 | +add_filter('body_class', 'give_add_body_classes'); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array |
319 | 319 | */ |
320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
322 | 322 | return $classes; |
323 | 323 | } |
324 | 324 | |
325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
326 | 326 | |
327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
328 | - unset( $classes[ $key ] ); |
|
327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
328 | + unset($classes[$key]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,84 +342,84 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_get_placeholder_img_src() { |
344 | 344 | |
345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
346 | 346 | |
347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Global |
353 | 353 | */ |
354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Output the start of the page wrapper. |
358 | 358 | */ |
359 | 359 | function give_output_content_wrapper() { |
360 | - give_get_template_part( 'global/wrapper-start' ); |
|
360 | + give_get_template_part('global/wrapper-start'); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Output the end of the page wrapper. |
367 | 367 | */ |
368 | 368 | function give_output_content_wrapper_end() { |
369 | - give_get_template_part( 'global/wrapper-end' ); |
|
369 | + give_get_template_part('global/wrapper-end'); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Single Give Form |
375 | 375 | */ |
376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
377 | 377 | function give_left_sidebar_pre_wrap() { |
378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
383 | 383 | function give_left_sidebar_post_wrap() { |
384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
389 | 389 | function give_get_forms_sidebar() { |
390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
390 | + give_get_template_part('single-give-form/sidebar'); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
394 | +if ( ! function_exists('give_show_form_images')) { |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Output the donation form featured image. |
398 | 398 | */ |
399 | 399 | function give_show_form_images() { |
400 | - if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
401 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
400 | + if (give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
401 | + give_get_template_part('single-give-form/featured-image'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
406 | +if ( ! function_exists('give_template_single_title')) { |
|
407 | 407 | |
408 | 408 | /** |
409 | 409 | * Output the form title. |
410 | 410 | */ |
411 | 411 | function give_template_single_title() { |
412 | - give_get_template_part( 'single-give-form/title' ); |
|
412 | + give_get_template_part('single-give-form/title'); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
416 | +if ( ! function_exists('give_show_avatars')) { |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Output the product title. |
420 | 420 | */ |
421 | 421 | function give_show_avatars() { |
422 | - echo do_shortcode( '[give_donors_gravatars]' ); |
|
422 | + echo do_shortcode('[give_donors_gravatars]'); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * Conditional Functions |
428 | 428 | */ |
429 | 429 | |
430 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
430 | +if ( ! function_exists('is_give_form')) { |
|
431 | 431 | |
432 | 432 | /** |
433 | 433 | * is_give_form |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | * @return bool |
440 | 440 | */ |
441 | 441 | function is_give_form() { |
442 | - return is_singular( array( 'give_form' ) ); |
|
442 | + return is_singular(array('give_form')); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
446 | +if ( ! function_exists('is_give_category')) { |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * is_give_category |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return bool |
460 | 460 | */ |
461 | - function is_give_category( $term = '' ) { |
|
462 | - return is_tax( 'give_forms_category', $term ); |
|
461 | + function is_give_category($term = '') { |
|
462 | + return is_tax('give_forms_category', $term); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
466 | +if ( ! function_exists('is_give_tag')) { |
|
467 | 467 | |
468 | 468 | /** |
469 | 469 | * is_give_tag |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return bool |
480 | 480 | */ |
481 | - function is_give_tag( $term = '' ) { |
|
482 | - return is_tax( 'give_forms_tag', $term ); |
|
481 | + function is_give_tag($term = '') { |
|
482 | + return is_tax('give_forms_tag', $term); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
486 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
486 | +if ( ! function_exists('is_give_taxonomy')) { |
|
487 | 487 | |
488 | 488 | /** |
489 | 489 | * is_give_taxonomy |
@@ -495,6 +495,6 @@ discard block |
||
495 | 495 | * @return bool |
496 | 496 | */ |
497 | 497 | function is_give_taxonomy() { |
498 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
498 | + return is_tax(get_object_taxonomies('give_form')); |
|
499 | 499 | } |
500 | 500 | } |
@@ -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 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @since 1.5 |
33 | 33 | */ |
34 | - do_action( 'give_tools_recount_stats_before' ); |
|
34 | + do_action('give_tools_recount_stats_before'); |
|
35 | 35 | ?> |
36 | 36 | <div id="poststuff"> |
37 | 37 | <div class="postbox"> |
38 | 38 | |
39 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
39 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
40 | 40 | |
41 | 41 | <div class="inside recount-stats-controls"> |
42 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
42 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
43 | 43 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
44 | 44 | |
45 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
45 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
46 | 46 | |
47 | 47 | <select name="give-export-class" id="recount-stats-type"> |
48 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
49 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
50 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
51 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
52 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
53 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
54 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
48 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
49 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
50 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
51 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
52 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
53 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
54 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
55 | 55 | <?php |
56 | 56 | /** |
57 | 57 | * Fires in the recount stats selectbox. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.5 |
62 | 62 | */ |
63 | - do_action( 'give_recount_tool_options' ); |
|
63 | + do_action('give_recount_tool_options'); |
|
64 | 64 | ?> |
65 | 65 | </select> |
66 | 66 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | $args = array( |
70 | 70 | 'name' => 'form_id', |
71 | - 'number' => - 1, |
|
71 | + 'number' => -1, |
|
72 | 72 | 'chosen' => true, |
73 | 73 | ); |
74 | - echo Give()->html->forms_dropdown( $args ); |
|
74 | + echo Give()->html->forms_dropdown($args); |
|
75 | 75 | ?> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,5 +120,5 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | - do_action( 'give_tools_recount_stats_after' ); |
|
123 | + do_action('give_tools_recount_stats_after'); |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_API' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_API')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_API. |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'api'; |
46 | - $this->label = esc_html__( 'API', 'give' ); |
|
46 | + $this->label = esc_html__('API', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param array $pages Lst of pages. |
57 | 57 | * @return array |
58 | 58 | */ |
59 | - public function add_settings_page( $pages ) { |
|
60 | - $pages[ $this->id ] = $this->label; |
|
59 | + public function add_settings_page($pages) { |
|
60 | + $pages[$this->id] = $this->label; |
|
61 | 61 | |
62 | 62 | return $pages; |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $GLOBALS['give_hide_save_button'] = true; |
74 | 74 | |
75 | 75 | // Get settings. |
76 | - $settings = apply_filters( 'give_settings_system', array( |
|
76 | + $settings = apply_filters('give_settings_system', array( |
|
77 | 77 | array( |
78 | 78 | 'id' => 'give_tools_api', |
79 | 79 | 'type' => 'title', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ), |
82 | 82 | array( |
83 | 83 | 'id' => 'api', |
84 | - 'name' => esc_html__( 'API', 'give' ), |
|
84 | + 'name' => esc_html__('API', 'give'), |
|
85 | 85 | 'type' => 'api', |
86 | 86 | ), |
87 | 87 | array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @since 1.8 |
98 | 98 | * @param array $settings |
99 | 99 | */ |
100 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
100 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
101 | 101 | |
102 | 102 | // Output. |
103 | 103 | return $settings; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function output() { |
113 | 113 | $settings = $this->get_settings(); |
114 | 114 | |
115 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
115 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Data. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'data'; |
46 | - $this->label = esc_html__( 'Data', 'give' ); |
|
46 | + $this->label = esc_html__('Data', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['give_hide_save_button'] = true; |
80 | 80 | |
81 | 81 | // Get settings. |
82 | - $settings = apply_filters( 'give_settings_system', array( |
|
82 | + $settings = apply_filters('give_settings_system', array( |
|
83 | 83 | array( |
84 | 84 | 'id' => 'give_tools_tools', |
85 | 85 | 'type' => 'title', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | array( |
89 | 89 | 'id' => 'api', |
90 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
90 | + 'name' => esc_html__('Tools', 'give'), |
|
91 | 91 | 'type' => 'data', |
92 | 92 | ), |
93 | 93 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.8 |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function output() { |
119 | 119 | $settings = $this->get_settings(); |
120 | 120 | |
121 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
121 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |
@@ -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,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
293 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
293 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return array $email_names |
346 | 346 | */ |
347 | -function give_get_email_names( $user_info ) { |
|
347 | +function give_get_email_names($user_info) { |
|
348 | 348 | $email_names = array(); |
349 | - $user_info = maybe_unserialize( $user_info ); |
|
349 | + $user_info = maybe_unserialize($user_info); |
|
350 | 350 | |
351 | 351 | $email_names['fullname'] = ''; |
352 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
353 | - $user_data = get_userdata( $user_info['id'] ); |
|
352 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
353 | + $user_data = get_userdata($user_info['id']); |
|
354 | 354 | $email_names['name'] = $user_info['first_name']; |
355 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
355 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
356 | 356 | $email_names['username'] = $user_data->user_login; |
357 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
357 | + } elseif (isset($user_info['first_name'])) { |
|
358 | 358 | $email_names['name'] = $user_info['first_name']; |
359 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
359 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
360 | 360 | $email_names['username'] = $user_info['first_name']; |
361 | 361 | } else { |
362 | 362 | $email_names['name'] = $user_info['email']; |
@@ -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 | |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | * @param bool $_id Post id. Default is false. |
337 | 337 | * @param array $_args Arguments passed. |
338 | 338 | */ |
339 | - public function __construct( $_id = false, $_args = array() ) { |
|
339 | + public function __construct($_id = false, $_args = array()) { |
|
340 | 340 | |
341 | - $donation_form = WP_Post::get_instance( $_id ); |
|
341 | + $donation_form = WP_Post::get_instance($_id); |
|
342 | 342 | |
343 | - return $this->setup_donation_form( $donation_form ); |
|
343 | + return $this->setup_donation_form($donation_form); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return bool If the setup was successful or not. |
355 | 355 | */ |
356 | - private function setup_donation_form( $donation_form ) { |
|
356 | + private function setup_donation_form($donation_form) { |
|
357 | 357 | |
358 | - if ( ! is_object( $donation_form ) ) { |
|
358 | + if ( ! is_object($donation_form)) { |
|
359 | 359 | return false; |
360 | 360 | } |
361 | 361 | |
362 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
362 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
363 | 363 | return false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
366 | + if ('give_forms' !== $donation_form->post_type) { |
|
367 | 367 | return false; |
368 | 368 | } |
369 | 369 | |
370 | - foreach ( $donation_form as $key => $value ) { |
|
370 | + foreach ($donation_form as $key => $value) { |
|
371 | 371 | |
372 | - switch ( $key ) { |
|
372 | + switch ($key) { |
|
373 | 373 | |
374 | 374 | default: |
375 | 375 | $this->$key = $value; |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return mixed |
395 | 395 | */ |
396 | - public function __get( $key ) { |
|
396 | + public function __get($key) { |
|
397 | 397 | |
398 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
398 | + if (method_exists($this, 'get_'.$key)) { |
|
399 | 399 | |
400 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
400 | + return call_user_func(array($this, 'get_'.$key)); |
|
401 | 401 | |
402 | 402 | } else { |
403 | 403 | |
404 | 404 | /* translators: %s: property key */ |
405 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
405 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -418,30 +418,30 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
420 | 420 | */ |
421 | - public function create( $data = array() ) { |
|
421 | + public function create($data = array()) { |
|
422 | 422 | |
423 | - if ( $this->id != 0 ) { |
|
423 | + if ($this->id != 0) { |
|
424 | 424 | return false; |
425 | 425 | } |
426 | 426 | |
427 | 427 | $defaults = array( |
428 | 428 | 'post_type' => 'give_forms', |
429 | 429 | 'post_status' => 'draft', |
430 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
430 | + 'post_title' => __('New Donation Form', 'give'), |
|
431 | 431 | ); |
432 | 432 | |
433 | - $args = wp_parse_args( $data, $defaults ); |
|
433 | + $args = wp_parse_args($data, $defaults); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Fired before a donation form is created |
437 | 437 | * |
438 | 438 | * @param array $args The post object arguments used for creation. |
439 | 439 | */ |
440 | - do_action( 'give_form_pre_create', $args ); |
|
440 | + do_action('give_form_pre_create', $args); |
|
441 | 441 | |
442 | - $id = wp_insert_post( $args, true ); |
|
442 | + $id = wp_insert_post($args, true); |
|
443 | 443 | |
444 | - $donation_form = WP_Post::get_instance( $id ); |
|
444 | + $donation_form = WP_Post::get_instance($id); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Fired after a donation form is created |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | * @param int $id The post ID of the created item. |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_post_create', $id, $args ); |
|
452 | + do_action('give_form_post_create', $id, $args); |
|
453 | 453 | |
454 | - return $this->setup_donation_form( $donation_form ); |
|
454 | + return $this->setup_donation_form($donation_form); |
|
455 | 455 | |
456 | 456 | } |
457 | 457 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @return string Donation form name. |
477 | 477 | */ |
478 | 478 | public function get_name() { |
479 | - return get_the_title( $this->ID ); |
|
479 | + return get_the_title($this->ID); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -489,13 +489,13 @@ discard block |
||
489 | 489 | */ |
490 | 490 | public function get_price() { |
491 | 491 | |
492 | - if ( ! isset( $this->price ) ) { |
|
492 | + if ( ! isset($this->price)) { |
|
493 | 493 | |
494 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
494 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
495 | 495 | |
496 | - if ( $this->price ) { |
|
496 | + if ($this->price) { |
|
497 | 497 | |
498 | - $this->price = give_sanitize_amount( $this->price ); |
|
498 | + $this->price = give_sanitize_amount($this->price); |
|
499 | 499 | |
500 | 500 | } else { |
501 | 501 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param string $price The donation form price. |
514 | 514 | * @param string|int $id The form ID. |
515 | 515 | */ |
516 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
516 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function get_minimum_price() { |
528 | 528 | |
529 | - if ( ! isset( $this->minimum_price ) ) { |
|
529 | + if ( ! isset($this->minimum_price)) { |
|
530 | 530 | |
531 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
532 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
531 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
532 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
533 | 533 | |
534 | - if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) { |
|
534 | + if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) { |
|
535 | 535 | |
536 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
536 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
537 | 537 | |
538 | 538 | } else { |
539 | 539 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | } |
545 | 545 | |
546 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
546 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function get_prices() { |
558 | 558 | |
559 | - if ( ! isset( $this->prices ) ) { |
|
559 | + if ( ! isset($this->prices)) { |
|
560 | 560 | |
561 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
561 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
562 | 562 | |
563 | 563 | } |
564 | 564 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param array $prices The array of mulit-level prices. |
571 | 571 | * @param int|string $ID The ID of the form. |
572 | 572 | */ |
573 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
573 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public function get_goal() { |
586 | 586 | |
587 | - if ( ! isset( $this->goal ) ) { |
|
587 | + if ( ! isset($this->goal)) { |
|
588 | 588 | |
589 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
589 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
590 | 590 | |
591 | - if ( $this->goal ) { |
|
591 | + if ($this->goal) { |
|
592 | 592 | |
593 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
593 | + $this->goal = give_sanitize_amount($this->goal); |
|
594 | 594 | |
595 | 595 | } else { |
596 | 596 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | |
601 | 601 | } |
602 | 602 | |
603 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
603 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
604 | 604 | |
605 | 605 | } |
606 | 606 | |
@@ -614,10 +614,10 @@ discard block |
||
614 | 614 | */ |
615 | 615 | public function is_single_price_mode() { |
616 | 616 | |
617 | - $option = get_post_meta( $this->ID, '_give_price_options_mode', true ); |
|
617 | + $option = get_post_meta($this->ID, '_give_price_options_mode', true); |
|
618 | 618 | $ret = 0; |
619 | 619 | |
620 | - if ( empty( $option ) || $option === 'set' ) { |
|
620 | + if (empty($option) || $option === 'set') { |
|
621 | 621 | $ret = 1; |
622 | 622 | } |
623 | 623 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | * @param bool $ret Is donation form in single price mode? |
630 | 630 | * @param int|string $ID The ID of the donation form. |
631 | 631 | */ |
632 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
632 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
@@ -643,10 +643,10 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function is_custom_price_mode() { |
645 | 645 | |
646 | - $option = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
646 | + $option = get_post_meta($this->ID, '_give_custom_amount', true); |
|
647 | 647 | $ret = 0; |
648 | 648 | |
649 | - if ( give_is_setting_enabled( $option ) ) { |
|
649 | + if (give_is_setting_enabled($option)) { |
|
650 | 650 | $ret = 1; |
651 | 651 | } |
652 | 652 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @param bool $ret Is donation form in custom price mode? |
659 | 659 | * @param int|string $ID The ID of the donation form. |
660 | 660 | */ |
661 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
661 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
662 | 662 | |
663 | 663 | } |
664 | 664 | |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function has_variable_prices() { |
676 | 676 | |
677 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
677 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
678 | 678 | $ret = 0; |
679 | 679 | |
680 | - if ( $option === 'multi' ) { |
|
680 | + if ($option === 'multi') { |
|
681 | 681 | $ret = 1; |
682 | 682 | } |
683 | 683 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param bool $ret Does donation form have variable prices? |
688 | 688 | * @param int|string $ID The ID of the donation form. |
689 | 689 | */ |
690 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
690 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
691 | 691 | |
692 | 692 | } |
693 | 693 | |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function get_type() { |
703 | 703 | |
704 | - if ( ! isset( $this->type ) ) { |
|
704 | + if ( ! isset($this->type)) { |
|
705 | 705 | |
706 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
706 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
707 | 707 | |
708 | - if ( empty( $this->type ) ) { |
|
708 | + if (empty($this->type)) { |
|
709 | 709 | $this->type = 'set'; |
710 | 710 | } |
711 | 711 | |
712 | 712 | } |
713 | 713 | |
714 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
714 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
715 | 715 | |
716 | 716 | } |
717 | 717 | |
@@ -727,23 +727,23 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string |
729 | 729 | */ |
730 | - public function get_form_classes( $args ) { |
|
730 | + public function get_form_classes($args) { |
|
731 | 731 | |
732 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
732 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
733 | 733 | ? 'float-labels-enabled' |
734 | 734 | : ''; |
735 | 735 | |
736 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
736 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
737 | 737 | 'give-form', |
738 | - 'give-form-' . $this->ID, |
|
739 | - 'give-form-type-' . $this->get_type(), |
|
738 | + 'give-form-'.$this->ID, |
|
739 | + 'give-form-type-'.$this->get_type(), |
|
740 | 740 | $float_labels_option, |
741 | - ), $this->ID, $args ); |
|
741 | + ), $this->ID, $args); |
|
742 | 742 | |
743 | 743 | // Remove empty class names. |
744 | - $form_classes_array = array_filter( $form_classes_array ); |
|
744 | + $form_classes_array = array_filter($form_classes_array); |
|
745 | 745 | |
746 | - return implode( ' ', $form_classes_array ); |
|
746 | + return implode(' ', $form_classes_array); |
|
747 | 747 | |
748 | 748 | } |
749 | 749 | |
@@ -758,24 +758,24 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return string |
760 | 760 | */ |
761 | - public function get_form_wrap_classes( $args ) { |
|
761 | + public function get_form_wrap_classes($args) { |
|
762 | 762 | |
763 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
763 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
764 | 764 | ? $args['display_style'] |
765 | - : get_post_meta( $this->ID, '_give_payment_display', true ); |
|
765 | + : get_post_meta($this->ID, '_give_payment_display', true); |
|
766 | 766 | |
767 | 767 | // If admin want to show only button for form then user inbuilt modal functionality. |
768 | - if( 'button' === $display_option ) { |
|
768 | + if ('button' === $display_option) { |
|
769 | 769 | $display_option = 'modal give-display-button-only'; |
770 | 770 | } |
771 | 771 | |
772 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
772 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
773 | 773 | 'give-form-wrap', |
774 | - 'give-display-' . $display_option, |
|
775 | - ), $this->ID, $args ); |
|
774 | + 'give-display-'.$display_option, |
|
775 | + ), $this->ID, $args); |
|
776 | 776 | |
777 | 777 | |
778 | - return implode( ' ', $form_wrap_classes_array ); |
|
778 | + return implode(' ', $form_wrap_classes_array); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | public function is_set_type_donation_form() { |
791 | 791 | $form_type = $this->get_type(); |
792 | 792 | |
793 | - return ( 'set' === $form_type ? true : false ); |
|
793 | + return ('set' === $form_type ? true : false); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | public function is_multi_type_donation_form() { |
805 | 805 | $form_type = $this->get_type(); |
806 | 806 | |
807 | - return ( 'multi' === $form_type ? true : false ); |
|
807 | + return ('multi' === $form_type ? true : false); |
|
808 | 808 | |
809 | 809 | } |
810 | 810 | |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function get_sales() { |
820 | 820 | |
821 | - if ( ! isset( $this->sales ) ) { |
|
821 | + if ( ! isset($this->sales)) { |
|
822 | 822 | |
823 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
824 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
823 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
824 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
825 | 825 | } // End if |
826 | 826 | |
827 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
827 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
828 | 828 | |
829 | - if ( $this->sales < 0 ) { |
|
829 | + if ($this->sales < 0) { |
|
830 | 830 | // Never let sales be less than zero |
831 | 831 | $this->sales = 0; |
832 | 832 | } |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return int|false New number of total sales. |
849 | 849 | */ |
850 | - public function increase_sales( $quantity = 1 ) { |
|
850 | + public function increase_sales($quantity = 1) { |
|
851 | 851 | |
852 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
853 | - $quantity = absint( $quantity ); |
|
852 | + $sales = give_get_form_sales_stats($this->ID); |
|
853 | + $quantity = absint($quantity); |
|
854 | 854 | $total_sales = $sales + $quantity; |
855 | 855 | |
856 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
856 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
857 | 857 | |
858 | 858 | $this->sales = $total_sales; |
859 | 859 | |
@@ -874,17 +874,17 @@ discard block |
||
874 | 874 | * |
875 | 875 | * @return int|false New number of total sales. |
876 | 876 | */ |
877 | - public function decrease_sales( $quantity = 1 ) { |
|
877 | + public function decrease_sales($quantity = 1) { |
|
878 | 878 | |
879 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
879 | + $sales = give_get_form_sales_stats($this->ID); |
|
880 | 880 | |
881 | 881 | // Only decrease if not already zero |
882 | - if ( $sales > 0 ) { |
|
882 | + if ($sales > 0) { |
|
883 | 883 | |
884 | - $quantity = absint( $quantity ); |
|
884 | + $quantity = absint($quantity); |
|
885 | 885 | $total_sales = $sales - $quantity; |
886 | 886 | |
887 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
887 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
888 | 888 | |
889 | 889 | $this->sales = $sales; |
890 | 890 | |
@@ -908,15 +908,15 @@ discard block |
||
908 | 908 | */ |
909 | 909 | public function get_earnings() { |
910 | 910 | |
911 | - if ( ! isset( $this->earnings ) ) { |
|
911 | + if ( ! isset($this->earnings)) { |
|
912 | 912 | |
913 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
914 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
913 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
914 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
915 | 915 | } |
916 | 916 | |
917 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
917 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
918 | 918 | |
919 | - if ( $this->earnings < 0 ) { |
|
919 | + if ($this->earnings < 0) { |
|
920 | 920 | // Never let earnings be less than zero |
921 | 921 | $this->earnings = 0; |
922 | 922 | } |
@@ -937,12 +937,12 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return float|false |
939 | 939 | */ |
940 | - public function increase_earnings( $amount = 0 ) { |
|
940 | + public function increase_earnings($amount = 0) { |
|
941 | 941 | |
942 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
942 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
943 | 943 | $new_amount = $earnings + (float) $amount; |
944 | 944 | |
945 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
945 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
946 | 946 | |
947 | 947 | $this->earnings = $new_amount; |
948 | 948 | |
@@ -964,16 +964,16 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return float|false |
966 | 966 | */ |
967 | - public function decrease_earnings( $amount ) { |
|
967 | + public function decrease_earnings($amount) { |
|
968 | 968 | |
969 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
969 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
970 | 970 | |
971 | - if ( $earnings > 0 ) { |
|
971 | + if ($earnings > 0) { |
|
972 | 972 | // Only decrease if greater than zero |
973 | 973 | $new_amount = $earnings - (float) $amount; |
974 | 974 | |
975 | 975 | |
976 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
976 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
977 | 977 | |
978 | 978 | $this->earnings = $new_amount; |
979 | 979 | |
@@ -997,22 +997,22 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return bool |
999 | 999 | */ |
1000 | - public function is_free( $price_id = false ) { |
|
1000 | + public function is_free($price_id = false) { |
|
1001 | 1001 | |
1002 | 1002 | $is_free = false; |
1003 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1003 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1004 | 1004 | |
1005 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1006 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1007 | - } elseif ( ! $variable_pricing ) { |
|
1008 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
1005 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1006 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1007 | + } elseif ( ! $variable_pricing) { |
|
1008 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1011 | + if (isset($price) && (float) $price == 0) { |
|
1012 | 1012 | $is_free = true; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1015 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1016 | 1016 | |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1039,9 +1039,9 @@ discard block |
||
1039 | 1039 | $is_close_form = apply_filters( |
1040 | 1040 | 'give_is_close_donation_form', |
1041 | 1041 | ( |
1042 | - give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1043 | - && give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1044 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1042 | + give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) ) |
|
1043 | + && give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1044 | + && ($this->get_goal() <= $this->get_earnings() |
|
1045 | 1045 | ), |
1046 | 1046 | $this->ID |
1047 | 1047 | ); |
@@ -1060,29 +1060,29 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return bool The result of the update query. |
1062 | 1062 | */ |
1063 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1063 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1064 | 1064 | |
1065 | 1065 | /* @var WPDB $wpdb */ |
1066 | 1066 | global $wpdb; |
1067 | 1067 | |
1068 | - if ( empty( $meta_key ) ) { |
|
1068 | + if (empty($meta_key)) { |
|
1069 | 1069 | return false; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | // Make sure if it needs to be serialized, we do |
1073 | - $meta_value = maybe_serialize( $meta_value ); |
|
1073 | + $meta_value = maybe_serialize($meta_value); |
|
1074 | 1074 | |
1075 | - if ( is_numeric( $meta_value ) ) { |
|
1076 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1075 | + if (is_numeric($meta_value)) { |
|
1076 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1077 | 1077 | } else { |
1078 | 1078 | $value_type = "'%s'"; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1081 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1082 | 1082 | |
1083 | - if ( $wpdb->query( $sql ) ) { |
|
1083 | + if ($wpdb->query($sql)) { |
|
1084 | 1084 | |
1085 | - clean_post_cache( $this->ID ); |
|
1085 | + clean_post_cache($this->ID); |
|
1086 | 1086 | |
1087 | 1087 | return true; |
1088 | 1088 |
@@ -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 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
58 | 58 | */ |
59 | - public function __construct( $args = array() ) { |
|
59 | + public function __construct($args = array()) { |
|
60 | 60 | $defaults = array( |
61 | 61 | 'output' => 'payments', // Use 'posts' to get standard post objects |
62 | - 'post_type' => array( 'give_payment' ), |
|
62 | + 'post_type' => array('give_payment'), |
|
63 | 63 | 'start_date' => false, |
64 | 64 | 'end_date' => false, |
65 | 65 | 'number' => 20, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'give_forms' => null, |
80 | 80 | ); |
81 | 81 | |
82 | - $this->args = wp_parse_args( $args, $defaults ); |
|
82 | + $this->args = wp_parse_args($args, $defaults); |
|
83 | 83 | |
84 | 84 | $this->init(); |
85 | 85 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param $query_var |
94 | 94 | * @param $value |
95 | 95 | */ |
96 | - public function __set( $query_var, $value ) { |
|
97 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
98 | - $this->args[ $query_var ][] = $value; |
|
96 | + public function __set($query_var, $value) { |
|
97 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
98 | + $this->args[$query_var][] = $value; |
|
99 | 99 | } else { |
100 | - $this->args[ $query_var ] = $value; |
|
100 | + $this->args[$query_var] = $value; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param $query_var |
111 | 111 | */ |
112 | - public function __unset( $query_var ) { |
|
113 | - unset( $this->args[ $query_var ] ); |
|
112 | + public function __unset($query_var) { |
|
113 | + unset($this->args[$query_var]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function init() { |
125 | 125 | |
126 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
127 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
128 | - |
|
129 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
130 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
131 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
132 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
133 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
134 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
135 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
136 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
137 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
138 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
139 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
126 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
127 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
128 | + |
|
129 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
130 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
131 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
132 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
133 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
134 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
135 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
136 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
137 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
138 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
139 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param Give_Payments_Query $this Payments query object. |
162 | 162 | */ |
163 | - do_action( 'give_pre_get_payments', $this ); |
|
163 | + do_action('give_pre_get_payments', $this); |
|
164 | 164 | |
165 | - $query = new WP_Query( $this->args ); |
|
165 | + $query = new WP_Query($this->args); |
|
166 | 166 | |
167 | 167 | $custom_output = array( |
168 | 168 | 'payments', |
169 | 169 | 'give_payments', |
170 | 170 | ); |
171 | 171 | |
172 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
172 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
173 | 173 | return $query->posts; |
174 | 174 | } |
175 | 175 | |
176 | - if ( $query->have_posts() ) { |
|
177 | - while ( $query->have_posts() ) { |
|
176 | + if ($query->have_posts()) { |
|
177 | + while ($query->have_posts()) { |
|
178 | 178 | $query->the_post(); |
179 | 179 | |
180 | 180 | $payment_id = get_post()->ID; |
181 | - $payment = new Give_Payment( $payment_id ); |
|
181 | + $payment = new Give_Payment($payment_id); |
|
182 | 182 | |
183 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
183 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | wp_reset_postdata(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param Give_Payments_Query $this Payments query object. |
195 | 195 | */ |
196 | - do_action( 'give_post_get_payments', $this ); |
|
196 | + do_action('give_post_get_payments', $this); |
|
197 | 197 | |
198 | 198 | return $this->payments; |
199 | 199 | } |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * @return void |
208 | 208 | */ |
209 | 209 | public function date_filter_pre() { |
210 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
210 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
211 | 211 | return; |
212 | 212 | } |
213 | 213 | |
214 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
214 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
215 | 215 | |
216 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
216 | + add_filter('posts_where', array($this, 'payments_where')); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function date_filter_post() { |
229 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
229 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
233 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function status() { |
245 | - if ( ! isset ( $this->args['status'] ) ) { |
|
245 | + if ( ! isset ($this->args['status'])) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | - $this->__set( 'post_status', $this->args['status'] ); |
|
250 | - $this->__unset( 'status' ); |
|
249 | + $this->__set('post_status', $this->args['status']); |
|
250 | + $this->__unset('status'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | * @return void |
260 | 260 | */ |
261 | 261 | public function page() { |
262 | - if ( ! isset ( $this->args['page'] ) ) { |
|
262 | + if ( ! isset ($this->args['page'])) { |
|
263 | 263 | return; |
264 | 264 | } |
265 | 265 | |
266 | - $this->__set( 'paged', $this->args['page'] ); |
|
267 | - $this->__unset( 'page' ); |
|
266 | + $this->__set('paged', $this->args['page']); |
|
267 | + $this->__unset('page'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function per_page() { |
279 | 279 | |
280 | - if ( ! isset( $this->args['number'] ) ) { |
|
280 | + if ( ! isset($this->args['number'])) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - if ( $this->args['number'] == - 1 ) { |
|
285 | - $this->__set( 'nopaging', true ); |
|
284 | + if ($this->args['number'] == - 1) { |
|
285 | + $this->__set('nopaging', true); |
|
286 | 286 | } else { |
287 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
287 | + $this->__set('posts_per_page', $this->args['number']); |
|
288 | 288 | } |
289 | 289 | |
290 | - $this->__unset( 'number' ); |
|
290 | + $this->__unset('number'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | * @return void |
300 | 300 | */ |
301 | 301 | public function month() { |
302 | - if ( ! isset ( $this->args['month'] ) ) { |
|
302 | + if ( ! isset ($this->args['month'])) { |
|
303 | 303 | return; |
304 | 304 | } |
305 | 305 | |
306 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
307 | - $this->__unset( 'month' ); |
|
306 | + $this->__set('monthnum', $this->args['month']); |
|
307 | + $this->__unset('month'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | * @return void |
317 | 317 | */ |
318 | 318 | public function orderby() { |
319 | - switch ( $this->args['orderby'] ) { |
|
319 | + switch ($this->args['orderby']) { |
|
320 | 320 | case 'amount' : |
321 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
322 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
321 | + $this->__set('orderby', 'meta_value_num'); |
|
322 | + $this->__set('meta_key', '_give_payment_total'); |
|
323 | 323 | break; |
324 | 324 | |
325 | 325 | case 'status' : |
326 | - $this->__set( 'orderby', 'post_status' ); |
|
326 | + $this->__set('orderby', 'post_status'); |
|
327 | 327 | break; |
328 | 328 | |
329 | 329 | case 'donation_form' : |
330 | - $this->__set( 'orderby', 'meta_value' ); |
|
331 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
330 | + $this->__set('orderby', 'meta_value'); |
|
331 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
332 | 332 | break; |
333 | 333 | |
334 | 334 | default : |
335 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
335 | + $this->__set('orderby', $this->args['orderby']); |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - public function custom_orderby( $order, $query ) { |
|
353 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
354 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
352 | + public function custom_orderby($order, $query) { |
|
353 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
354 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
355 | 355 | return $order; |
356 | 356 | } |
357 | 357 | |
358 | - switch ( $query->query['orderby'] ) { |
|
358 | + switch ($query->query['orderby']) { |
|
359 | 359 | case 'post_status': |
360 | - $order = 'wp_posts.post_status ' . strtoupper( $query->query['order'] ); |
|
360 | + $order = 'wp_posts.post_status '.strtoupper($query->query['order']); |
|
361 | 361 | break; |
362 | 362 | } |
363 | 363 | |
@@ -373,20 +373,20 @@ discard block |
||
373 | 373 | * @return void |
374 | 374 | */ |
375 | 375 | public function user() { |
376 | - if ( is_null( $this->args['user'] ) ) { |
|
376 | + if (is_null($this->args['user'])) { |
|
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | - if ( is_numeric( $this->args['user'] ) ) { |
|
380 | + if (is_numeric($this->args['user'])) { |
|
381 | 381 | $user_key = '_give_payment_user_id'; |
382 | 382 | } else { |
383 | 383 | $user_key = '_give_payment_user_email'; |
384 | 384 | } |
385 | 385 | |
386 | - $this->__set( 'meta_query', array( |
|
386 | + $this->__set('meta_query', array( |
|
387 | 387 | 'key' => $user_key, |
388 | 388 | 'value' => $this->args['user'], |
389 | - ) ); |
|
389 | + )); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -399,33 +399,33 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public function search() { |
401 | 401 | |
402 | - if ( ! isset( $this->args['s'] ) ) { |
|
402 | + if ( ! isset($this->args['s'])) { |
|
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | - $search = trim( $this->args['s'] ); |
|
406 | + $search = trim($this->args['s']); |
|
407 | 407 | |
408 | - if ( empty( $search ) ) { |
|
408 | + if (empty($search)) { |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
413 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
412 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
413 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
414 | 414 | |
415 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
415 | + if ( ! empty($this->args['search_in_notes'])) { |
|
416 | 416 | |
417 | - $notes = give_get_payment_notes( 0, $search ); |
|
417 | + $notes = give_get_payment_notes(0, $search); |
|
418 | 418 | |
419 | - if ( ! empty( $notes ) ) { |
|
419 | + if ( ! empty($notes)) { |
|
420 | 420 | |
421 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
421 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
422 | 422 | |
423 | - $this->__set( 'post__in', $payment_ids ); |
|
423 | + $this->__set('post__in', $payment_ids); |
|
424 | 424 | } |
425 | 425 | |
426 | - $this->__unset( 's' ); |
|
426 | + $this->__unset('s'); |
|
427 | 427 | |
428 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
428 | + } elseif ($is_email || strlen($search) == 32) { |
|
429 | 429 | |
430 | 430 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
431 | 431 | $search_meta = array( |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | 'compare' => 'LIKE', |
435 | 435 | ); |
436 | 436 | |
437 | - $this->__set( 'meta_query', $search_meta ); |
|
438 | - $this->__unset( 's' ); |
|
437 | + $this->__set('meta_query', $search_meta); |
|
438 | + $this->__unset('s'); |
|
439 | 439 | |
440 | - } elseif ( $is_user ) { |
|
440 | + } elseif ($is_user) { |
|
441 | 441 | |
442 | 442 | $search_meta = array( |
443 | 443 | 'key' => '_give_payment_user_id', |
444 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
444 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
445 | 445 | ); |
446 | 446 | |
447 | - $this->__set( 'meta_query', $search_meta ); |
|
447 | + $this->__set('meta_query', $search_meta); |
|
448 | 448 | |
449 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
449 | + if (give_get_option('enable_sequential')) { |
|
450 | 450 | |
451 | 451 | $search_meta = array( |
452 | 452 | 'key' => '_give_payment_number', |
@@ -454,19 +454,19 @@ discard block |
||
454 | 454 | 'compare' => 'LIKE', |
455 | 455 | ); |
456 | 456 | |
457 | - $this->__set( 'meta_query', $search_meta ); |
|
457 | + $this->__set('meta_query', $search_meta); |
|
458 | 458 | |
459 | 459 | $this->args['meta_query']['relation'] = 'OR'; |
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - $this->__unset( 's' ); |
|
463 | + $this->__unset('s'); |
|
464 | 464 | |
465 | 465 | } elseif ( |
466 | - give_get_option( 'enable_sequential' ) && |
|
466 | + give_get_option('enable_sequential') && |
|
467 | 467 | ( |
468 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
469 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
468 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
469 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
470 | 470 | ) |
471 | 471 | ) { |
472 | 472 | |
@@ -476,29 +476,29 @@ discard block |
||
476 | 476 | 'compare' => 'LIKE', |
477 | 477 | ); |
478 | 478 | |
479 | - $this->__set( 'meta_query', $search_meta ); |
|
480 | - $this->__unset( 's' ); |
|
479 | + $this->__set('meta_query', $search_meta); |
|
480 | + $this->__unset('s'); |
|
481 | 481 | |
482 | - } elseif ( is_numeric( $search ) ) { |
|
482 | + } elseif (is_numeric($search)) { |
|
483 | 483 | |
484 | - $post = get_post( $search ); |
|
484 | + $post = get_post($search); |
|
485 | 485 | |
486 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
486 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
487 | 487 | |
488 | 488 | $arr = array(); |
489 | 489 | $arr[] = $search; |
490 | - $this->__set( 'post__in', $arr ); |
|
491 | - $this->__unset( 's' ); |
|
490 | + $this->__set('post__in', $arr); |
|
491 | + $this->__unset('s'); |
|
492 | 492 | } |
493 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
493 | + } elseif ('#' == substr($search, 0, 1)) { |
|
494 | 494 | |
495 | - $search = str_replace( '#:', '', $search ); |
|
496 | - $search = str_replace( '#', '', $search ); |
|
497 | - $this->__set( 'give_forms', $search ); |
|
498 | - $this->__unset( 's' ); |
|
495 | + $search = str_replace('#:', '', $search); |
|
496 | + $search = str_replace('#', '', $search); |
|
497 | + $this->__set('give_forms', $search); |
|
498 | + $this->__unset('s'); |
|
499 | 499 | |
500 | 500 | } else { |
501 | - $this->__set( 's', $search ); |
|
501 | + $this->__set('s', $search); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
@@ -513,16 +513,16 @@ discard block |
||
513 | 513 | * @return void |
514 | 514 | */ |
515 | 515 | public function mode() { |
516 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
517 | - $this->__unset( 'mode' ); |
|
516 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
517 | + $this->__unset('mode'); |
|
518 | 518 | |
519 | 519 | return; |
520 | 520 | } |
521 | 521 | |
522 | - $this->__set( 'meta_query', array( |
|
522 | + $this->__set('meta_query', array( |
|
523 | 523 | 'key' => '_give_payment_mode', |
524 | 524 | 'value' => $this->args['mode'], |
525 | - ) ); |
|
525 | + )); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function children() { |
537 | - if ( empty( $this->args['children'] ) ) { |
|
538 | - $this->__set( 'post_parent', 0 ); |
|
537 | + if (empty($this->args['children'])) { |
|
538 | + $this->__set('post_parent', 0); |
|
539 | 539 | } |
540 | - $this->__unset( 'children' ); |
|
540 | + $this->__unset('children'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function give_forms() { |
552 | 552 | |
553 | - if ( empty( $this->args['give_forms'] ) ) { |
|
553 | + if (empty($this->args['give_forms'])) { |
|
554 | 554 | return; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $compare = '='; |
558 | 558 | |
559 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
559 | + if (is_array($this->args['give_forms'])) { |
|
560 | 560 | $compare = 'IN'; |
561 | 561 | } |
562 | 562 | |
563 | - $this->__set( 'meta_query', array( |
|
563 | + $this->__set('meta_query', array( |
|
564 | 564 | array( |
565 | 565 | 'key' => '_give_payment_form_id', |
566 | 566 | 'value' => $this->args['give_forms'], |
567 | 567 | 'compare' => $compare, |
568 | 568 | ), |
569 | - ) ); |
|
569 | + )); |
|
570 | 570 | |
571 | - $this->__unset( 'give_forms' ); |
|
571 | + $this->__unset('give_forms'); |
|
572 | 572 | |
573 | 573 | } |
574 | 574 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function output() { |
78 | 78 | $GLOBALS['give_hide_save_button'] = true; |
79 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
79 | + include_once('views/html-admin-page-system-info.php'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |