@@ -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 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | * @since 1.8.9 |
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
58 | 58 | |
59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
60 | - add_action( 'give_pre_form_output', array( $this, 'render_frontend_form_notices' ), 10, 1 ); |
|
61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
60 | + add_action('give_pre_form_output', array($this, 'render_frontend_form_notices'), 10, 1); |
|
61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Backward compatibility for deprecated params. |
65 | 65 | * |
66 | 66 | * @since 1.8.14 |
67 | 67 | */ |
68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function bc_deprecated_params( $args ) { |
|
83 | + public function bc_deprecated_params($args) { |
|
84 | 84 | /** |
85 | 85 | * Param: auto_dismissible |
86 | 86 | * deprecated in 1.8.14 |
87 | 87 | * |
88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
89 | 89 | */ |
90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
90 | + if (isset($args['auto_dismissible'])) { |
|
91 | + if ( ! empty($args['auto_dismissible'])) { |
|
92 | 92 | $args['dismissible'] = 'auto'; |
93 | 93 | } |
94 | 94 | // unset auto_dismissible as it has been deprecated. |
95 | - unset( $args['auto_dismissible'] ); |
|
95 | + unset($args['auto_dismissible']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function register_notice( $notice_args ) { |
|
111 | + public function register_notice($notice_args) { |
|
112 | 112 | // Bailout. |
113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -159,39 +159,39 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 1.8.14 |
161 | 161 | */ |
162 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
162 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
163 | 163 | |
164 | 164 | // Set extra dismiss links if any. |
165 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
165 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
166 | 166 | |
167 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
167 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
168 | 168 | |
169 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
170 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
171 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
169 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
170 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
171 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
172 | 172 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
173 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
173 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
174 | 174 | '', |
175 | 175 | '_', |
176 | 176 | '', |
177 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
177 | + ), implode('&', $extra_notice_dismiss_link)); |
|
178 | 178 | |
179 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
179 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
185 | + self::$notices[$notice_args['id']] = $notice_args; |
|
186 | 186 | |
187 | 187 | // Auto set show param if not already set. |
188 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
189 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
188 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
189 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // Auto set time interval for shortly. |
193 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
194 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
193 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
194 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return true; |
@@ -205,51 +205,51 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function render_admin_notices() { |
207 | 207 | // Bailout. |
208 | - if ( empty( self::$notices ) ) { |
|
208 | + if (empty(self::$notices)) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | 212 | $output = ''; |
213 | 213 | |
214 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
214 | + foreach (self::$notices as $notice_id => $notice) { |
|
215 | 215 | // Check flag set to true to show notice. |
216 | - if ( ! $notice['show'] ) { |
|
216 | + if ( ! $notice['show']) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | // Render custom html. |
222 | - if( ! empty( $notice['description_html'] ) ) { |
|
222 | + if ( ! empty($notice['description_html'])) { |
|
223 | 223 | $output .= "{$notice['description_html']} \n"; |
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Check if notice dismissible or not. |
228 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
229 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
228 | + if ( ! self::$has_auto_dismissible_notice) { |
|
229 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Check if notice dismissible or not. |
233 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
233 | + if ( ! self::$has_dismiss_interval_notice) { |
|
234 | 234 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
235 | 235 | } |
236 | 236 | |
237 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
237 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
238 | 238 | |
239 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | - $output .= sprintf( |
|
241 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
239 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | + $output .= sprintf( |
|
241 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
242 | 242 | $css_id, |
243 | 243 | $css_class, |
244 | - give_clean( $notice['dismissible'] ), |
|
244 | + give_clean($notice['dismissible']), |
|
245 | 245 | $notice['dismissible_type'], |
246 | 246 | $notice['dismiss_interval'], |
247 | 247 | $notice['id'], |
248 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
248 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
249 | 249 | $notice['dismiss_interval_time'] |
250 | 250 | ); |
251 | 251 | |
252 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
252 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
253 | 253 | $output .= "</div> \n"; |
254 | 254 | } |
255 | 255 | |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @param int $form_id |
269 | 269 | */ |
270 | - public function render_frontend_notices( $form_id = 0 ) { |
|
270 | + public function render_frontend_notices($form_id = 0) { |
|
271 | 271 | $errors = give_get_errors(); |
272 | 272 | |
273 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
273 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
274 | 274 | |
275 | 275 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
276 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
276 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - if ( $errors ) { |
|
281 | - self::print_frontend_errors( $errors ); |
|
280 | + if ($errors) { |
|
281 | + self::print_frontend_errors($errors); |
|
282 | 282 | |
283 | 283 | give_clear_errors(); |
284 | 284 | } |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return void |
297 | 297 | */ |
298 | - public function render_frontend_form_notices( $form_id ) { |
|
299 | - $display_option = give_get_meta( $form_id, '_give_payment_display', true ); |
|
298 | + public function render_frontend_form_notices($form_id) { |
|
299 | + $display_option = give_get_meta($form_id, '_give_payment_display', true); |
|
300 | 300 | |
301 | - if ( 'modal' === $display_option ) { |
|
302 | - add_action( 'give_payment_mode_top', array( $this, 'render_frontend_notices' ) ); |
|
301 | + if ('modal' === $display_option) { |
|
302 | + add_action('give_payment_mode_top', array($this, 'render_frontend_notices')); |
|
303 | 303 | } else { |
304 | - add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 ); |
|
304 | + add_action('give_pre_form', array($this, 'render_frontend_notices'), 11); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @access private |
313 | 313 | */ |
314 | 314 | private function print_js() { |
315 | - if ( self::$has_auto_dismissible_notice ) : |
|
315 | + if (self::$has_auto_dismissible_notice) : |
|
316 | 316 | ?> |
317 | 317 | <script> |
318 | 318 | jQuery(document).ready(function () { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | <?php |
329 | 329 | endif; |
330 | 330 | |
331 | - if ( self::$has_dismiss_interval_notice ) : |
|
331 | + if (self::$has_dismiss_interval_notice) : |
|
332 | 332 | ?> |
333 | 333 | <script> |
334 | 334 | jQuery(document).ready(function () { |
@@ -407,36 +407,36 @@ discard block |
||
407 | 407 | * @access public |
408 | 408 | */ |
409 | 409 | public function dismiss_notices() { |
410 | - $_post = give_clean( $_POST ); |
|
411 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
410 | + $_post = give_clean($_POST); |
|
411 | + $notice_id = esc_attr($_post['notice_id']); |
|
412 | 412 | |
413 | 413 | // Bailout. |
414 | 414 | if ( |
415 | - empty( $notice_id ) || |
|
416 | - empty( $_post['dismissible_type'] ) || |
|
417 | - empty( $_post['dismiss_interval'] ) || |
|
418 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
415 | + empty($notice_id) || |
|
416 | + empty($_post['dismissible_type']) || |
|
417 | + empty($_post['dismiss_interval']) || |
|
418 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
419 | 419 | ) { |
420 | 420 | wp_send_json_error(); |
421 | 421 | } |
422 | 422 | |
423 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
424 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
423 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
424 | + if ('user' === $_post['dismissible_type']) { |
|
425 | 425 | $current_user = wp_get_current_user(); |
426 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
426 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
427 | 427 | } |
428 | 428 | |
429 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
429 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
430 | 430 | |
431 | 431 | // Save option to hide notice. |
432 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
432 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
433 | 433 | |
434 | 434 | /** |
435 | 435 | * Fire the action when notice dismissed |
436 | 436 | * |
437 | 437 | * @since 2.2.0 |
438 | 438 | */ |
439 | - do_action( 'give_notice_dismissed', $_post ); |
|
439 | + do_action('give_notice_dismissed', $_post); |
|
440 | 440 | |
441 | 441 | wp_send_json_success(); |
442 | 442 | } |
@@ -454,18 +454,18 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @return string |
456 | 456 | */ |
457 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
457 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
458 | 458 | $notice_key = "_give_notice_{$notice_id}"; |
459 | 459 | |
460 | - if ( ! empty( $dismiss_interval ) ) { |
|
460 | + if ( ! empty($dismiss_interval)) { |
|
461 | 461 | $notice_key .= "_{$dismiss_interval}"; |
462 | 462 | } |
463 | 463 | |
464 | - if ( $user_id ) { |
|
464 | + if ($user_id) { |
|
465 | 465 | $notice_key .= "_{$user_id}"; |
466 | 466 | } |
467 | 467 | |
468 | - $notice_key = sanitize_key( $notice_key ); |
|
468 | + $notice_key = sanitize_key($notice_key); |
|
469 | 469 | |
470 | 470 | return $notice_key; |
471 | 471 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return string |
480 | 480 | */ |
481 | - public function get_dismiss_link( $notice_args ) { |
|
481 | + public function get_dismiss_link($notice_args) { |
|
482 | 482 | $notice_args = wp_parse_args( |
483 | 483 | $notice_args, |
484 | 484 | array( |
485 | - 'title' => __( 'Click here', 'give' ), |
|
485 | + 'title' => __('Click here', 'give'), |
|
486 | 486 | 'dismissible_type' => '', |
487 | 487 | 'dismiss_interval' => '', |
488 | 488 | 'dismiss_interval_time' => null, |
@@ -509,31 +509,31 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @return bool|null |
511 | 511 | */ |
512 | - public function is_notice_dismissed( $notice ) { |
|
513 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
512 | + public function is_notice_dismissed($notice) { |
|
513 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
514 | 514 | $is_notice_dismissed = false; |
515 | 515 | |
516 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
516 | + if ('user' === $notice['dismissible_type']) { |
|
517 | 517 | $current_user = wp_get_current_user(); |
518 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
518 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
519 | 519 | } |
520 | 520 | |
521 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
521 | + $notice_data = Give_Cache::get($notice_key, true); |
|
522 | 522 | |
523 | 523 | // Find notice dismiss link status if notice has extra dismissible links. |
524 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
524 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
525 | 525 | |
526 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
527 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
528 | - unset( $new_notice_data['extra_links'] ); |
|
526 | + foreach ($notice['extra_links'] as $extra_link) { |
|
527 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
528 | + unset($new_notice_data['extra_links']); |
|
529 | 529 | |
530 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
530 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
531 | 531 | return $is_notice_dismissed; |
532 | 532 | } |
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
536 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
537 | 537 | |
538 | 538 | return $is_notice_dismissed; |
539 | 539 | } |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @param array $errors |
549 | 549 | */ |
550 | - public static function print_frontend_errors( $errors ) { |
|
550 | + public static function print_frontend_errors($errors) { |
|
551 | 551 | // Bailout. |
552 | - if ( ! $errors ) { |
|
552 | + if ( ! $errors) { |
|
553 | 553 | return; |
554 | 554 | } |
555 | 555 | |
@@ -564,37 +564,37 @@ discard block |
||
564 | 564 | ); |
565 | 565 | |
566 | 566 | // Note: we will remove give_errors class in future. |
567 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
567 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
568 | 568 | |
569 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
569 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
570 | 570 | |
571 | 571 | // Loop error codes and display errors. |
572 | - foreach ( $errors as $error_id => $error ) { |
|
572 | + foreach ($errors as $error_id => $error) { |
|
573 | 573 | // Backward compatibility v<1.8.11 |
574 | - if ( is_string( $error ) ) { |
|
574 | + if (is_string($error)) { |
|
575 | 575 | $error = array( |
576 | 576 | 'message' => $error, |
577 | 577 | 'notice_args' => array(), |
578 | 578 | ); |
579 | 579 | } |
580 | 580 | |
581 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
581 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
582 | 582 | |
583 | 583 | /** |
584 | 584 | * Filter to modify Frontend Errors args before errors is display. |
585 | 585 | * |
586 | 586 | * @since 1.8.14 |
587 | 587 | */ |
588 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
588 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
589 | 589 | |
590 | 590 | echo sprintf( |
591 | 591 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
592 | 592 | <p><strong>%4$s</strong>: %5$s</p> |
593 | 593 | </div>', |
594 | 594 | $error_id, |
595 | - give_clean( $notice_args['dismissible'] ), |
|
596 | - absint( $notice_args['dismiss_interval'] ), |
|
597 | - esc_html__( 'Error', 'give' ), |
|
595 | + give_clean($notice_args['dismissible']), |
|
596 | + absint($notice_args['dismiss_interval']), |
|
597 | + esc_html__('Error', 'give'), |
|
598 | 598 | $error['message'] |
599 | 599 | ); |
600 | 600 | } |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | * |
617 | 617 | * @return string |
618 | 618 | */ |
619 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
620 | - if ( empty( $message ) ) { |
|
619 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
620 | + if (empty($message)) { |
|
621 | 621 | return ''; |
622 | 622 | } |
623 | 623 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | 'dismiss_interval' => 5000, |
633 | 633 | ); |
634 | 634 | |
635 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
635 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
636 | 636 | |
637 | 637 | // Notice dismissible must be true for dismiss type. |
638 | 638 | $notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type']; |
@@ -642,15 +642,14 @@ discard block |
||
642 | 642 | * |
643 | 643 | * @since 1.8.14 |
644 | 644 | */ |
645 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
645 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
646 | 646 | |
647 | 647 | $close_icon = 'manual' === $notice_args['dismiss_type'] ? |
648 | 648 | sprintf( |
649 | 649 | '<img class="notice-dismiss give-notice-close" src="%s" />', |
650 | - esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' ) |
|
650 | + esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg') |
|
651 | 651 | |
652 | - ) : |
|
653 | - ''; |
|
652 | + ) : ''; |
|
654 | 653 | |
655 | 654 | // Note: we will remove give_errors class in future. |
656 | 655 | $error = sprintf( |
@@ -661,15 +660,15 @@ discard block |
||
661 | 660 | %6$s |
662 | 661 | </div>', |
663 | 662 | $notice_type, |
664 | - give_clean( $notice_args['dismissible'] ), |
|
665 | - absint( $notice_args['dismiss_interval'] ), |
|
666 | - give_clean( $notice_args['dismiss_type'] ), |
|
663 | + give_clean($notice_args['dismissible']), |
|
664 | + absint($notice_args['dismiss_interval']), |
|
665 | + give_clean($notice_args['dismiss_type']), |
|
667 | 666 | $message, |
668 | 667 | $close_icon |
669 | 668 | |
670 | 669 | ); |
671 | 670 | |
672 | - if ( ! $echo ) { |
|
671 | + if ( ! $echo) { |
|
673 | 672 | return $error; |
674 | 673 | } |
675 | 674 | |
@@ -689,24 +688,24 @@ discard block |
||
689 | 688 | * |
690 | 689 | * @return string |
691 | 690 | */ |
692 | - public function print_admin_notices( $notice_args = array() ) { |
|
691 | + public function print_admin_notices($notice_args = array()) { |
|
693 | 692 | // Bailout. |
694 | - if ( empty( $notice_args['description'] ) ) { |
|
693 | + if (empty($notice_args['description'])) { |
|
695 | 694 | return ''; |
696 | 695 | } |
697 | 696 | |
698 | - $defaults = array( |
|
697 | + $defaults = array( |
|
699 | 698 | 'id' => '', |
700 | 699 | 'echo' => true, |
701 | 700 | 'notice_type' => 'warning', |
702 | 701 | 'dismissible' => true, |
703 | 702 | ); |
704 | - $notice_args = wp_parse_args( $notice_args, $defaults ); |
|
703 | + $notice_args = wp_parse_args($notice_args, $defaults); |
|
705 | 704 | |
706 | 705 | $output = ''; |
707 | - $css_id = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' ); |
|
706 | + $css_id = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-'); |
|
708 | 707 | $css_class = "notice-{$notice_args['notice_type']} give-notice notice inline"; |
709 | - $css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : ''; |
|
708 | + $css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : ''; |
|
710 | 709 | $output .= sprintf( |
711 | 710 | '<div id="%1$s" class="%2$s"><p>%3$s</p></div>', |
712 | 711 | $css_id, |
@@ -714,7 +713,7 @@ discard block |
||
714 | 713 | $notice_args['description'] |
715 | 714 | ); |
716 | 715 | |
717 | - if ( ! $notice_args['echo'] ) { |
|
716 | + if ( ! $notice_args['echo']) { |
|
718 | 717 | return $output; |
719 | 718 | } |
720 | 719 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @since 2.1.0 |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - $this->direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : ''; |
|
41 | - $this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false; |
|
40 | + $this->direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : ''; |
|
41 | + $this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false; |
|
42 | 42 | $this->init(); |
43 | 43 | } |
44 | 44 | |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function init() { |
51 | 51 | |
52 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
54 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
55 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
52 | + add_action('admin_enqueue_scripts', array($this, 'register_styles')); |
|
53 | + add_action('admin_enqueue_scripts', array($this, 'register_scripts')); |
|
54 | + add_action('wp_enqueue_scripts', array($this, 'register_styles')); |
|
55 | + add_action('wp_enqueue_scripts', array($this, 'register_scripts')); |
|
56 | 56 | |
57 | - if ( is_admin() ) { |
|
58 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
59 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) ); |
|
60 | - add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) ); |
|
61 | - add_action( 'admin_head', array( $this, 'global_admin_head' ) ); |
|
57 | + if (is_admin()) { |
|
58 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
59 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles')); |
|
60 | + add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts')); |
|
61 | + add_action('admin_head', array($this, 'global_admin_head')); |
|
62 | 62 | |
63 | 63 | } else { |
64 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) ); |
|
65 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) ); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles')); |
|
65 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | public function register_styles() { |
75 | 75 | |
76 | 76 | // WP-admin. |
77 | - wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION ); |
|
77 | + wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION); |
|
78 | 78 | |
79 | 79 | // WP-admin: plugin page. |
80 | 80 | wp_register_style( |
81 | 81 | 'plugin-deactivation-survey-css', |
82 | - GIVE_PLUGIN_URL . 'assets/dist/css/plugin-deactivation-survey.css', |
|
82 | + GIVE_PLUGIN_URL.'assets/dist/css/plugin-deactivation-survey.css', |
|
83 | 83 | array(), |
84 | 84 | GIVE_VERSION |
85 | 85 | ); |
86 | 86 | |
87 | 87 | // Frontend. |
88 | - if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
89 | - wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
88 | + if (give_is_setting_enabled(give_get_option('css'))) { |
|
89 | + wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,23 +98,23 @@ discard block |
||
98 | 98 | public function register_scripts() { |
99 | 99 | |
100 | 100 | // WP-Admin. |
101 | - wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array( |
|
101 | + wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array( |
|
102 | 102 | 'jquery', |
103 | 103 | 'jquery-ui-datepicker', |
104 | 104 | 'wp-color-picker', |
105 | 105 | 'jquery-query', |
106 | - ), GIVE_VERSION ); |
|
106 | + ), GIVE_VERSION); |
|
107 | 107 | |
108 | 108 | // WP-admin: plugin page. |
109 | - wp_register_script( 'plugin-deactivation-survey-js', |
|
110 | - GIVE_PLUGIN_URL . 'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | - array( 'jquery' ), |
|
109 | + wp_register_script('plugin-deactivation-survey-js', |
|
110 | + GIVE_PLUGIN_URL.'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | + array('jquery'), |
|
112 | 112 | GIVE_VERSION, |
113 | 113 | true |
114 | 114 | ); |
115 | 115 | |
116 | 116 | // Frontend. |
117 | - wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer ); |
|
117 | + wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $hook Page hook. |
126 | 126 | */ |
127 | - public function admin_enqueue_styles( $hook ) { |
|
127 | + public function admin_enqueue_styles($hook) { |
|
128 | 128 | // Give Admin Only. |
129 | - if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) { |
|
129 | + if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | 133 | // Give enqueues. |
134 | - wp_enqueue_style( 'give-admin-styles' ); |
|
135 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
134 | + wp_enqueue_style('give-admin-styles'); |
|
135 | + wp_enqueue_style('give-admin-bar-notification'); |
|
136 | 136 | |
137 | 137 | // WP Core enqueues. |
138 | - wp_enqueue_style( 'wp-color-picker' ); |
|
139 | - wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API. |
|
138 | + wp_enqueue_style('wp-color-picker'); |
|
139 | + wp_enqueue_style('thickbox'); // @TODO remove once we have modal API. |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param string $hook Page hook. |
149 | 149 | */ |
150 | - public function admin_enqueue_scripts( $hook ) { |
|
150 | + public function admin_enqueue_scripts($hook) { |
|
151 | 151 | global $pagenow; |
152 | 152 | |
153 | 153 | // Plugin page script |
154 | - if ( 'plugins.php' === $pagenow ) { |
|
154 | + if ('plugins.php' === $pagenow) { |
|
155 | 155 | $this->plugin_equeue_scripts(); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Give Admin Only. |
159 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
159 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // WP Scripts. |
164 | - wp_enqueue_script( 'wp-color-picker' ); |
|
165 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
166 | - wp_enqueue_script( 'thickbox' ); |
|
164 | + wp_enqueue_script('wp-color-picker'); |
|
165 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
166 | + wp_enqueue_script('thickbox'); |
|
167 | 167 | wp_enqueue_media(); |
168 | 168 | |
169 | 169 | // Give admin scripts. |
170 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
170 | + wp_enqueue_script('give-admin-scripts'); |
|
171 | 171 | |
172 | 172 | // Localize admin scripts |
173 | 173 | $this->admin_localize_scripts(); |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | * |
184 | 184 | */ |
185 | 185 | private function plugin_equeue_scripts() { |
186 | - wp_enqueue_style( 'plugin-deactivation-survey-css' ); |
|
187 | - wp_enqueue_script( 'plugin-deactivation-survey-js' ); |
|
186 | + wp_enqueue_style('plugin-deactivation-survey-css'); |
|
187 | + wp_enqueue_script('plugin-deactivation-survey-js'); |
|
188 | 188 | |
189 | 189 | $localized_data = array( |
190 | - 'nonce' => wp_create_nonce( 'deactivation_survey_nonce' ), |
|
191 | - 'cancel' => __( 'Cancel', 'give' ), |
|
192 | - 'deactivation_no_option_selected' => __( 'Error: Please select at least one option.', 'give' ), |
|
193 | - 'submit_and_deactivate' => __( 'Submit and Deactivate', 'give' ), |
|
194 | - 'skip_and_deactivate' => __( 'Skip & Deactivate', 'give' ), |
|
195 | - 'please_fill_field' => __( 'Error: Please fill the field.', 'give' ), |
|
190 | + 'nonce' => wp_create_nonce('deactivation_survey_nonce'), |
|
191 | + 'cancel' => __('Cancel', 'give'), |
|
192 | + 'deactivation_no_option_selected' => __('Error: Please select at least one option.', 'give'), |
|
193 | + 'submit_and_deactivate' => __('Submit and Deactivate', 'give'), |
|
194 | + 'skip_and_deactivate' => __('Skip & Deactivate', 'give'), |
|
195 | + 'please_fill_field' => __('Error: Please fill the field.', 'give'), |
|
196 | 196 | |
197 | 197 | ); |
198 | - wp_localize_script( 'plugin-deactivation-survey-js', 'give_vars', $localized_data ); |
|
198 | + wp_localize_script('plugin-deactivation-survey-js', 'give_vars', $localized_data); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -212,119 +212,119 @@ discard block |
||
212 | 212 | |
213 | 213 | // Localize strings & variables for JS. |
214 | 214 | $localized_data = array( |
215 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
215 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
216 | 216 | 'give_version' => GIVE_VERSION, |
217 | 217 | 'thousands_separator' => $thousand_separator, |
218 | 218 | 'decimal_separator' => $decimal_separator, |
219 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
220 | - 'delete_payment' => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ), |
|
221 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
222 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
223 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
224 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
225 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
226 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
227 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
228 | - 'currency_sign' => give_currency_filter( '' ), |
|
229 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
219 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
220 | + 'delete_payment' => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'), |
|
221 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
222 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
223 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
224 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
225 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
226 | + 'one_option' => __('Choose a form', 'give'), |
|
227 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
228 | + 'currency_sign' => give_currency_filter(''), |
|
229 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
230 | 230 | 'currency_decimals' => give_get_price_decimals(), |
231 | - 'ok' => __( 'Ok', 'give' ), |
|
232 | - 'cancel' => __( 'Cancel', 'give' ), |
|
233 | - 'success' => __( 'Success', 'give' ), |
|
234 | - 'error' => __( 'Error', 'give' ), |
|
235 | - 'close' => __( 'Close', 'give' ), |
|
236 | - 'confirm' => __( 'Confirm', 'give' ), |
|
237 | - 'confirm_action' => __( 'Confirm Action', 'give' ), |
|
238 | - 'confirm_deletion' => __( 'Confirm Deletion', 'give' ), |
|
239 | - 'confirm_delete_donation' => __( 'Confirm Delete Donation', 'give' ), |
|
240 | - 'confirm_resend' => __( 'Confirm re-send', 'give' ), |
|
241 | - 'confirm_bulk_action' => __( 'Confirm bulk action', 'give' ), |
|
242 | - 'restart_upgrade' => __( 'Do you want to restart the update process?', 'give' ), |
|
243 | - 'restart_update' => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ), |
|
244 | - 'stop_upgrade' => __( 'Do you want to stop the update process now?', 'give' ), |
|
245 | - 'import_failed' => __( 'Import failed', 'give' ), |
|
246 | - 'flush_success' => __( 'Flush success', 'give' ), |
|
247 | - 'flush_error' => __( 'Flush error', 'give' ), |
|
248 | - 'no_form_selected' => __( 'No form selected', 'give' ), |
|
249 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
250 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
251 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
252 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
253 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
254 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
231 | + 'ok' => __('Ok', 'give'), |
|
232 | + 'cancel' => __('Cancel', 'give'), |
|
233 | + 'success' => __('Success', 'give'), |
|
234 | + 'error' => __('Error', 'give'), |
|
235 | + 'close' => __('Close', 'give'), |
|
236 | + 'confirm' => __('Confirm', 'give'), |
|
237 | + 'confirm_action' => __('Confirm Action', 'give'), |
|
238 | + 'confirm_deletion' => __('Confirm Deletion', 'give'), |
|
239 | + 'confirm_delete_donation' => __('Confirm Delete Donation', 'give'), |
|
240 | + 'confirm_resend' => __('Confirm re-send', 'give'), |
|
241 | + 'confirm_bulk_action' => __('Confirm bulk action', 'give'), |
|
242 | + 'restart_upgrade' => __('Do you want to restart the update process?', 'give'), |
|
243 | + 'restart_update' => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'), |
|
244 | + 'stop_upgrade' => __('Do you want to stop the update process now?', 'give'), |
|
245 | + 'import_failed' => __('Import failed', 'give'), |
|
246 | + 'flush_success' => __('Flush success', 'give'), |
|
247 | + 'flush_error' => __('Flush error', 'give'), |
|
248 | + 'no_form_selected' => __('No form selected', 'give'), |
|
249 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
250 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
251 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
252 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
253 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
254 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
255 | 255 | /* translators : %s: Donation form options metabox */ |
256 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
257 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
258 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
259 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
260 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
261 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
262 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
263 | - 'unlock_donor_fields_title' => __( 'Action forbidden', 'give' ), |
|
264 | - 'unlock_donor_fields_message' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
265 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
256 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
257 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
258 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
259 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
260 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
261 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
262 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
263 | + 'unlock_donor_fields_title' => __('Action forbidden', 'give'), |
|
264 | + 'unlock_donor_fields_message' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
265 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
266 | 266 | 'donors_bulk_action' => array( |
267 | 267 | 'no_donor_selected' => array( |
268 | - 'title' => __( 'No donors selected', 'give' ), |
|
269 | - 'desc' => __( 'You must choose at least one or more donors to delete.', 'give' ) |
|
268 | + 'title' => __('No donors selected', 'give'), |
|
269 | + 'desc' => __('You must choose at least one or more donors to delete.', 'give') |
|
270 | 270 | ), |
271 | 271 | 'no_action_selected' => array( |
272 | - 'title' => __( 'No action selected', 'give' ), |
|
273 | - 'desc' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
272 | + 'title' => __('No action selected', 'give'), |
|
273 | + 'desc' => __('You must select a bulk action to proceed.', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | 'donations_bulk_action' => array( |
277 | 277 | 'titles' => array( |
278 | - 'zero' => __( 'No payments selected', 'give' ), |
|
278 | + 'zero' => __('No payments selected', 'give'), |
|
279 | 279 | ), |
280 | 280 | 'delete' => array( |
281 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
282 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
283 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
281 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
282 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
283 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
284 | 284 | ), |
285 | 285 | 'resend-receipt' => array( |
286 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
287 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
288 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
286 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
287 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
288 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
289 | 289 | ), |
290 | 290 | 'set-to-status' => array( |
291 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
292 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
293 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
291 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
292 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
293 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
294 | 294 | ), |
295 | 295 | ), |
296 | 296 | 'updates' => array( |
297 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ), |
|
297 | + 'ajax_error' => __('Please reload this page and try again', 'give'), |
|
298 | 298 | ), |
299 | 299 | 'metabox_fields' => array( |
300 | 300 | 'media' => array( |
301 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
301 | + 'button_title' => __('Choose Image', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'file' => array( |
304 | - 'button_title' => __( 'Choose File', 'give' ), |
|
304 | + 'button_title' => __('Choose File', 'give'), |
|
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | 'chosen' => array( |
308 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
309 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
308 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
309 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
310 | 310 | ), |
311 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
312 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
313 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
311 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
312 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
313 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
314 | 314 | 'give_donation_import' => 'give_donation_import', |
315 | 315 | 'core_settings_import' => 'give_core_settings_import', |
316 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
316 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
317 | 317 | 'give_donation_amounts' => array( |
318 | - 'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ), |
|
319 | - 'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ), |
|
318 | + 'minimum' => apply_filters('give_donation_minimum_limit', 1), |
|
319 | + 'maximum' => apply_filters('give_donation_maximum_limit', 999999.99), |
|
320 | 320 | ), |
321 | - 'chosen_add_title_prefix' => __( 'No result found. Press enter to add', 'give' ), |
|
322 | - 'db_update_nonce' => wp_create_nonce( Give_Updates::$background_updater->get_identifier() ), |
|
321 | + 'chosen_add_title_prefix' => __('No result found. Press enter to add', 'give'), |
|
322 | + 'db_update_nonce' => wp_create_nonce(Give_Updates::$background_updater->get_identifier()), |
|
323 | 323 | 'ajax' => give_test_ajax_works(), |
324 | 324 | 'date_format' => give_get_localized_date_format_to_js(), |
325 | 325 | ); |
326 | 326 | |
327 | - wp_localize_script( 'give-admin-scripts', 'give_vars', $localized_data ); |
|
327 | + wp_localize_script('give-admin-scripts', 'give_vars', $localized_data); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | <style type="text/css" media="screen"> |
336 | 336 | @font-face { |
337 | 337 | font-family: 'give-icomoon'; |
338 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
338 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
342 | 342 | font-weight: normal; |
343 | 343 | font-style: normal; |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @since 2.1.0 |
362 | 362 | */ |
363 | 363 | public function public_enqueue_styles() { |
364 | - wp_enqueue_style( 'give-styles' ); |
|
364 | + wp_enqueue_style('give-styles'); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | public function public_enqueue_scripts() { |
374 | 374 | |
375 | 375 | // Call Babel Polyfill with common handle so that it is compatible with plugins and themes. |
376 | - if ( ! wp_script_is( 'babel-polyfill', 'enqueued' ) ) { |
|
376 | + if ( ! wp_script_is('babel-polyfill', 'enqueued')) { |
|
377 | 377 | wp_enqueue_script( |
378 | 378 | 'babel-polyfill', |
379 | - GIVE_PLUGIN_URL . 'assets/dist/js/babel-polyfill.js', |
|
380 | - array( 'jquery' ), |
|
379 | + GIVE_PLUGIN_URL.'assets/dist/js/babel-polyfill.js', |
|
380 | + array('jquery'), |
|
381 | 381 | GIVE_VERSION, |
382 | 382 | false |
383 | 383 | ); |
384 | 384 | } |
385 | 385 | |
386 | - wp_enqueue_script( 'give' ); |
|
386 | + wp_enqueue_script('give'); |
|
387 | 387 | |
388 | 388 | $this->public_localize_scripts(); |
389 | 389 | } |
@@ -402,22 +402,22 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return string $message Send notice message for email access. |
404 | 404 | */ |
405 | - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) ); |
|
405 | + $message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give')); |
|
406 | 406 | |
407 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
407 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
408 | 408 | 'ajaxurl' => give_get_ajax_url(), |
409 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
409 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
410 | 410 | // Do not use this nonce. Its deprecated. |
411 | 411 | 'currency' => give_get_currency(), |
412 | - 'currency_sign' => give_currency_filter( '' ), |
|
412 | + 'currency_sign' => give_currency_filter(''), |
|
413 | 413 | 'currency_pos' => give_get_currency_position(), |
414 | 414 | 'thousands_separator' => give_get_price_thousand_separator(), |
415 | 415 | 'decimal_separator' => give_get_price_decimal_separator(), |
416 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
417 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
418 | - 'bad_maximum' => __( 'The maximum custom donation amount for this form is', 'give' ), |
|
419 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
420 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
416 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
417 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
418 | + 'bad_maximum' => __('The maximum custom donation amount for this form is', 'give'), |
|
419 | + 'general_loading' => __('Loading...', 'give'), |
|
420 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
421 | 421 | 'number_decimals' => give_get_price_decimals(), |
422 | 422 | 'give_version' => GIVE_VERSION, |
423 | 423 | 'magnific_options' => apply_filters( |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | 'give_form_translation_js', |
432 | 432 | array( |
433 | 433 | // Field name Validation message. |
434 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
435 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
436 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
437 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
438 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
439 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
440 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
434 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
435 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
436 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
437 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
438 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
439 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
440 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
441 | 441 | ) |
442 | 442 | ), |
443 | 443 | 'confirm_email_sent_message' => $message, |
444 | - 'ajax_vars' => apply_filters( 'give_global_ajax_vars', array( |
|
444 | + 'ajax_vars' => apply_filters('give_global_ajax_vars', array( |
|
445 | 445 | 'ajaxurl' => give_get_ajax_url(), |
446 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
447 | - 'loading' => __( 'Loading', 'give' ), |
|
446 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
447 | + 'loading' => __('Loading', 'give'), |
|
448 | 448 | // General loading message. |
449 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
449 | + 'select_option' => __('Please select an option', 'give'), |
|
450 | 450 | // Variable pricing error with multi-donation option enabled. |
451 | - 'default_gateway' => give_get_default_gateway( null ), |
|
452 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
451 | + 'default_gateway' => give_get_default_gateway(null), |
|
452 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
453 | 453 | 'number_decimals' => give_get_price_decimals(), |
454 | - ) ), |
|
454 | + )), |
|
455 | 455 | 'cookie_hash' => COOKIEHASH, |
456 | - 'delete_session_nonce_cookie' => absint( Give()->session->is_delete_nonce_cookie() ) |
|
457 | - ) ); |
|
456 | + 'delete_session_nonce_cookie' => absint(Give()->session->is_delete_nonce_cookie()) |
|
457 | + )); |
|
458 | 458 | |
459 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
459 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -470,15 +470,15 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function get_frontend_stylesheet_uri() { |
472 | 472 | |
473 | - $file = 'give' . $this->direction . '.css'; |
|
473 | + $file = 'give'.$this->direction.'.css'; |
|
474 | 474 | $templates_dir = give_get_theme_template_dir_name(); |
475 | 475 | |
476 | 476 | // Directory paths to CSS files to support checking via file_exists(). |
477 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
478 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
479 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
480 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
481 | - $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file; |
|
477 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
478 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
479 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
480 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
481 | + $give_plugin_style_sheet = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file; |
|
482 | 482 | $uri = false; |
483 | 483 | |
484 | 484 | /** |
@@ -489,23 +489,23 @@ discard block |
||
489 | 489 | * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme. |
490 | 490 | * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin. |
491 | 491 | */ |
492 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
493 | - if ( ! empty( $nonmin ) ) { |
|
494 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
492 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
493 | + if ( ! empty($nonmin)) { |
|
494 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
495 | 495 | } else { |
496 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
496 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
497 | 497 | } |
498 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
499 | - if ( ! empty( $nonmin ) ) { |
|
500 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
498 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
499 | + if ( ! empty($nonmin)) { |
|
500 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
501 | 501 | } else { |
502 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
502 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
503 | 503 | } |
504 | - } elseif ( file_exists( $give_plugin_style_sheet ) ) { |
|
505 | - $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file; |
|
504 | + } elseif (file_exists($give_plugin_style_sheet)) { |
|
505 | + $uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file; |
|
506 | 506 | } |
507 | 507 | |
508 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
508 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
509 | 509 | |
510 | 510 | } |
511 | 511 | |
@@ -517,19 +517,19 @@ discard block |
||
517 | 517 | // Enqueue the bundled block JS file |
518 | 518 | wp_enqueue_script( |
519 | 519 | 'give-blocks-js', |
520 | - GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js', |
|
521 | - array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ), |
|
520 | + GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js', |
|
521 | + array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'), |
|
522 | 522 | GIVE_VERSION |
523 | 523 | ); |
524 | 524 | |
525 | 525 | // Enqueue public styles |
526 | - wp_enqueue_style( 'give-styles' ); |
|
526 | + wp_enqueue_style('give-styles'); |
|
527 | 527 | |
528 | 528 | // Enqueue the bundled block css file |
529 | 529 | wp_enqueue_style( |
530 | 530 | 'give-blocks-css', |
531 | - GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css', |
|
532 | - array( 'wp-blocks' ), |
|
531 | + GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css', |
|
532 | + array('wp-blocks'), |
|
533 | 533 | GIVE_VERSION |
534 | 534 | ); |
535 | 535 |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Exit if accessed directly. |
7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
7 | +if ( ! defined('ABSPATH')) { |
|
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
11 | 11 | /** @var $donor Give_Donor */ |
12 | 12 | $donor = $args[0]; |
13 | -$donor = new Give_Donor( $donor->id ); |
|
13 | +$donor = new Give_Donor($donor->id); |
|
14 | 14 | |
15 | 15 | $give_settings = $args[1]; // Give settings. |
16 | 16 | $atts = $args[2]; // Shortcode attributes. |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | <div class="give-donor__header"> |
22 | 22 | <?php |
23 | 23 | // Maybe display the Avatar. |
24 | - if ( true === $atts['show_avatar'] ) { |
|
25 | - echo give_get_donor_avatar( $donor ); |
|
24 | + if (true === $atts['show_avatar']) { |
|
25 | + echo give_get_donor_avatar($donor); |
|
26 | 26 | } |
27 | 27 | ?> |
28 | 28 | |
29 | 29 | <div class="give-donor__details"> |
30 | - <?php if ( true === $atts['show_name'] ) : ?> |
|
31 | - <h3 class="give-donor__name"><?php esc_html_e( $donor->name ); ?></h3> |
|
30 | + <?php if (true === $atts['show_name']) : ?> |
|
31 | + <h3 class="give-donor__name"><?php esc_html_e($donor->name); ?></h3> |
|
32 | 32 | <?php endif; ?> |
33 | 33 | |
34 | - <?php if ( true === $atts['show_total'] ) : ?> |
|
34 | + <?php if (true === $atts['show_total']) : ?> |
|
35 | 35 | <span class="give-donor__total"> |
36 | 36 | <?php |
37 | 37 | // If not filtered by form ID then display total donations |
38 | 38 | // Else filtered by form ID, only display donations made for this form. |
39 | 39 | $donated_amount = $donor->purchase_value; |
40 | 40 | |
41 | - if ( ! empty( $atts['form_id'] ) ) { |
|
41 | + if ( ! empty($atts['form_id'])) { |
|
42 | 42 | $donated_amount = Give_Donor_Stats::donated( |
43 | 43 | array( |
44 | 44 | 'donor' => $donor->id, |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | - echo give_currency_filter( give_format_amount( $donated_amount, array( 'sanitize' => false ) ) ); |
|
50 | + echo give_currency_filter(give_format_amount($donated_amount, array('sanitize' => false))); |
|
51 | 51 | ?> |
52 | 52 | </span> |
53 | 53 | <?php endif; ?> |
54 | 54 | |
55 | - <?php if ( true === $atts['show_time'] ) : ?> |
|
55 | + <?php if (true === $atts['show_time']) : ?> |
|
56 | 56 | <span class="give-donor__timestamp"> |
57 | 57 | <?php |
58 | 58 | // If not filtered by form ID then display the "Donor Since" text. |
59 | 59 | // If filtered by form ID then display the last donation date. |
60 | - echo $donor->get_last_donation_date( true ); |
|
60 | + echo $donor->get_last_donation_date(true); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | <?php endif; ?> |
@@ -65,25 +65,25 @@ discard block |
||
65 | 65 | </div> |
66 | 66 | |
67 | 67 | <?php |
68 | - $comment = give_get_donor_latest_comment( $donor->id, $atts['form_id'] ); |
|
68 | + $comment = give_get_donor_latest_comment($donor->id, $atts['form_id']); |
|
69 | 69 | |
70 | - if ( true === $atts['show_comments'] && absint( $atts['comment_length'] ) && $comment instanceof WP_Comment ) : |
|
70 | + if (true === $atts['show_comments'] && absint($atts['comment_length']) && $comment instanceof WP_Comment) : |
|
71 | 71 | ?> |
72 | 72 | <div class="give-donor__content"> |
73 | 73 | <?php |
74 | - if ( $atts['comment_length'] < strlen( $comment->comment_content ) ) { |
|
74 | + if ($atts['comment_length'] < strlen($comment->comment_content)) { |
|
75 | 75 | echo sprintf( |
76 | 76 | '<p class="give-donor__comment_excerpt">%s…<span> <a class="give-donor__read-more">%s</a></span></p>', |
77 | - substr( $comment->comment_content, 0, $atts['comment_length'] ), |
|
77 | + substr($comment->comment_content, 0, $atts['comment_length']), |
|
78 | 78 | $atts['readmore_text'] |
79 | 79 | ); |
80 | 80 | |
81 | 81 | echo sprintf( |
82 | 82 | '<div class="give-donor__comment" style="display: none">%s</div>', |
83 | - apply_filters( 'the_content', $comment->comment_content ) |
|
83 | + apply_filters('the_content', $comment->comment_content) |
|
84 | 84 | ); |
85 | 85 | } else { |
86 | - echo apply_filters( 'the_content', $comment->comment_content ); |
|
86 | + echo apply_filters('the_content', $comment->comment_content); |
|
87 | 87 | } |
88 | 88 | ?> |
89 | 89 | </div> |
@@ -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 | |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * Instantiate the class |
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | - $this->self = get_class( $this ); |
|
35 | + $this->self = get_class($this); |
|
36 | 36 | |
37 | 37 | parent::__construct( |
38 | - strtolower( $this->self ), |
|
39 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
38 | + strtolower($this->self), |
|
39 | + esc_html__('Give - Donation Form', 'give'), |
|
40 | 40 | array( |
41 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ), |
|
41 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give'), |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
46 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
45 | + add_action('widgets_init', array($this, 'widget_init')); |
|
46 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function admin_widget_scripts( $hook ) { |
|
56 | + public function admin_widget_scripts($hook) { |
|
57 | 57 | |
58 | 58 | // Directories of assets. |
59 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
60 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
61 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
59 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
60 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
61 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
62 | 62 | |
63 | 63 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
64 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
64 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
65 | 65 | |
66 | 66 | // Widget Script. |
67 | - if ( 'widgets.php' === $hook ) { |
|
67 | + if ('widgets.php' === $hook) { |
|
68 | 68 | |
69 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
69 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * before_widget, and after_widget. |
78 | 78 | * @param array $instance The settings for the particular instance of the widget. |
79 | 79 | */ |
80 | - public function widget( $args, $instance ) { |
|
81 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
82 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
80 | + public function widget($args, $instance) { |
|
81 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
82 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
83 | 83 | $form_id = (int) $instance['id']; |
84 | 84 | |
85 | 85 | echo $args['before_widget']; // XSS ok. |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - do_action( 'give_before_forms_widget', $form_id ); |
|
94 | + do_action('give_before_forms_widget', $form_id); |
|
95 | 95 | |
96 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; // XSS ok. |
|
96 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; // XSS ok. |
|
97 | 97 | |
98 | - give_get_donation_form( $instance ); |
|
98 | + give_get_donation_form($instance); |
|
99 | 99 | |
100 | 100 | echo $args['after_widget']; // XSS ok. |
101 | 101 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.0 |
108 | 108 | */ |
109 | - do_action( 'give_after_forms_widget', $form_id ); |
|
109 | + do_action('give_after_forms_widget', $form_id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param array $instance Current settings. |
116 | 116 | */ |
117 | - public function form( $instance ) { |
|
117 | + public function form($instance) { |
|
118 | 118 | $defaults = array( |
119 | 119 | 'title' => '', |
120 | 120 | 'id' => '', |
@@ -124,74 +124,74 @@ discard block |
||
124 | 124 | 'continue_button_title' => '', |
125 | 125 | ); |
126 | 126 | |
127 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
127 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
128 | 128 | |
129 | 129 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
130 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
130 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
131 | 131 | |
132 | 132 | // Query Give Forms. |
133 | 133 | $args = array( |
134 | 134 | 'post_type' => 'give_forms', |
135 | - 'posts_per_page' => - 1, |
|
135 | + 'posts_per_page' => -1, |
|
136 | 136 | 'post_status' => 'publish', |
137 | 137 | ); |
138 | 138 | |
139 | - $give_forms = get_posts( $args ); |
|
139 | + $give_forms = get_posts($args); |
|
140 | 140 | ?> |
141 | 141 | <div class="give_forms_widget_container"> |
142 | 142 | |
143 | 143 | <?php // Widget: widget Title. ?> |
144 | 144 | <p> |
145 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
146 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /><br> |
|
147 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
145 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
146 | + <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" /><br> |
|
147 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
148 | 148 | </p> |
149 | 149 | |
150 | 150 | <?php // Widget: Give Form. ?> |
151 | 151 | <p> |
152 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
153 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
154 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
155 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
152 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
153 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
154 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
155 | + <?php foreach ($give_forms as $give_form) { ?> |
|
156 | 156 | <?php /* translators: %s: Title */ ?> |
157 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
158 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo esc_html( $form_title ); ?></option> |
|
157 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
158 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo esc_html($form_title); ?></option> |
|
159 | 159 | <?php } ?> |
160 | 160 | </select><br> |
161 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
161 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
162 | 162 | </p> |
163 | 163 | |
164 | 164 | <?php // Widget: Display Style. ?> |
165 | 165 | <p class="give_forms_display_style_setting_row"> |
166 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
167 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
168 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
169 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
170 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
166 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
167 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
168 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
169 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
170 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
171 | 171 | <small class="give-field-description"> |
172 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
172 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
173 | 173 | </small> |
174 | 174 | </p> |
175 | 175 | |
176 | 176 | <?php // Widget: Continue Button Title. ?> |
177 | 177 | <p class="give_forms_continue_button_title_setting_row"> |
178 | - <label for="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
179 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'continue_button_title' ) ); ?>" value="<?php echo esc_attr( $instance['continue_button_title'] ); ?>" /><br> |
|
180 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
178 | + <label for="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
179 | + <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>" name="<?php echo esc_attr($this->get_field_name('continue_button_title')); ?>" value="<?php echo esc_attr($instance['continue_button_title']); ?>" /><br> |
|
180 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
181 | 181 | </p> |
182 | 182 | |
183 | 183 | <?php // Widget: Floating Labels. ?> |
184 | 184 | <p> |
185 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
186 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
187 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
188 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
185 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
186 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
187 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
188 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
189 | 189 | <small class="give-field-description"> |
190 | 190 | <?php |
191 | 191 | printf( |
192 | 192 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
193 | - esc_html__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
194 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
193 | + esc_html__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
194 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
195 | 195 | ); |
196 | 196 | ?> |
197 | 197 | </small> |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | |
200 | 200 | <?php // Widget: Display Content. ?> |
201 | 201 | <p> |
202 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
203 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
204 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
205 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
206 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
202 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
203 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
204 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
205 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
206 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
207 | 207 | </div> |
208 | 208 | <?php |
209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return void |
215 | 215 | */ |
216 | 216 | public function widget_init() { |
217 | - register_widget( $this->self ); |
|
217 | + register_widget($this->self); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return array |
227 | 227 | */ |
228 | - public function update( $new_instance, $old_instance ) { |
|
228 | + public function update($new_instance, $old_instance) { |
|
229 | 229 | $this->flush_widget_cache(); |
230 | 230 | |
231 | 231 | return $new_instance; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return void |
238 | 238 | */ |
239 | 239 | public function flush_widget_cache() { |
240 | - wp_cache_delete( $this->self, 'widget' ); |
|
240 | + wp_cache_delete($this->self, 'widget'); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 |
@@ -10,13 +10,13 @@ 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 | |
17 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <?php $localized_date_format = give_get_localized_date_format_to_js(); ?> |
178 | 178 | <p> |
179 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
180 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
179 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
180 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
181 | 181 | </p> |
182 | 182 | </div> |
183 | 183 | |
184 | 184 | <div class="give-admin-box-inside"> |
185 | 185 | <p> |
186 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
187 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
186 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
187 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
189 | 189 | </p> |
190 | 190 | </div> |
191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param int $payment_id Payment id. |
201 | 201 | */ |
202 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
202 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <div class="give-order-payment give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
208 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
209 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
207 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
208 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
209 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
210 | 210 | </p> |
211 | 211 | </div> |
212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param int $payment_id Payment id. |
220 | 220 | */ |
221 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
221 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
222 | 222 | ?> |
223 | 223 | |
224 | 224 | </div> |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param int $payment_id Payment id. |
238 | 238 | */ |
239 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
239 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <div id="major-publishing-actions"> |
243 | 243 | <div id="publishing-action"> |
244 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
244 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
245 | 245 | <?php |
246 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
246 | + if (give_is_payment_complete($payment_id)) { |
|
247 | 247 | $url = add_query_arg( |
248 | 248 | array( |
249 | 249 | 'give-action' => 'email_links', |
250 | 250 | 'purchase_id' => $payment_id, |
251 | 251 | ), |
252 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ) |
|
252 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | echo sprintf( |
256 | 256 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
257 | - esc_url( $url ), |
|
258 | - esc_html__( 'Resend Receipt', 'give' ) |
|
257 | + esc_url($url), |
|
258 | + esc_html__('Resend Receipt', 'give') |
|
259 | 259 | ); |
260 | 260 | } |
261 | 261 | ?> |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param int $payment_id Payment id. |
272 | 272 | */ |
273 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
273 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
274 | 274 | ?> |
275 | 275 | |
276 | 276 | </div> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | <div id="give-order-details" class="postbox give-order-data"> |
283 | 283 | |
284 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
284 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
285 | 285 | |
286 | 286 | <div class="inside"> |
287 | 287 | <div class="give-admin-box"> |
@@ -294,30 +294,30 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param int $payment_id Payment id. |
296 | 296 | */ |
297 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
297 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
298 | 298 | |
299 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
300 | - if ( $gateway ) : |
|
299 | + $gateway = give_get_payment_gateway($payment_id); |
|
300 | + if ($gateway) : |
|
301 | 301 | ?> |
302 | 302 | <div class="give-order-gateway give-admin-box-inside"> |
303 | 303 | <p> |
304 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
305 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
304 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
305 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
306 | 306 | </p> |
307 | 307 | </div> |
308 | 308 | <?php endif; ?> |
309 | 309 | |
310 | 310 | <div class="give-order-payment-key give-admin-box-inside"> |
311 | 311 | <p> |
312 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
313 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
312 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
313 | + <?php echo give_get_payment_key($payment_id); ?> |
|
314 | 314 | </p> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="give-order-ip give-admin-box-inside"> |
318 | 318 | <p> |
319 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
320 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
319 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
320 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
321 | 321 | </p> |
322 | 322 | </div> |
323 | 323 | |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | // Display the transaction ID present. |
326 | 326 | // The transaction ID is the charge ID from the gateway. |
327 | 327 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
328 | - if ( $transaction_id != $payment_id ) : ?> |
|
328 | + if ($transaction_id != $payment_id) : ?> |
|
329 | 329 | <div class="give-order-tx-id give-admin-box-inside"> |
330 | 330 | <p> |
331 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
332 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
331 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
332 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
333 | 333 | </p> |
334 | 334 | </div> |
335 | 335 | <?php endif; ?> |
336 | 336 | |
337 | 337 | <div class="give-admin-box-inside"> |
338 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
339 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
338 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
339 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
340 | 340 | </p> |
341 | 341 | </div> |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param int $payment_id Payment id. |
350 | 350 | */ |
351 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
351 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
352 | 352 | ?> |
353 | 353 | |
354 | 354 | </div> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param int $payment_id Payment id. |
370 | 370 | */ |
371 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
371 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
372 | 372 | ?> |
373 | 373 | |
374 | 374 | </div> |
@@ -388,31 +388,31 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @param int $payment_id Payment id. |
390 | 390 | */ |
391 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
391 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
392 | 392 | ?> |
393 | 393 | |
394 | 394 | <?php $column_count = 'columns-3'; ?> |
395 | 395 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
396 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
396 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
397 | 397 | |
398 | 398 | <div class="inside"> |
399 | 399 | |
400 | 400 | <div class="column-container"> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
403 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
404 | 404 | <?php |
405 | - if ( $payment_meta['form_id'] ) : |
|
405 | + if ($payment_meta['form_id']) : |
|
406 | 406 | printf( |
407 | 407 | '<a href="%1$s">%2$s</a>', |
408 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
408 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
409 | 409 | $payment_meta['form_id'] |
410 | 410 | ); |
411 | 411 | endif; |
412 | 412 | ?> |
413 | 413 | </p> |
414 | 414 | <p> |
415 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
415 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
416 | 416 | <?php |
417 | 417 | echo Give()->html->forms_dropdown( |
418 | 418 | array( |
@@ -428,21 +428,21 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | <div class="column"> |
430 | 430 | <p> |
431 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
432 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
431 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
432 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
433 | 433 | </p> |
434 | 434 | <p> |
435 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
435 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
436 | 436 | <span class="give-donation-level"> |
437 | 437 | <?php |
438 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
439 | - if ( empty( $var_prices ) ) { |
|
440 | - _e( 'n/a', 'give' ); |
|
438 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
439 | + if (empty($var_prices)) { |
|
440 | + _e('n/a', 'give'); |
|
441 | 441 | } else { |
442 | 442 | $prices_atts = array(); |
443 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
444 | - foreach ( $variable_prices as $variable_price ) { |
|
445 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
443 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
444 | + foreach ($variable_prices as $variable_price) { |
|
445 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | // Variable price dropdown options. |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | 'name' => 'give-variable-price', |
452 | 452 | 'chosen' => true, |
453 | 453 | 'show_option_all' => '', |
454 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
454 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
456 | 456 | 'selected' => $payment_meta['price_id'], |
457 | 457 | ); |
458 | 458 | // Render variable prices select tag html. |
459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | </span> |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | </div> |
465 | 465 | <div class="column"> |
466 | 466 | <p> |
467 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
468 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
467 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
468 | + <?php echo give_donation_amount($payment, true); ?> |
|
469 | 469 | </p> |
470 | 470 | |
471 | - <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ): ?> |
|
471 | + <?php if (give_is_anonymous_donation_field_enabled($payment->form_id)): ?> |
|
472 | 472 | <div> |
473 | - <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong> |
|
473 | + <strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong> |
|
474 | 474 | <ul class="give-radio-inline"> |
475 | 475 | <li> |
476 | 476 | <label> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | name="give_anonymous_donation" |
479 | 479 | value="1" |
480 | 480 | type="radio" |
481 | - <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
482 | - ><?php _e( 'Yes', 'give' ); ?> |
|
481 | + <?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
482 | + ><?php _e('Yes', 'give'); ?> |
|
483 | 483 | </label> |
484 | 484 | </li> |
485 | 485 | <li> |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | name="give_anonymous_donation" |
489 | 489 | value="0" |
490 | 490 | type="radio" |
491 | - <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
492 | - ><?php _e( 'No', 'give' ); ?> |
|
491 | + <?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
492 | + ><?php _e('No', 'give'); ?> |
|
493 | 493 | </label> |
494 | 494 | </li> |
495 | 495 | </ul> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @param int $payment_id Payment id. |
508 | 508 | */ |
509 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
509 | + do_action('give_donation_details_thead_before', $payment_id); |
|
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * |
519 | 519 | * @param int $payment_id Payment id. |
520 | 520 | */ |
521 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
521 | + do_action('give_donation_details_thead_after', $payment_id); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @param int $payment_id Payment id. |
531 | 531 | */ |
532 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
532 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @param int $payment_id Payment id. |
542 | 542 | */ |
543 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
543 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
544 | 544 | ?> |
545 | 545 | </p> |
546 | 546 | </div> |
@@ -560,66 +560,66 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @param int $payment_id Payment id. |
562 | 562 | */ |
563 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
563 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
564 | 564 | ?> |
565 | 565 | |
566 | 566 | <div id="give-donor-details" class="postbox"> |
567 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
567 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
568 | 568 | |
569 | 569 | <div class="inside"> |
570 | 570 | |
571 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
571 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
572 | 572 | |
573 | 573 | <div class="column-container donor-info"> |
574 | 574 | <div class="column"> |
575 | 575 | <p> |
576 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
576 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
577 | 577 | <?php |
578 | - if ( ! empty( $donor->id ) ) { |
|
578 | + if ( ! empty($donor->id)) { |
|
579 | 579 | printf( |
580 | 580 | '<a href="%1$s">%2$s</a>', |
581 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ), |
|
582 | - intval( $donor->id ) |
|
581 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)), |
|
582 | + intval($donor->id) |
|
583 | 583 | ); |
584 | 584 | } |
585 | 585 | ?> |
586 | - <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
586 | + <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span> |
|
587 | 587 | </p> |
588 | 588 | <p> |
589 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
590 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
589 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
590 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
591 | 591 | </p> |
592 | 592 | </div> |
593 | 593 | <div class="column"> |
594 | 594 | <p> |
595 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
595 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
596 | 596 | <?php |
597 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
598 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
597 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
598 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
599 | 599 | |
600 | 600 | // Check whether the donor name and WP_User name is same or not. |
601 | - if ( $donor_billing_name !== $donor_name ) { |
|
601 | + if ($donor_billing_name !== $donor_name) { |
|
602 | 602 | echo sprintf( |
603 | 603 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
604 | - esc_html( $donor_billing_name ), |
|
605 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
606 | - esc_html( $donor_name ) |
|
604 | + esc_html($donor_billing_name), |
|
605 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
606 | + esc_html($donor_name) |
|
607 | 607 | ); |
608 | 608 | } else { |
609 | - echo esc_html( $donor_name ); |
|
609 | + echo esc_html($donor_name); |
|
610 | 610 | } |
611 | 611 | ?> |
612 | 612 | </p> |
613 | 613 | <p> |
614 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
614 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
615 | 615 | <?php |
616 | 616 | // Show Donor donation email first and Primary email on parenthesis if not match both email. |
617 | - echo hash_equals( $donor->email, $payment->email ) |
|
617 | + echo hash_equals($donor->email, $payment->email) |
|
618 | 618 | ? $payment->email |
619 | 619 | : sprintf( |
620 | 620 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
621 | 621 | $payment->email, |
622 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
622 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
623 | 623 | $donor->email |
624 | 624 | ); |
625 | 625 | ?> |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | </div> |
628 | 628 | <div class="column"> |
629 | 629 | <p> |
630 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
630 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
631 | 631 | <?php |
632 | 632 | echo Give()->html->donor_dropdown( |
633 | 633 | array( |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | ?> |
639 | 639 | </p> |
640 | 640 | <p> |
641 | - <?php if ( ! empty( $company_name ) ) { |
|
641 | + <?php if ( ! empty($company_name)) { |
|
642 | 642 | ?> |
643 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
643 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
644 | 644 | <?php |
645 | 645 | echo $company_name; |
646 | 646 | } ?> |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | <div class="column-container new-donor" style="display: none"> |
652 | 652 | <div class="column"> |
653 | 653 | <p> |
654 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
654 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
655 | 655 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
656 | 656 | </p> |
657 | 657 | </div> |
658 | 658 | <div class="column"> |
659 | 659 | <p> |
660 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
660 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
661 | 661 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
662 | 662 | </p> |
663 | 663 | </div> |
664 | 664 | <div class="column"> |
665 | 665 | <p> |
666 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
666 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
667 | 667 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
668 | 668 | </p> |
669 | 669 | </div> |
@@ -671,9 +671,9 @@ discard block |
||
671 | 671 | <p> |
672 | 672 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
673 | 673 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
674 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
674 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
675 | 675 | <br> |
676 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
676 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
677 | 677 | </p> |
678 | 678 | </div> |
679 | 679 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param array $payment_meta Payment meta. |
689 | 689 | * @param array $user_info User information. |
690 | 690 | */ |
691 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
691 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * Fires on the donation details page, in the donor-details metabox. |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @param int $payment_id Payment id. |
699 | 699 | */ |
700 | - do_action( 'give_payment_view_details', $payment_id ); |
|
700 | + do_action('give_payment_view_details', $payment_id); |
|
701 | 701 | ?> |
702 | 702 | |
703 | 703 | </div> |
@@ -713,11 +713,11 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @param int $payment_id Payment id. |
715 | 715 | */ |
716 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
716 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
717 | 717 | ?> |
718 | 718 | |
719 | 719 | <div id="give-billing-details" class="postbox"> |
720 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
720 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
721 | 721 | |
722 | 722 | <div class="inside"> |
723 | 723 | |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | <div class="data column-container"> |
728 | 728 | |
729 | 729 | <?php |
730 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
730 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
731 | 731 | |
732 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
732 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
733 | 733 | |
734 | 734 | // Get the country list that does not have any states init. |
735 | 735 | $no_states_country = give_no_states_country_list(); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | |
738 | 738 | <div class="row"> |
739 | 739 | <div id="give-order-address-country-wrap"> |
740 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
740 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
741 | 741 | <?php |
742 | 742 | echo Give()->html->select( |
743 | 743 | array( |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | 'show_option_all' => false, |
748 | 748 | 'show_option_none' => false, |
749 | 749 | 'chosen' => true, |
750 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
751 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
750 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
751 | + 'data' => array('search-type' => 'no_ajax'), |
|
752 | 752 | ) |
753 | 753 | ); |
754 | 754 | ?> |
@@ -757,35 +757,35 @@ discard block |
||
757 | 757 | |
758 | 758 | <div class="row"> |
759 | 759 | <div class="give-wrap-address-line1"> |
760 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
761 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
760 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
761 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | |
765 | 765 | <div class="row"> |
766 | 766 | <div class="give-wrap-address-line2"> |
767 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
768 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
767 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
768 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
769 | 769 | </div> |
770 | 770 | </div> |
771 | 771 | |
772 | 772 | <div class="row"> |
773 | 773 | <div class="give-wrap-address-city"> |
774 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
775 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
774 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
775 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
776 | 776 | </div> |
777 | 777 | </div> |
778 | 778 | |
779 | 779 | <?php |
780 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
780 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
781 | 781 | ?> |
782 | 782 | <div class="row"> |
783 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
784 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
785 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
783 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
784 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
785 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
786 | 786 | <?php |
787 | - $states = give_get_states( $address['country'] ); |
|
788 | - if ( ! empty( $states ) ) { |
|
787 | + $states = give_get_states($address['country']); |
|
788 | + if ( ! empty($states)) { |
|
789 | 789 | echo Give()->html->select( |
790 | 790 | array( |
791 | 791 | 'options' => $states, |
@@ -794,23 +794,23 @@ discard block |
||
794 | 794 | 'show_option_all' => false, |
795 | 795 | 'show_option_none' => false, |
796 | 796 | 'chosen' => true, |
797 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
798 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
797 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
798 | + 'data' => array('search-type' => 'no_ajax'), |
|
799 | 799 | ) |
800 | 800 | ); |
801 | 801 | } else { |
802 | 802 | ?> |
803 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
803 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
804 | 804 | <?php |
805 | 805 | } |
806 | 806 | ?> |
807 | 807 | </div> |
808 | 808 | </div> |
809 | 809 | |
810 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
810 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
811 | 811 | <div class="give-wrap-address-zip"> |
812 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
813 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
812 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
813 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
814 | 814 | </div> |
815 | 815 | </div> |
816 | 816 | </div> |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | * |
830 | 830 | * @param int $payment_id Payment id. |
831 | 831 | */ |
832 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
832 | + do_action('give_payment_billing_details', $payment_id); |
|
833 | 833 | ?> |
834 | 834 | |
835 | 835 | </div> |
@@ -845,34 +845,34 @@ discard block |
||
845 | 845 | * |
846 | 846 | * @param int $payment_id Payment id. |
847 | 847 | */ |
848 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
848 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
849 | 849 | ?> |
850 | 850 | |
851 | 851 | <div id="give-payment-notes" class="postbox"> |
852 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
852 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
853 | 853 | |
854 | 854 | <div class="inside"> |
855 | 855 | <div id="give-payment-notes-inner"> |
856 | 856 | <?php |
857 | - $notes = give_get_payment_notes( $payment_id ); |
|
858 | - if ( ! empty( $notes ) ) { |
|
857 | + $notes = give_get_payment_notes($payment_id); |
|
858 | + if ( ! empty($notes)) { |
|
859 | 859 | $no_notes_display = ' style="display:none;"'; |
860 | - foreach ( $notes as $note ) : |
|
860 | + foreach ($notes as $note) : |
|
861 | 861 | |
862 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
862 | + echo give_get_payment_note_html($note, $payment_id); |
|
863 | 863 | |
864 | 864 | endforeach; |
865 | 865 | } else { |
866 | 866 | $no_notes_display = ''; |
867 | 867 | } |
868 | 868 | |
869 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
869 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
870 | 870 | ?> |
871 | 871 | </div> |
872 | 872 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
873 | 873 | |
874 | 874 | <div class="give-clearfix"> |
875 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
875 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
876 | 876 | </div> |
877 | 877 | |
878 | 878 | </div> |
@@ -888,18 +888,18 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @param int $payment_id Payment id. |
890 | 890 | */ |
891 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
891 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
892 | 892 | ?> |
893 | 893 | |
894 | - <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?> |
|
894 | + <?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?> |
|
895 | 895 | <div id="give-payment-donor-comment" class="postbox"> |
896 | - <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3> |
|
896 | + <h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3> |
|
897 | 897 | |
898 | 898 | <div class="inside"> |
899 | 899 | <div id="give-payment-donor-comment-inner"> |
900 | 900 | <p> |
901 | 901 | <?php |
902 | - $donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id ); |
|
902 | + $donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id); |
|
903 | 903 | |
904 | 904 | echo sprintf( |
905 | 905 | '<input type="hidden" name="give_comment_id" value="%s">', |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | echo sprintf( |
910 | 910 | '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>', |
911 | - __( 'Add a comment', 'give' ), |
|
911 | + __('Add a comment', 'give'), |
|
912 | 912 | $donor_comment instanceof WP_Comment ? $donor_comment->comment_content : '' |
913 | 913 | ); |
914 | 914 | ?> |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * |
930 | 930 | * @param int $payment_id Payment id. |
931 | 931 | */ |
932 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
932 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
933 | 933 | ?> |
934 | 934 | |
935 | 935 | </div> |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | * |
952 | 952 | * @param int $payment_id Payment id. |
953 | 953 | */ |
954 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
954 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
955 | 955 | |
956 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
956 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
957 | 957 | ?> |
958 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
958 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
959 | 959 | <input type="hidden" name="give_action" value="update_payment_details"/> |
960 | 960 | </form> |
961 | 961 | <?php |
@@ -966,6 +966,6 @@ discard block |
||
966 | 966 | * |
967 | 967 | * @param int $payment_id Payment id. |
968 | 968 | */ |
969 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
969 | + do_action('give_view_donation_details_after', $payment_id); |
|
970 | 970 | ?> |
971 | 971 | </div><!-- /.wrap --> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,70 +25,70 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | |
77 | - case version_compare( $give_version, '2.0', '<' ) : |
|
77 | + case version_compare($give_version, '2.0', '<') : |
|
78 | 78 | give_v20_upgrades(); |
79 | 79 | $did_upgrade = true; |
80 | 80 | |
81 | - case version_compare( $give_version, '2.0.1', '<' ) : |
|
81 | + case version_compare($give_version, '2.0.1', '<') : |
|
82 | 82 | // Do nothing on fresh install. |
83 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
83 | + if ( ! doing_action('give_upgrades')) { |
|
84 | 84 | give_v201_create_tables(); |
85 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
85 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
86 | 86 | Give_Updates::$background_updater->dispatch(); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $did_upgrade = true; |
90 | 90 | |
91 | - case version_compare( $give_version, '2.0.2', '<' ) : |
|
91 | + case version_compare($give_version, '2.0.2', '<') : |
|
92 | 92 | // Remove 2.0.1 update to rerun on 2.0.2 |
93 | 93 | $completed_upgrades = give_get_completed_upgrades(); |
94 | 94 | $v201_updates = array( |
@@ -98,43 +98,43 @@ discard block |
||
98 | 98 | 'v201_logs_upgrades', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $v201_updates as $v201_update ) { |
|
102 | - if ( in_array( $v201_update, $completed_upgrades ) ) { |
|
103 | - unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] ); |
|
101 | + foreach ($v201_updates as $v201_update) { |
|
102 | + if (in_array($v201_update, $completed_upgrades)) { |
|
103 | + unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - update_option( 'give_completed_upgrades', $completed_upgrades, false ); |
|
107 | + update_option('give_completed_upgrades', $completed_upgrades, false); |
|
108 | 108 | |
109 | 109 | // Do nothing on fresh install. |
110 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
110 | + if ( ! doing_action('give_upgrades')) { |
|
111 | 111 | give_v201_create_tables(); |
112 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
112 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
113 | 113 | Give_Updates::$background_updater->dispatch(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $did_upgrade = true; |
117 | 117 | |
118 | - case version_compare( $give_version, '2.0.3', '<' ) : |
|
118 | + case version_compare($give_version, '2.0.3', '<') : |
|
119 | 119 | give_v203_upgrades(); |
120 | 120 | $did_upgrade = true; |
121 | 121 | |
122 | - case version_compare( $give_version, '2.2.0', '<' ) : |
|
122 | + case version_compare($give_version, '2.2.0', '<') : |
|
123 | 123 | give_v220_upgrades(); |
124 | 124 | $did_upgrade = true; |
125 | 125 | |
126 | - case version_compare( $give_version, '2.2.1', '<' ) : |
|
126 | + case version_compare($give_version, '2.2.1', '<') : |
|
127 | 127 | give_v221_upgrades(); |
128 | 128 | $did_upgrade = true; |
129 | 129 | } |
130 | 130 | |
131 | - if ( $did_upgrade ) { |
|
132 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false ); |
|
131 | + if ($did_upgrade) { |
|
132 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
137 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
136 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
137 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Display Upgrade Notices. |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return void |
150 | 150 | */ |
151 | -function give_show_upgrade_notices( $give_updates ) { |
|
151 | +function give_show_upgrade_notices($give_updates) { |
|
152 | 152 | // v1.3.2 Upgrades |
153 | 153 | $give_updates->register( |
154 | 154 | array( |
@@ -214,32 +214,32 @@ discard block |
||
214 | 214 | ); |
215 | 215 | |
216 | 216 | // v1.8.17 Upgrades for donations. |
217 | - $give_updates->register( array( |
|
217 | + $give_updates->register(array( |
|
218 | 218 | 'id' => 'v1817_update_donation_iranian_currency_code', |
219 | 219 | 'version' => '1.8.17', |
220 | 220 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
221 | - ) ); |
|
221 | + )); |
|
222 | 222 | |
223 | 223 | // v1.8.17 Upgrades for cleanup of user roles. |
224 | - $give_updates->register( array( |
|
224 | + $give_updates->register(array( |
|
225 | 225 | 'id' => 'v1817_cleanup_user_roles', |
226 | 226 | 'version' => '1.8.17', |
227 | 227 | 'callback' => 'give_v1817_cleanup_user_roles', |
228 | - ) ); |
|
228 | + )); |
|
229 | 229 | |
230 | 230 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
231 | - $give_updates->register( array( |
|
231 | + $give_updates->register(array( |
|
232 | 232 | 'id' => 'v1818_assign_custom_amount_set_donation', |
233 | 233 | 'version' => '1.8.18', |
234 | 234 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | 237 | // v1.8.18 Cleanup the Give Worker Role Caps. |
238 | - $give_updates->register( array( |
|
238 | + $give_updates->register(array( |
|
239 | 239 | 'id' => 'v1818_give_worker_role_cleanup', |
240 | 240 | 'version' => '1.8.18', |
241 | 241 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
242 | - ) ); |
|
242 | + )); |
|
243 | 243 | |
244 | 244 | // v2.0.0 Upgrades |
245 | 245 | $give_updates->register( |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'id' => 'v20_move_metadata_into_new_table', |
294 | 294 | 'version' => '2.0.0', |
295 | 295 | 'callback' => 'give_v20_move_metadata_into_new_table_callback', |
296 | - 'depend' => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ), |
|
296 | + 'depend' => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'), |
|
297 | 297 | ) |
298 | 298 | ); |
299 | 299 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'id' => 'v201_move_metadata_into_new_table', |
340 | 340 | 'version' => '2.0.1', |
341 | 341 | 'callback' => 'give_v201_move_metadata_into_new_table_callback', |
342 | - 'depend' => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ), |
|
342 | + 'depend' => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'), |
|
343 | 343 | ) |
344 | 344 | ); |
345 | 345 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'id' => 'v213_delete_donation_meta', |
368 | 368 | 'version' => '2.1.3', |
369 | 369 | 'callback' => 'give_v213_delete_donation_meta_callback', |
370 | - 'depends' => array( 'v201_move_metadata_into_new_table' ) |
|
370 | + 'depends' => array('v201_move_metadata_into_new_table') |
|
371 | 371 | ) |
372 | 372 | ); |
373 | 373 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ); |
382 | 382 | } |
383 | 383 | |
384 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
384 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Triggers all upgrade functions |
@@ -393,29 +393,29 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function give_trigger_upgrades() { |
395 | 395 | |
396 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
397 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
396 | + if ( ! current_user_can('manage_give_settings')) { |
|
397 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
398 | 398 | 'response' => 403, |
399 | - ) ); |
|
399 | + )); |
|
400 | 400 | } |
401 | 401 | |
402 | - $give_version = get_option( 'give_version' ); |
|
402 | + $give_version = get_option('give_version'); |
|
403 | 403 | |
404 | - if ( ! $give_version ) { |
|
404 | + if ( ! $give_version) { |
|
405 | 405 | // 1.0 is the first version to use this option so we must add it. |
406 | 406 | $give_version = '1.0'; |
407 | - add_option( 'give_version', $give_version, '', false ); |
|
407 | + add_option('give_version', $give_version, '', false); |
|
408 | 408 | } |
409 | 409 | |
410 | - update_option( 'give_version', GIVE_VERSION, false ); |
|
411 | - delete_option( 'give_doing_upgrade' ); |
|
410 | + update_option('give_version', GIVE_VERSION, false); |
|
411 | + delete_option('give_doing_upgrade'); |
|
412 | 412 | |
413 | - if ( DOING_AJAX ) { |
|
414 | - die( 'complete' ); |
|
413 | + if (DOING_AJAX) { |
|
414 | + die('complete'); |
|
415 | 415 | } // End if(). |
416 | 416 | } |
417 | 417 | |
418 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
418 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
419 | 419 | |
420 | 420 | |
421 | 421 | /** |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | |
434 | 434 | // UPDATE DB METAKEYS. |
435 | 435 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
436 | - $query = $wpdb->query( $sql ); |
|
436 | + $query = $wpdb->query($sql); |
|
437 | 437 | |
438 | 438 | $give_updates->percentage = 100; |
439 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
439 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -460,24 +460,24 @@ discard block |
||
460 | 460 | $where .= "AND ( p.post_status = 'abandoned' )"; |
461 | 461 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
462 | 462 | |
463 | - $sql = $select . $join . $where; |
|
464 | - $found_payments = $wpdb->get_col( $sql ); |
|
463 | + $sql = $select.$join.$where; |
|
464 | + $found_payments = $wpdb->get_col($sql); |
|
465 | 465 | |
466 | - foreach ( $found_payments as $payment ) { |
|
466 | + foreach ($found_payments as $payment) { |
|
467 | 467 | |
468 | 468 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
469 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
469 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
470 | 470 | |
471 | 471 | // 1450124863 = 12/10/2015 20:42:25. |
472 | - if ( $modified_time >= 1450124863 ) { |
|
472 | + if ($modified_time >= 1450124863) { |
|
473 | 473 | |
474 | - give_update_payment_status( $payment, 'pending' ); |
|
474 | + give_update_payment_status($payment, 'pending'); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | 479 | $give_updates->percentage = 100; |
480 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
480 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | */ |
491 | 491 | function give_v152_cleanup_users() { |
492 | 492 | |
493 | - $give_version = get_option( 'give_version' ); |
|
493 | + $give_version = get_option('give_version'); |
|
494 | 494 | |
495 | - if ( ! $give_version ) { |
|
495 | + if ( ! $give_version) { |
|
496 | 496 | // 1.0 is the first version to use this option so we must add it. |
497 | 497 | $give_version = '1.0'; |
498 | 498 | } |
499 | 499 | |
500 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
500 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
501 | 501 | |
502 | 502 | // v1.5.2 Upgrades |
503 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
503 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
504 | 504 | |
505 | 505 | // Delete all caps with "ss". |
506 | 506 | // Also delete all unused "campaign" roles. |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | ); |
548 | 548 | |
549 | 549 | global $wp_roles; |
550 | - foreach ( $delete_caps as $cap ) { |
|
551 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
552 | - $wp_roles->remove_cap( $role, $cap ); |
|
550 | + foreach ($delete_caps as $cap) { |
|
551 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
552 | + $wp_roles->remove_cap($role, $cap); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -559,15 +559,15 @@ discard block |
||
559 | 559 | $roles->add_caps(); |
560 | 560 | |
561 | 561 | // The Update Ran. |
562 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false ); |
|
563 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
564 | - delete_option( 'give_doing_upgrade' ); |
|
562 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false); |
|
563 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
564 | + delete_option('give_doing_upgrade'); |
|
565 | 565 | |
566 | 566 | }// End if(). |
567 | 567 | |
568 | 568 | } |
569 | 569 | |
570 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
570 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
571 | 571 | |
572 | 572 | /** |
573 | 573 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -610,53 +610,53 @@ discard block |
||
610 | 610 | |
611 | 611 | // Get addons license key. |
612 | 612 | $addons = array(); |
613 | - foreach ( $give_options as $key => $value ) { |
|
614 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
615 | - $addons[ $key ] = $value; |
|
613 | + foreach ($give_options as $key => $value) { |
|
614 | + if (false !== strpos($key, '_license_key')) { |
|
615 | + $addons[$key] = $value; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | // Bailout: We do not have any addon license data to upgrade. |
620 | - if ( empty( $addons ) ) { |
|
620 | + if (empty($addons)) { |
|
621 | 621 | return false; |
622 | 622 | } |
623 | 623 | |
624 | - foreach ( $addons as $key => $addon_license ) { |
|
624 | + foreach ($addons as $key => $addon_license) { |
|
625 | 625 | |
626 | 626 | // Get addon shortname. |
627 | - $shortname = str_replace( '_license_key', '', $key ); |
|
627 | + $shortname = str_replace('_license_key', '', $key); |
|
628 | 628 | |
629 | 629 | // Addon license option name. |
630 | - $addon_license_option_name = $shortname . '_license_active'; |
|
630 | + $addon_license_option_name = $shortname.'_license_active'; |
|
631 | 631 | |
632 | 632 | // bailout if license is empty. |
633 | - if ( empty( $addon_license ) ) { |
|
634 | - delete_option( $addon_license_option_name ); |
|
633 | + if (empty($addon_license)) { |
|
634 | + delete_option($addon_license_option_name); |
|
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | |
638 | 638 | // Get addon name. |
639 | 639 | $addon_name = array(); |
640 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
641 | - foreach ( $addon_name_parts as $name_part ) { |
|
640 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
641 | + foreach ($addon_name_parts as $name_part) { |
|
642 | 642 | |
643 | 643 | // Fix addon name |
644 | - switch ( $name_part ) { |
|
644 | + switch ($name_part) { |
|
645 | 645 | case 'authorizenet' : |
646 | 646 | $name_part = 'authorize.net'; |
647 | 647 | break; |
648 | 648 | } |
649 | 649 | |
650 | - $addon_name[] = ucfirst( $name_part ); |
|
650 | + $addon_name[] = ucfirst($name_part); |
|
651 | 651 | } |
652 | 652 | |
653 | - $addon_name = implode( ' ', $addon_name ); |
|
653 | + $addon_name = implode(' ', $addon_name); |
|
654 | 654 | |
655 | 655 | // Data to send to the API. |
656 | 656 | $api_params = array( |
657 | 657 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
658 | 658 | 'license' => $addon_license, |
659 | - 'item_name' => urlencode( $addon_name ), |
|
659 | + 'item_name' => urlencode($addon_name), |
|
660 | 660 | 'url' => home_url(), |
661 | 661 | ); |
662 | 662 | |
@@ -671,17 +671,17 @@ discard block |
||
671 | 671 | ); |
672 | 672 | |
673 | 673 | // Make sure there are no errors. |
674 | - if ( is_wp_error( $response ) ) { |
|
675 | - delete_option( $addon_license_option_name ); |
|
674 | + if (is_wp_error($response)) { |
|
675 | + delete_option($addon_license_option_name); |
|
676 | 676 | continue; |
677 | 677 | } |
678 | 678 | |
679 | 679 | // Tell WordPress to look for updates. |
680 | - set_site_transient( 'update_plugins', null ); |
|
680 | + set_site_transient('update_plugins', null); |
|
681 | 681 | |
682 | 682 | // Decode license data. |
683 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
684 | - update_option( $addon_license_option_name, $license_data, false ); |
|
683 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
684 | + update_option($addon_license_option_name, $license_data, false); |
|
685 | 685 | }// End foreach(). |
686 | 686 | } |
687 | 687 | |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | ); |
712 | 712 | |
713 | 713 | global $wp_roles; |
714 | - foreach ( $delete_caps as $cap ) { |
|
715 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
716 | - $wp_roles->remove_cap( $role, $cap ); |
|
714 | + foreach ($delete_caps as $cap) { |
|
715 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
716 | + $wp_roles->remove_cap($role, $cap); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | function give_v18_upgrades_core_setting() { |
748 | 748 | // Core settings which changes from checkbox to radio. |
749 | 749 | $core_setting_names = array_merge( |
750 | - array_keys( give_v18_renamed_core_settings() ), |
|
750 | + array_keys(give_v18_renamed_core_settings()), |
|
751 | 751 | array( |
752 | 752 | 'uninstall_on_delete', |
753 | 753 | 'scripts_footer', |
@@ -759,48 +759,48 @@ discard block |
||
759 | 759 | ); |
760 | 760 | |
761 | 761 | // Bailout: If not any setting define. |
762 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
762 | + if ($give_settings = get_option('give_settings')) { |
|
763 | 763 | |
764 | 764 | $setting_changed = false; |
765 | 765 | |
766 | 766 | // Loop: check each setting field. |
767 | - foreach ( $core_setting_names as $setting_name ) { |
|
767 | + foreach ($core_setting_names as $setting_name) { |
|
768 | 768 | // New setting name. |
769 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
769 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
770 | 770 | |
771 | 771 | // Continue: If setting already set. |
772 | 772 | if ( |
773 | - array_key_exists( $new_setting_name, $give_settings ) |
|
774 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
773 | + array_key_exists($new_setting_name, $give_settings) |
|
774 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
775 | 775 | ) { |
776 | 776 | continue; |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Set checkbox value to radio value. |
780 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
780 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
781 | 781 | |
782 | 782 | // @see https://github.com/WordImpress/Give/issues/1063. |
783 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
783 | + if (false !== strpos($setting_name, 'disable_')) { |
|
784 | 784 | |
785 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
786 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
785 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
786 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
787 | 787 | |
788 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
788 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | // Tell bot to update core setting to db. |
792 | - if ( ! $setting_changed ) { |
|
792 | + if ( ! $setting_changed) { |
|
793 | 793 | $setting_changed = true; |
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | 797 | // Update setting only if they changed. |
798 | - if ( $setting_changed ) { |
|
799 | - update_option( 'give_settings', $give_settings, false ); |
|
798 | + if ($setting_changed) { |
|
799 | + update_option('give_settings', $give_settings, false); |
|
800 | 800 | } |
801 | 801 | }// End if(). |
802 | 802 | |
803 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
803 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | $give_updates = Give_Updates::get_instance(); |
815 | 815 | |
816 | 816 | // form query |
817 | - $forms = new WP_Query( array( |
|
817 | + $forms = new WP_Query(array( |
|
818 | 818 | 'paged' => $give_updates->step, |
819 | 819 | 'status' => 'any', |
820 | 820 | 'order' => 'ASC', |
@@ -823,41 +823,41 @@ discard block |
||
823 | 823 | ) |
824 | 824 | ); |
825 | 825 | |
826 | - if ( $forms->have_posts() ) { |
|
827 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
826 | + if ($forms->have_posts()) { |
|
827 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
828 | 828 | |
829 | - while ( $forms->have_posts() ) { |
|
829 | + while ($forms->have_posts()) { |
|
830 | 830 | $forms->the_post(); |
831 | 831 | |
832 | 832 | // Form content. |
833 | 833 | // Note in version 1.8 display content setting split into display content and content placement setting. |
834 | 834 | // You can delete _give_content_option in future. |
835 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
836 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
837 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
838 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
835 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
836 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
837 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
838 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
839 | 839 | |
840 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
841 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
840 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
841 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | // "Disable" Guest Donation. Checkbox. |
845 | 845 | // See: https://github.com/WordImpress/Give/issues/1470. |
846 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
847 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
848 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
846 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
847 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
848 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
849 | 849 | |
850 | 850 | // Offline Donations. |
851 | 851 | // See: https://github.com/WordImpress/Give/issues/1579. |
852 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
853 | - if ( 'no' === $offline_donation ) { |
|
852 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
853 | + if ('no' === $offline_donation) { |
|
854 | 854 | $offline_donation_newval = 'global'; |
855 | - } elseif ( 'yes' === $offline_donation ) { |
|
855 | + } elseif ('yes' === $offline_donation) { |
|
856 | 856 | $offline_donation_newval = 'enabled'; |
857 | 857 | } else { |
858 | 858 | $offline_donation_newval = 'disabled'; |
859 | 859 | } |
860 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
860 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
861 | 861 | |
862 | 862 | // Convert yes/no setting field to enabled/disabled. |
863 | 863 | $form_radio_settings = array( |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | '_give_offline_donation_enable_billing_fields_single', |
878 | 878 | ); |
879 | 879 | |
880 | - foreach ( $form_radio_settings as $meta_key ) { |
|
880 | + foreach ($form_radio_settings as $meta_key) { |
|
881 | 881 | // Get value. |
882 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
882 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
883 | 883 | |
884 | 884 | // Convert meta value only if it is in yes/no/none. |
885 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
885 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
886 | 886 | |
887 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
888 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
887 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
888 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | }// End while(). |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | |
895 | 895 | } else { |
896 | 896 | // No more forms found, finish up. |
897 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
897 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | '%_transient_give_stats_%', |
962 | 962 | 'give_cache%', |
963 | 963 | '%_transient_give_add_ons_feed%', |
964 | - '%_transient__give_ajax_works' . |
|
964 | + '%_transient__give_ajax_works'. |
|
965 | 965 | '%_transient_give_total_api_keys%', |
966 | 966 | '%_transient_give_i18n_give_promo_hide%', |
967 | 967 | '%_transient_give_contributors%', |
@@ -988,24 +988,24 @@ discard block |
||
988 | 988 | ARRAY_A |
989 | 989 | ); |
990 | 990 | |
991 | - if ( ! empty( $user_apikey_options ) ) { |
|
992 | - foreach ( $user_apikey_options as $user ) { |
|
993 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
994 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
995 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
991 | + if ( ! empty($user_apikey_options)) { |
|
992 | + foreach ($user_apikey_options as $user) { |
|
993 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
994 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
995 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
999 | - if ( ! empty( $cached_options ) ) { |
|
1000 | - foreach ( $cached_options as $option ) { |
|
1001 | - switch ( true ) { |
|
1002 | - case ( false !== strpos( $option, 'transient' ) ): |
|
1003 | - $option = str_replace( '_transient_', '', $option ); |
|
1004 | - delete_transient( $option ); |
|
999 | + if ( ! empty($cached_options)) { |
|
1000 | + foreach ($cached_options as $option) { |
|
1001 | + switch (true) { |
|
1002 | + case (false !== strpos($option, 'transient')): |
|
1003 | + $option = str_replace('_transient_', '', $option); |
|
1004 | + delete_transient($option); |
|
1005 | 1005 | break; |
1006 | 1006 | |
1007 | 1007 | default: |
1008 | - delete_option( $option ); |
|
1008 | + delete_option($option); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | global $wp_roles; |
1024 | 1024 | |
1025 | 1025 | // Get the role object. |
1026 | - $give_worker = get_role( 'give_worker' ); |
|
1026 | + $give_worker = get_role('give_worker'); |
|
1027 | 1027 | |
1028 | 1028 | // A list of capabilities to add for give workers. |
1029 | 1029 | $caps_to_add = array( |
@@ -1031,9 +1031,9 @@ discard block |
||
1031 | 1031 | 'edit_pages', |
1032 | 1032 | ); |
1033 | 1033 | |
1034 | - foreach ( $caps_to_add as $cap ) { |
|
1034 | + foreach ($caps_to_add as $cap) { |
|
1035 | 1035 | // Add the capability. |
1036 | - $give_worker->add_cap( $cap ); |
|
1036 | + $give_worker->add_cap($cap); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $give_updates = Give_Updates::get_instance(); |
1051 | 1051 | |
1052 | 1052 | // form query. |
1053 | - $donation_forms = new WP_Query( array( |
|
1053 | + $donation_forms = new WP_Query(array( |
|
1054 | 1054 | 'paged' => $give_updates->step, |
1055 | 1055 | 'status' => 'any', |
1056 | 1056 | 'order' => 'ASC', |
@@ -1059,10 +1059,10 @@ discard block |
||
1059 | 1059 | ) |
1060 | 1060 | ); |
1061 | 1061 | |
1062 | - if ( $donation_forms->have_posts() ) { |
|
1063 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1062 | + if ($donation_forms->have_posts()) { |
|
1063 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1064 | 1064 | |
1065 | - while ( $donation_forms->have_posts() ) { |
|
1065 | + while ($donation_forms->have_posts()) { |
|
1066 | 1066 | $donation_forms->the_post(); |
1067 | 1067 | $form_id = get_the_ID(); |
1068 | 1068 | |
@@ -1070,41 +1070,41 @@ discard block |
||
1070 | 1070 | update_post_meta( |
1071 | 1071 | $form_id, |
1072 | 1072 | '_give_set_price', |
1073 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
1073 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
1074 | 1074 | ); |
1075 | 1075 | |
1076 | 1076 | // Remove formatting from _give_custom_amount_minimum. |
1077 | 1077 | update_post_meta( |
1078 | 1078 | $form_id, |
1079 | 1079 | '_give_custom_amount_minimum', |
1080 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
1080 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
1081 | 1081 | ); |
1082 | 1082 | |
1083 | 1083 | // Bailout. |
1084 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
1084 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
1085 | 1085 | continue; |
1086 | 1086 | } |
1087 | 1087 | |
1088 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
1088 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
1089 | 1089 | |
1090 | - if ( ! empty( $donation_levels ) ) { |
|
1090 | + if ( ! empty($donation_levels)) { |
|
1091 | 1091 | |
1092 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
1093 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
1094 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
1092 | + foreach ($donation_levels as $index => $donation_level) { |
|
1093 | + if (isset($donation_level['_give_amount'])) { |
|
1094 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
1098 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
1099 | 1099 | |
1100 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
1100 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
1101 | 1101 | |
1102 | - $min_amount = min( $donation_levels_amounts ); |
|
1103 | - $max_amount = max( $donation_levels_amounts ); |
|
1102 | + $min_amount = min($donation_levels_amounts); |
|
1103 | + $max_amount = max($donation_levels_amounts); |
|
1104 | 1104 | |
1105 | 1105 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
1106 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
1107 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
1106 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
1107 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | wp_reset_postdata(); |
1114 | 1114 | } else { |
1115 | 1115 | // The Update Ran. |
1116 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
1116 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | } |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | */ |
1164 | 1164 | function give_v20_upgrades() { |
1165 | 1165 | // Update cache setting. |
1166 | - give_update_option( 'cache', 'enabled' ); |
|
1166 | + give_update_option('cache', 'enabled'); |
|
1167 | 1167 | |
1168 | 1168 | // Upgrade email settings. |
1169 | 1169 | give_v20_upgrades_email_setting(); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $all_setting = give_get_settings(); |
1183 | 1183 | |
1184 | 1184 | // Bailout on fresh install. |
1185 | - if ( empty( $all_setting ) ) { |
|
1185 | + if (empty($all_setting)) { |
|
1186 | 1186 | return; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1201,19 +1201,19 @@ discard block |
||
1201 | 1201 | 'admin_notices' => 'new-donation_notification', |
1202 | 1202 | ); |
1203 | 1203 | |
1204 | - foreach ( $settings as $old_setting => $new_setting ) { |
|
1204 | + foreach ($settings as $old_setting => $new_setting) { |
|
1205 | 1205 | // Do not update already modified |
1206 | - if ( ! is_array( $new_setting ) ) { |
|
1207 | - if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) { |
|
1206 | + if ( ! is_array($new_setting)) { |
|
1207 | + if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) { |
|
1208 | 1208 | continue; |
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - switch ( $old_setting ) { |
|
1212 | + switch ($old_setting) { |
|
1213 | 1213 | case 'admin_notices': |
1214 | - $notification_status = give_get_option( $old_setting, 'enabled' ); |
|
1214 | + $notification_status = give_get_option($old_setting, 'enabled'); |
|
1215 | 1215 | |
1216 | - give_update_option( $new_setting, $notification_status ); |
|
1216 | + give_update_option($new_setting, $notification_status); |
|
1217 | 1217 | |
1218 | 1218 | // @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon. |
1219 | 1219 | // give_delete_option( $old_setting ); |
@@ -1224,19 +1224,19 @@ discard block |
||
1224 | 1224 | case 'admin_notice_emails': |
1225 | 1225 | $recipients = give_get_admin_notice_emails(); |
1226 | 1226 | |
1227 | - foreach ( $new_setting as $setting ) { |
|
1227 | + foreach ($new_setting as $setting) { |
|
1228 | 1228 | // bailout if setting already exist. |
1229 | - if ( array_key_exists( $setting, $all_setting ) ) { |
|
1229 | + if (array_key_exists($setting, $all_setting)) { |
|
1230 | 1230 | continue; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - give_update_option( $setting, $recipients ); |
|
1233 | + give_update_option($setting, $recipients); |
|
1234 | 1234 | } |
1235 | 1235 | break; |
1236 | 1236 | |
1237 | 1237 | default: |
1238 | - give_update_option( $new_setting, give_get_option( $old_setting ) ); |
|
1239 | - give_delete_option( $old_setting ); |
|
1238 | + give_update_option($new_setting, give_get_option($old_setting)); |
|
1239 | + give_delete_option($old_setting); |
|
1240 | 1240 | } |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1253,22 +1253,22 @@ discard block |
||
1253 | 1253 | $give_settings = give_get_settings(); |
1254 | 1254 | $give_setting_updated = false; |
1255 | 1255 | |
1256 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
1256 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
1257 | 1257 | $give_settings['number_decimals'] = 0; |
1258 | 1258 | $give_settings['decimal_separator'] = ''; |
1259 | 1259 | $give_setting_updated = true; |
1260 | 1260 | |
1261 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
1261 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
1262 | 1262 | $give_settings['number_decimals'] = 0; |
1263 | 1263 | $give_setting_updated = true; |
1264 | 1264 | |
1265 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
1265 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
1266 | 1266 | $give_settings['number_decimals'] = 5; |
1267 | 1267 | $give_setting_updated = true; |
1268 | 1268 | } |
1269 | 1269 | |
1270 | - if ( $give_setting_updated ) { |
|
1271 | - update_option( 'give_settings', $give_settings, false ); |
|
1270 | + if ($give_setting_updated) { |
|
1271 | + update_option('give_settings', $give_settings, false); |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1287,69 +1287,69 @@ discard block |
||
1287 | 1287 | $give_updates = Give_Updates::get_instance(); |
1288 | 1288 | |
1289 | 1289 | // form query. |
1290 | - $donation_forms = new WP_Query( array( |
|
1290 | + $donation_forms = new WP_Query(array( |
|
1291 | 1291 | 'paged' => $give_updates->step, |
1292 | 1292 | 'status' => 'any', |
1293 | 1293 | 'order' => 'ASC', |
1294 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1294 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1295 | 1295 | 'posts_per_page' => 20, |
1296 | 1296 | ) |
1297 | 1297 | ); |
1298 | - if ( $donation_forms->have_posts() ) { |
|
1299 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1298 | + if ($donation_forms->have_posts()) { |
|
1299 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1300 | 1300 | |
1301 | - while ( $donation_forms->have_posts() ) { |
|
1301 | + while ($donation_forms->have_posts()) { |
|
1302 | 1302 | $donation_forms->the_post(); |
1303 | 1303 | global $post; |
1304 | 1304 | |
1305 | - $meta = get_post_meta( $post->ID ); |
|
1305 | + $meta = get_post_meta($post->ID); |
|
1306 | 1306 | |
1307 | - switch ( $post->post_type ) { |
|
1307 | + switch ($post->post_type) { |
|
1308 | 1308 | case 'give_forms': |
1309 | 1309 | // _give_set_price. |
1310 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1311 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1310 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1311 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | // _give_custom_amount_minimum. |
1315 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1316 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1315 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1316 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | // _give_levels_minimum_amount. |
1320 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1321 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1320 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1321 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | // _give_levels_maximum_amount. |
1325 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1326 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1325 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1326 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | // _give_set_goal. |
1330 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1331 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1330 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1331 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | // _give_form_earnings. |
1335 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1336 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1335 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1336 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | // _give_custom_amount_minimum. |
1340 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1341 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1340 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1341 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1342 | 1342 | |
1343 | - foreach ( $donation_levels as $index => $level ) { |
|
1344 | - if ( empty( $level['_give_amount'] ) ) { |
|
1343 | + foreach ($donation_levels as $index => $level) { |
|
1344 | + if (empty($level['_give_amount'])) { |
|
1345 | 1345 | continue; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1348 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | $meta['_give_donation_levels'] = $donation_levels; |
1352 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1352 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | |
@@ -1357,8 +1357,8 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | case 'give_payment': |
1359 | 1359 | // _give_payment_total. |
1360 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1361 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1360 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1361 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | break; |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | wp_reset_postdata(); |
1370 | 1370 | } else { |
1371 | 1371 | // The Update Ran. |
1372 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1372 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,22 +1388,22 @@ discard block |
||
1388 | 1388 | $give_updates = Give_Updates::get_instance(); |
1389 | 1389 | |
1390 | 1390 | // form query. |
1391 | - $donors = Give()->donors->get_donors( array( |
|
1391 | + $donors = Give()->donors->get_donors(array( |
|
1392 | 1392 | 'number' => 20, |
1393 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1393 | + 'offset' => $give_updates->get_offset(20), |
|
1394 | 1394 | ) |
1395 | 1395 | ); |
1396 | 1396 | |
1397 | - if ( ! empty( $donors ) ) { |
|
1398 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1397 | + if ( ! empty($donors)) { |
|
1398 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1399 | 1399 | |
1400 | 1400 | /* @var Object $donor */ |
1401 | - foreach ( $donors as $donor ) { |
|
1402 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1401 | + foreach ($donors as $donor) { |
|
1402 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1403 | 1403 | } |
1404 | 1404 | } else { |
1405 | 1405 | // The Update Ran. |
1406 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1406 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | |
@@ -1417,25 +1417,25 @@ discard block |
||
1417 | 1417 | $give_updates = Give_Updates::get_instance(); |
1418 | 1418 | |
1419 | 1419 | // Fetch all the existing donors. |
1420 | - $donors = Give()->donors->get_donors( array( |
|
1420 | + $donors = Give()->donors->get_donors(array( |
|
1421 | 1421 | 'number' => 20, |
1422 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1422 | + 'offset' => $give_updates->get_offset(20), |
|
1423 | 1423 | ) |
1424 | 1424 | ); |
1425 | 1425 | |
1426 | - if ( ! empty( $donors ) ) { |
|
1427 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1426 | + if ( ! empty($donors)) { |
|
1427 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1428 | 1428 | |
1429 | 1429 | /* @var Object $donor */ |
1430 | - foreach ( $donors as $donor ) { |
|
1430 | + foreach ($donors as $donor) { |
|
1431 | 1431 | $user_id = $donor->user_id; |
1432 | 1432 | |
1433 | 1433 | // Proceed, if donor is attached with user. |
1434 | - if ( $user_id ) { |
|
1435 | - $user = get_userdata( $user_id ); |
|
1434 | + if ($user_id) { |
|
1435 | + $user = get_userdata($user_id); |
|
1436 | 1436 | |
1437 | 1437 | // Update user role, if user has subscriber role. |
1438 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1438 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1439 | 1439 | wp_update_user( |
1440 | 1440 | array( |
1441 | 1441 | 'ID' => $user_id, |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | } |
1448 | 1448 | } else { |
1449 | 1449 | // The Update Ran. |
1450 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1450 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1451 | 1451 | } |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | */ |
1460 | 1460 | function give_v1813_upgrades() { |
1461 | 1461 | // Update admin setting. |
1462 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1462 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1463 | 1463 | |
1464 | 1464 | // Update Give roles. |
1465 | 1465 | $roles = new Give_Roles(); |
@@ -1477,33 +1477,33 @@ discard block |
||
1477 | 1477 | $give_updates = Give_Updates::get_instance(); |
1478 | 1478 | |
1479 | 1479 | // form query. |
1480 | - $payments = new WP_Query( array( |
|
1480 | + $payments = new WP_Query(array( |
|
1481 | 1481 | 'paged' => $give_updates->step, |
1482 | 1482 | 'status' => 'any', |
1483 | 1483 | 'order' => 'ASC', |
1484 | - 'post_type' => array( 'give_payment' ), |
|
1484 | + 'post_type' => array('give_payment'), |
|
1485 | 1485 | 'posts_per_page' => 100, |
1486 | 1486 | ) |
1487 | 1487 | ); |
1488 | 1488 | |
1489 | - if ( $payments->have_posts() ) { |
|
1490 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) ); |
|
1489 | + if ($payments->have_posts()) { |
|
1490 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100)); |
|
1491 | 1491 | |
1492 | - while ( $payments->have_posts() ) { |
|
1492 | + while ($payments->have_posts()) { |
|
1493 | 1493 | $payments->the_post(); |
1494 | 1494 | |
1495 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1495 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1496 | 1496 | |
1497 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1497 | + if ('RIAL' === $payment_meta['currency']) { |
|
1498 | 1498 | $payment_meta['currency'] = 'IRR'; |
1499 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1499 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1500 | 1500 | } |
1501 | 1501 | |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | } else { |
1505 | 1505 | // The Update Ran. |
1506 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1506 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1516,9 +1516,9 @@ discard block |
||
1516 | 1516 | function give_v1817_upgrades() { |
1517 | 1517 | $give_settings = give_get_settings(); |
1518 | 1518 | |
1519 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1519 | + if ('RIAL' === $give_settings['currency']) { |
|
1520 | 1520 | $give_settings['currency'] = 'IRR'; |
1521 | - update_option( 'give_settings', $give_settings, false ); |
|
1521 | + update_option('give_settings', $give_settings, false); |
|
1522 | 1522 | } |
1523 | 1523 | } |
1524 | 1524 | |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | |
1532 | 1532 | global $wp_roles; |
1533 | 1533 | |
1534 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1534 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1535 | 1535 | return; |
1536 | 1536 | } |
1537 | 1537 | |
@@ -1555,15 +1555,15 @@ discard block |
||
1555 | 1555 | ), |
1556 | 1556 | ); |
1557 | 1557 | |
1558 | - foreach ( $add_caps as $role => $caps ) { |
|
1559 | - foreach ( $caps as $cap ) { |
|
1560 | - $wp_roles->add_cap( $role, $cap ); |
|
1558 | + foreach ($add_caps as $role => $caps) { |
|
1559 | + foreach ($caps as $cap) { |
|
1560 | + $wp_roles->add_cap($role, $cap); |
|
1561 | 1561 | } |
1562 | 1562 | } |
1563 | 1563 | |
1564 | - foreach ( $remove_caps as $role => $caps ) { |
|
1565 | - foreach ( $caps as $cap ) { |
|
1566 | - $wp_roles->remove_cap( $role, $cap ); |
|
1564 | + foreach ($remove_caps as $role => $caps) { |
|
1565 | + foreach ($caps as $cap) { |
|
1566 | + $wp_roles->remove_cap($role, $cap); |
|
1567 | 1567 | } |
1568 | 1568 | } |
1569 | 1569 | |
@@ -1587,7 +1587,7 @@ discard block |
||
1587 | 1587 | $roles->add_roles(); |
1588 | 1588 | $roles->add_caps(); |
1589 | 1589 | |
1590 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1590 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | /** |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | function give_v1818_upgrades() { |
1599 | 1599 | |
1600 | 1600 | // Remove email_access_installed from give_settings. |
1601 | - give_delete_option( 'email_access_installed' ); |
|
1601 | + give_delete_option('email_access_installed'); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | /** |
@@ -1611,23 +1611,23 @@ discard block |
||
1611 | 1611 | /* @var Give_Updates $give_updates */ |
1612 | 1612 | $give_updates = Give_Updates::get_instance(); |
1613 | 1613 | |
1614 | - $donations = new WP_Query( array( |
|
1614 | + $donations = new WP_Query(array( |
|
1615 | 1615 | 'paged' => $give_updates->step, |
1616 | 1616 | 'status' => 'any', |
1617 | 1617 | 'order' => 'ASC', |
1618 | - 'post_type' => array( 'give_payment' ), |
|
1618 | + 'post_type' => array('give_payment'), |
|
1619 | 1619 | 'posts_per_page' => 100, |
1620 | 1620 | ) |
1621 | 1621 | ); |
1622 | 1622 | |
1623 | - if ( $donations->have_posts() ) { |
|
1624 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 ); |
|
1623 | + if ($donations->have_posts()) { |
|
1624 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 100); |
|
1625 | 1625 | |
1626 | - while ( $donations->have_posts() ) { |
|
1626 | + while ($donations->have_posts()) { |
|
1627 | 1627 | $donations->the_post(); |
1628 | 1628 | |
1629 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1630 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1629 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1630 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1631 | 1631 | |
1632 | 1632 | // Update Donation meta with price_id set as custom, only if it is: |
1633 | 1633 | // 1. Donation Type = Set Donation. |
@@ -1636,19 +1636,19 @@ discard block |
||
1636 | 1636 | if ( |
1637 | 1637 | $form->ID && |
1638 | 1638 | $form->is_set_type_donation_form() && |
1639 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1640 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1639 | + ('custom' !== $donation_meta['price_id']) && |
|
1640 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1641 | 1641 | ) { |
1642 | 1642 | $donation_meta['price_id'] = 'custom'; |
1643 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1644 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1643 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1644 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1645 | 1645 | } |
1646 | 1646 | } |
1647 | 1647 | |
1648 | 1648 | wp_reset_postdata(); |
1649 | 1649 | } else { |
1650 | 1650 | // Update Ran Successfully. |
1651 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1651 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | |
1667 | 1667 | global $wp_roles; |
1668 | 1668 | |
1669 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1669 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1670 | 1670 | return; |
1671 | 1671 | } |
1672 | 1672 | |
@@ -1684,9 +1684,9 @@ discard block |
||
1684 | 1684 | ), |
1685 | 1685 | ); |
1686 | 1686 | |
1687 | - foreach ( $remove_caps as $role => $caps ) { |
|
1688 | - foreach ( $caps as $cap ) { |
|
1689 | - $wp_roles->remove_cap( $role, $cap ); |
|
1687 | + foreach ($remove_caps as $role => $caps) { |
|
1688 | + foreach ($caps as $cap) { |
|
1689 | + $wp_roles->remove_cap($role, $cap); |
|
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | $roles->add_roles(); |
1698 | 1698 | $roles->add_caps(); |
1699 | 1699 | |
1700 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1700 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | /** |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $give_updates = Give_Updates::get_instance(); |
1712 | 1712 | |
1713 | 1713 | // form query |
1714 | - $forms = new WP_Query( array( |
|
1714 | + $forms = new WP_Query(array( |
|
1715 | 1715 | 'paged' => $give_updates->step, |
1716 | 1716 | 'status' => 'any', |
1717 | 1717 | 'order' => 'ASC', |
@@ -1720,22 +1720,22 @@ discard block |
||
1720 | 1720 | ) |
1721 | 1721 | ); |
1722 | 1722 | |
1723 | - if ( $forms->have_posts() ) { |
|
1724 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1723 | + if ($forms->have_posts()) { |
|
1724 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1725 | 1725 | |
1726 | - while ( $forms->have_posts() ) { |
|
1726 | + while ($forms->have_posts()) { |
|
1727 | 1727 | $forms->the_post(); |
1728 | 1728 | global $post; |
1729 | 1729 | |
1730 | 1730 | // Update offline instruction email notification status. |
1731 | - $offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
1732 | - $offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array( |
|
1731 | + $offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
1732 | + $offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array( |
|
1733 | 1733 | 'enabled', |
1734 | 1734 | 'global', |
1735 | - ) ) |
|
1735 | + )) |
|
1736 | 1736 | ? $offline_instruction_notification_status |
1737 | 1737 | : 'global'; |
1738 | - update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status ); |
|
1738 | + update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status); |
|
1739 | 1739 | |
1740 | 1740 | // Update offline instruction email message. |
1741 | 1741 | update_post_meta( |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | wp_reset_postdata(); |
1768 | 1768 | } else { |
1769 | 1769 | // No more forms found, finish up. |
1770 | - give_set_upgrade_complete( 'v20_upgrades_form_metadata' ); |
|
1770 | + give_set_upgrade_complete('v20_upgrades_form_metadata'); |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1784,7 +1784,7 @@ discard block |
||
1784 | 1784 | $give_updates = Give_Updates::get_instance(); |
1785 | 1785 | |
1786 | 1786 | // form query |
1787 | - $forms = new WP_Query( array( |
|
1787 | + $forms = new WP_Query(array( |
|
1788 | 1788 | 'paged' => $give_updates->step, |
1789 | 1789 | 'status' => 'any', |
1790 | 1790 | 'order' => 'ASC', |
@@ -1793,19 +1793,19 @@ discard block |
||
1793 | 1793 | ) |
1794 | 1794 | ); |
1795 | 1795 | |
1796 | - if ( $forms->have_posts() ) { |
|
1797 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1796 | + if ($forms->have_posts()) { |
|
1797 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1798 | 1798 | |
1799 | - while ( $forms->have_posts() ) { |
|
1799 | + while ($forms->have_posts()) { |
|
1800 | 1800 | $forms->the_post(); |
1801 | 1801 | global $post; |
1802 | 1802 | |
1803 | 1803 | // Split _give_payment_meta meta. |
1804 | 1804 | // @todo Remove _give_payment_meta after releases 2.0 |
1805 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
1805 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
1806 | 1806 | |
1807 | - if ( ! empty( $payment_meta ) ) { |
|
1808 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
1807 | + if ( ! empty($payment_meta)) { |
|
1808 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | $deprecated_meta_keys = array( |
@@ -1814,9 +1814,9 @@ discard block |
||
1814 | 1814 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
1815 | 1815 | ); |
1816 | 1816 | |
1817 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
1817 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
1818 | 1818 | // Do not add new meta key if already exist. |
1819 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
1819 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
1820 | 1820 | continue; |
1821 | 1821 | } |
1822 | 1822 | |
@@ -1825,25 +1825,25 @@ discard block |
||
1825 | 1825 | array( |
1826 | 1826 | 'post_id' => $post->ID, |
1827 | 1827 | 'meta_key' => $new_meta_key, |
1828 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
1828 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
1829 | 1829 | ) |
1830 | 1830 | ); |
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | // Bailout |
1834 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
1834 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
1835 | 1835 | /* @var Give_Donor $donor */ |
1836 | - $donor = new Give_Donor( $donor_id ); |
|
1836 | + $donor = new Give_Donor($donor_id); |
|
1837 | 1837 | |
1838 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
1839 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
1840 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
1841 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
1842 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
1843 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
1838 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
1839 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
1840 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
1841 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
1842 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
1843 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
1844 | 1844 | |
1845 | 1845 | // Save address. |
1846 | - $donor->add_address( 'billing[]', $address ); |
|
1846 | + $donor->add_address('billing[]', $address); |
|
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | }// End while(). |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
1855 | 1855 | |
1856 | 1856 | // No more forms found, finish up. |
1857 | - give_set_upgrade_complete( 'v20_upgrades_payment_metadata' ); |
|
1857 | + give_set_upgrade_complete('v20_upgrades_payment_metadata'); |
|
1858 | 1858 | } |
1859 | 1859 | } |
1860 | 1860 | |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | $give_updates = Give_Updates::get_instance(); |
1871 | 1871 | |
1872 | 1872 | // form query |
1873 | - $forms = new WP_Query( array( |
|
1873 | + $forms = new WP_Query(array( |
|
1874 | 1874 | 'paged' => $give_updates->step, |
1875 | 1875 | 'order' => 'DESC', |
1876 | 1876 | 'post_type' => 'give_log', |
@@ -1879,20 +1879,20 @@ discard block |
||
1879 | 1879 | ) |
1880 | 1880 | ); |
1881 | 1881 | |
1882 | - if ( $forms->have_posts() ) { |
|
1883 | - $give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 ); |
|
1882 | + if ($forms->have_posts()) { |
|
1883 | + $give_updates->set_percentage($forms->found_posts, $give_updates->step * 100); |
|
1884 | 1884 | |
1885 | - while ( $forms->have_posts() ) { |
|
1885 | + while ($forms->have_posts()) { |
|
1886 | 1886 | $forms->the_post(); |
1887 | 1887 | global $post; |
1888 | 1888 | |
1889 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
1889 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
1890 | 1890 | continue; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
1894 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
1895 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
1893 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
1894 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
1895 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
1896 | 1896 | |
1897 | 1897 | $log_data = array( |
1898 | 1898 | 'ID' => $post->ID, |
@@ -1905,29 +1905,29 @@ discard block |
||
1905 | 1905 | ); |
1906 | 1906 | $log_meta = array(); |
1907 | 1907 | |
1908 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
1909 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
1910 | - switch ( $meta_key ) { |
|
1908 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
1909 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
1910 | + switch ($meta_key) { |
|
1911 | 1911 | case '_give_log_payment_id': |
1912 | - $log_data['log_parent'] = current( $meta_value ); |
|
1912 | + $log_data['log_parent'] = current($meta_value); |
|
1913 | 1913 | $log_meta['_give_log_form_id'] = $post->post_parent; |
1914 | 1914 | break; |
1915 | 1915 | |
1916 | 1916 | default: |
1917 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
1917 | + $log_meta[$meta_key] = current($meta_value); |
|
1918 | 1918 | } |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - if ( 'api_request' === $term_name ) { |
|
1922 | + if ('api_request' === $term_name) { |
|
1923 | 1923 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
1926 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
1927 | 1927 | |
1928 | - if ( ! empty( $log_meta ) ) { |
|
1929 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
1930 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
1928 | + if ( ! empty($log_meta)) { |
|
1929 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
1930 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
1931 | 1931 | } |
1932 | 1932 | } |
1933 | 1933 | |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | Give()->logs->delete_cache(); |
1970 | 1970 | |
1971 | 1971 | // No more forms found, finish up. |
1972 | - give_set_upgrade_complete( 'v20_logs_upgrades' ); |
|
1972 | + give_set_upgrade_complete('v20_logs_upgrades'); |
|
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | |
@@ -1985,19 +1985,19 @@ discard block |
||
1985 | 1985 | $give_updates = Give_Updates::get_instance(); |
1986 | 1986 | |
1987 | 1987 | // form query |
1988 | - $payments = new WP_Query( array( |
|
1988 | + $payments = new WP_Query(array( |
|
1989 | 1989 | 'paged' => $give_updates->step, |
1990 | 1990 | 'status' => 'any', |
1991 | 1991 | 'order' => 'ASC', |
1992 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1992 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1993 | 1993 | 'posts_per_page' => 100, |
1994 | 1994 | ) |
1995 | 1995 | ); |
1996 | 1996 | |
1997 | - if ( $payments->have_posts() ) { |
|
1998 | - $give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 ); |
|
1997 | + if ($payments->have_posts()) { |
|
1998 | + $give_updates->set_percentage($payments->found_posts, $give_updates->step * 100); |
|
1999 | 1999 | |
2000 | - while ( $payments->have_posts() ) { |
|
2000 | + while ($payments->have_posts()) { |
|
2001 | 2001 | $payments->the_post(); |
2002 | 2002 | global $post; |
2003 | 2003 | |
@@ -2009,19 +2009,19 @@ discard block |
||
2009 | 2009 | ARRAY_A |
2010 | 2010 | ); |
2011 | 2011 | |
2012 | - if ( ! empty( $meta_data ) ) { |
|
2013 | - foreach ( $meta_data as $index => $data ) { |
|
2012 | + if ( ! empty($meta_data)) { |
|
2013 | + foreach ($meta_data as $index => $data) { |
|
2014 | 2014 | // Check for duplicate meta values. |
2015 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2015 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2016 | 2016 | continue; |
2017 | 2017 | } |
2018 | 2018 | |
2019 | - switch ( $post->post_type ) { |
|
2019 | + switch ($post->post_type) { |
|
2020 | 2020 | case 'give_forms': |
2021 | 2021 | $data['form_id'] = $data['post_id']; |
2022 | - unset( $data['post_id'] ); |
|
2022 | + unset($data['post_id']); |
|
2023 | 2023 | |
2024 | - Give()->form_meta->insert( $data ); |
|
2024 | + Give()->form_meta->insert($data); |
|
2025 | 2025 | // @todo: delete form meta from post meta table after releases 2.0. |
2026 | 2026 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2027 | 2027 | |
@@ -2029,9 +2029,9 @@ discard block |
||
2029 | 2029 | |
2030 | 2030 | case 'give_payment': |
2031 | 2031 | $data['payment_id'] = $data['post_id']; |
2032 | - unset( $data['post_id'] ); |
|
2032 | + unset($data['post_id']); |
|
2033 | 2033 | |
2034 | - Give()->payment_meta->insert( $data ); |
|
2034 | + Give()->payment_meta->insert($data); |
|
2035 | 2035 | |
2036 | 2036 | // @todo: delete donation meta from post meta table after releases 2.0. |
2037 | 2037 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2046,7 +2046,7 @@ discard block |
||
2046 | 2046 | wp_reset_postdata(); |
2047 | 2047 | } else { |
2048 | 2048 | // No more forms found, finish up. |
2049 | - give_set_upgrade_complete( 'v20_move_metadata_into_new_table' ); |
|
2049 | + give_set_upgrade_complete('v20_move_metadata_into_new_table'); |
|
2050 | 2050 | } |
2051 | 2051 | |
2052 | 2052 | } |
@@ -2062,44 +2062,44 @@ discard block |
||
2062 | 2062 | /* @var Give_Updates $give_updates */ |
2063 | 2063 | $give_updates = Give_Updates::get_instance(); |
2064 | 2064 | |
2065 | - $donors = Give()->donors->get_donors( array( |
|
2065 | + $donors = Give()->donors->get_donors(array( |
|
2066 | 2066 | 'paged' => $give_updates->step, |
2067 | 2067 | 'number' => 100, |
2068 | - ) ); |
|
2068 | + )); |
|
2069 | 2069 | |
2070 | - if ( $donors ) { |
|
2071 | - $give_updates->set_percentage( count( $donors ), $give_updates->step * 100 ); |
|
2070 | + if ($donors) { |
|
2071 | + $give_updates->set_percentage(count($donors), $give_updates->step * 100); |
|
2072 | 2072 | // Loop through Donors |
2073 | - foreach ( $donors as $donor ) { |
|
2073 | + foreach ($donors as $donor) { |
|
2074 | 2074 | |
2075 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2076 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2077 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2075 | + $donor_name = explode(' ', $donor->name, 2); |
|
2076 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2077 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2078 | 2078 | |
2079 | 2079 | // If first name meta of donor is not created, then create it. |
2080 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2081 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2080 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2081 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2082 | 2082 | } |
2083 | 2083 | |
2084 | 2084 | // If last name meta of donor is not created, then create it. |
2085 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2086 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2085 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2086 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2087 | 2087 | } |
2088 | 2088 | |
2089 | 2089 | // If Donor is connected with WP User then update user meta. |
2090 | - if ( $donor->user_id ) { |
|
2091 | - if ( isset( $donor_name[0] ) ) { |
|
2092 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2090 | + if ($donor->user_id) { |
|
2091 | + if (isset($donor_name[0])) { |
|
2092 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2093 | 2093 | } |
2094 | - if ( isset( $donor_name[1] ) ) { |
|
2095 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2094 | + if (isset($donor_name[1])) { |
|
2095 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2096 | 2096 | } |
2097 | 2097 | } |
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | } else { |
2101 | 2101 | // The Update Ran. |
2102 | - give_set_upgrade_complete( 'v20_upgrades_donor_name' ); |
|
2102 | + give_set_upgrade_complete('v20_upgrades_donor_name'); |
|
2103 | 2103 | } |
2104 | 2104 | |
2105 | 2105 | } |
@@ -2128,15 +2128,15 @@ discard block |
||
2128 | 2128 | |
2129 | 2129 | $users = $user_query->get_results(); |
2130 | 2130 | |
2131 | - if ( $users ) { |
|
2132 | - $give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 ); |
|
2131 | + if ($users) { |
|
2132 | + $give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100); |
|
2133 | 2133 | |
2134 | 2134 | // Loop through Donors |
2135 | - foreach ( $users as $user ) { |
|
2135 | + foreach ($users as $user) { |
|
2136 | 2136 | /* @var Give_Donor $donor */ |
2137 | - $donor = new Give_Donor( $user->ID, true ); |
|
2137 | + $donor = new Give_Donor($user->ID, true); |
|
2138 | 2138 | |
2139 | - if ( ! $donor->id ) { |
|
2139 | + if ( ! $donor->id) { |
|
2140 | 2140 | continue; |
2141 | 2141 | } |
2142 | 2142 | |
@@ -2152,10 +2152,10 @@ discard block |
||
2152 | 2152 | ) |
2153 | 2153 | ); |
2154 | 2154 | |
2155 | - if ( ! empty( $address ) ) { |
|
2156 | - $address = maybe_unserialize( $address ); |
|
2157 | - $donor->add_address( 'personal', $address ); |
|
2158 | - $donor->add_address( 'billing[]', $address ); |
|
2155 | + if ( ! empty($address)) { |
|
2156 | + $address = maybe_unserialize($address); |
|
2157 | + $donor->add_address('personal', $address); |
|
2158 | + $donor->add_address('billing[]', $address); |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | // @todo: delete _give_user_address from user meta after releases 2.0. |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | |
2166 | 2166 | } else { |
2167 | 2167 | // The Update Ran. |
2168 | - give_set_upgrade_complete( 'v20_upgrades_user_address' ); |
|
2168 | + give_set_upgrade_complete('v20_upgrades_user_address'); |
|
2169 | 2169 | } |
2170 | 2170 | |
2171 | 2171 | } |
@@ -2189,15 +2189,15 @@ discard block |
||
2189 | 2189 | ); |
2190 | 2190 | |
2191 | 2191 | // Alter customer table |
2192 | - foreach ( $tables as $old_table => $new_table ) { |
|
2192 | + foreach ($tables as $old_table => $new_table) { |
|
2193 | 2193 | if ( |
2194 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) && |
|
2195 | - ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) ) |
|
2194 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) && |
|
2195 | + ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table)) |
|
2196 | 2196 | ) { |
2197 | - $wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" ); |
|
2197 | + $wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}"); |
|
2198 | 2198 | |
2199 | - if ( "{$wpdb->prefix}give_donormeta" === $new_table ) { |
|
2200 | - $wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" ); |
|
2199 | + if ("{$wpdb->prefix}give_donormeta" === $new_table) { |
|
2200 | + $wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)"); |
|
2201 | 2201 | } |
2202 | 2202 | } |
2203 | 2203 | } |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | $give_updates->percentage = 100; |
2206 | 2206 | |
2207 | 2207 | // No more forms found, finish up. |
2208 | - give_set_upgrade_complete( 'v20_rename_donor_tables' ); |
|
2208 | + give_set_upgrade_complete('v20_rename_donor_tables'); |
|
2209 | 2209 | |
2210 | 2210 | // Re initiate donor classes. |
2211 | 2211 | Give()->donors = new Give_DB_Donors(); |
@@ -2223,19 +2223,19 @@ discard block |
||
2223 | 2223 | function give_v201_create_tables() { |
2224 | 2224 | global $wpdb; |
2225 | 2225 | |
2226 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) { |
|
2226 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) { |
|
2227 | 2227 | Give()->payment_meta->create_table(); |
2228 | 2228 | } |
2229 | 2229 | |
2230 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) { |
|
2230 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) { |
|
2231 | 2231 | Give()->form_meta->create_table(); |
2232 | 2232 | } |
2233 | 2233 | |
2234 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) { |
|
2234 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) { |
|
2235 | 2235 | Give()->logs->log_db->create_table(); |
2236 | 2236 | } |
2237 | 2237 | |
2238 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) { |
|
2238 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) { |
|
2239 | 2239 | Give()->logs->logmeta_db->create_table(); |
2240 | 2240 | } |
2241 | 2241 | } |
@@ -2260,31 +2260,31 @@ discard block |
||
2260 | 2260 | $wpdb->posts.post_date >= '2018-01-08 00:00:00' |
2261 | 2261 | ) |
2262 | 2262 | AND $wpdb->posts.post_type = 'give_payment' |
2263 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2263 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2264 | 2264 | ORDER BY $wpdb->posts.post_date ASC |
2265 | 2265 | LIMIT 100 |
2266 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2266 | + OFFSET ".$give_updates->get_offset(100) |
|
2267 | 2267 | ); |
2268 | 2268 | |
2269 | - if ( ! empty( $payments ) ) { |
|
2270 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) ); |
|
2269 | + if ( ! empty($payments)) { |
|
2270 | + $give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100)); |
|
2271 | 2271 | |
2272 | - foreach ( $payments as $payment_id ) { |
|
2273 | - $post = get_post( $payment_id ); |
|
2274 | - setup_postdata( $post ); |
|
2272 | + foreach ($payments as $payment_id) { |
|
2273 | + $post = get_post($payment_id); |
|
2274 | + setup_postdata($post); |
|
2275 | 2275 | |
2276 | 2276 | // Do not add new meta keys if already refactored. |
2277 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) { |
|
2277 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) { |
|
2278 | 2278 | continue; |
2279 | 2279 | } |
2280 | 2280 | |
2281 | 2281 | |
2282 | 2282 | // Split _give_payment_meta meta. |
2283 | 2283 | // @todo Remove _give_payment_meta after releases 2.0 |
2284 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
2284 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
2285 | 2285 | |
2286 | - if ( ! empty( $payment_meta ) ) { |
|
2287 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
2286 | + if ( ! empty($payment_meta)) { |
|
2287 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
2288 | 2288 | } |
2289 | 2289 | |
2290 | 2290 | $deprecated_meta_keys = array( |
@@ -2293,9 +2293,9 @@ discard block |
||
2293 | 2293 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
2294 | 2294 | ); |
2295 | 2295 | |
2296 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
2296 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
2297 | 2297 | // Do not add new meta key if already exist. |
2298 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
2298 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
2299 | 2299 | continue; |
2300 | 2300 | } |
2301 | 2301 | |
@@ -2304,25 +2304,25 @@ discard block |
||
2304 | 2304 | array( |
2305 | 2305 | 'post_id' => $post->ID, |
2306 | 2306 | 'meta_key' => $new_meta_key, |
2307 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
2307 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
2308 | 2308 | ) |
2309 | 2309 | ); |
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | // Bailout |
2313 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
2313 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
2314 | 2314 | /* @var Give_Donor $donor */ |
2315 | - $donor = new Give_Donor( $donor_id ); |
|
2315 | + $donor = new Give_Donor($donor_id); |
|
2316 | 2316 | |
2317 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
2318 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
2319 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
2320 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
2321 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
2322 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
2317 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
2318 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
2319 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
2320 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
2321 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
2322 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
2323 | 2323 | |
2324 | 2324 | // Save address. |
2325 | - $donor->add_address( 'billing[]', $address ); |
|
2325 | + $donor->add_address('billing[]', $address); |
|
2326 | 2326 | } |
2327 | 2327 | |
2328 | 2328 | }// End while(). |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
2334 | 2334 | |
2335 | 2335 | // No more forms found, finish up. |
2336 | - give_set_upgrade_complete( 'v201_upgrades_payment_metadata' ); |
|
2336 | + give_set_upgrade_complete('v201_upgrades_payment_metadata'); |
|
2337 | 2337 | } |
2338 | 2338 | } |
2339 | 2339 | |
@@ -2353,21 +2353,21 @@ discard block |
||
2353 | 2353 | SELECT ID FROM $wpdb->posts |
2354 | 2354 | WHERE 1=1 |
2355 | 2355 | AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' ) |
2356 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2356 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2357 | 2357 | ORDER BY $wpdb->posts.post_date ASC |
2358 | 2358 | LIMIT 100 |
2359 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2359 | + OFFSET ".$give_updates->get_offset(100) |
|
2360 | 2360 | ); |
2361 | 2361 | |
2362 | - if ( ! empty( $payments ) ) { |
|
2363 | - $give_updates->set_percentage( give_get_total_post_type_count( array( |
|
2362 | + if ( ! empty($payments)) { |
|
2363 | + $give_updates->set_percentage(give_get_total_post_type_count(array( |
|
2364 | 2364 | 'give_forms', |
2365 | 2365 | 'give_payment', |
2366 | - ) ), $give_updates->step * 100 ); |
|
2366 | + )), $give_updates->step * 100); |
|
2367 | 2367 | |
2368 | - foreach ( $payments as $payment_id ) { |
|
2369 | - $post = get_post( $payment_id ); |
|
2370 | - setup_postdata( $post ); |
|
2368 | + foreach ($payments as $payment_id) { |
|
2369 | + $post = get_post($payment_id); |
|
2370 | + setup_postdata($post); |
|
2371 | 2371 | |
2372 | 2372 | $meta_data = $wpdb->get_results( |
2373 | 2373 | $wpdb->prepare( |
@@ -2377,19 +2377,19 @@ discard block |
||
2377 | 2377 | ARRAY_A |
2378 | 2378 | ); |
2379 | 2379 | |
2380 | - if ( ! empty( $meta_data ) ) { |
|
2381 | - foreach ( $meta_data as $index => $data ) { |
|
2380 | + if ( ! empty($meta_data)) { |
|
2381 | + foreach ($meta_data as $index => $data) { |
|
2382 | 2382 | // Check for duplicate meta values. |
2383 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2383 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2384 | 2384 | continue; |
2385 | 2385 | } |
2386 | 2386 | |
2387 | - switch ( $post->post_type ) { |
|
2387 | + switch ($post->post_type) { |
|
2388 | 2388 | case 'give_forms': |
2389 | 2389 | $data['form_id'] = $data['post_id']; |
2390 | - unset( $data['post_id'] ); |
|
2390 | + unset($data['post_id']); |
|
2391 | 2391 | |
2392 | - Give()->form_meta->insert( $data ); |
|
2392 | + Give()->form_meta->insert($data); |
|
2393 | 2393 | // @todo: delete form meta from post meta table after releases 2.0. |
2394 | 2394 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2395 | 2395 | |
@@ -2397,9 +2397,9 @@ discard block |
||
2397 | 2397 | |
2398 | 2398 | case 'give_payment': |
2399 | 2399 | $data['payment_id'] = $data['post_id']; |
2400 | - unset( $data['post_id'] ); |
|
2400 | + unset($data['post_id']); |
|
2401 | 2401 | |
2402 | - Give()->payment_meta->insert( $data ); |
|
2402 | + Give()->payment_meta->insert($data); |
|
2403 | 2403 | |
2404 | 2404 | // @todo: delete donation meta from post meta table after releases 2.0. |
2405 | 2405 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2414,7 +2414,7 @@ discard block |
||
2414 | 2414 | wp_reset_postdata(); |
2415 | 2415 | } else { |
2416 | 2416 | // No more forms found, finish up. |
2417 | - give_set_upgrade_complete( 'v201_move_metadata_into_new_table' ); |
|
2417 | + give_set_upgrade_complete('v201_move_metadata_into_new_table'); |
|
2418 | 2418 | } |
2419 | 2419 | |
2420 | 2420 | } |
@@ -2435,26 +2435,26 @@ discard block |
||
2435 | 2435 | SELECT ID FROM $wpdb->posts |
2436 | 2436 | WHERE 1=1 |
2437 | 2437 | AND $wpdb->posts.post_type = 'give_log' |
2438 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2438 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2439 | 2439 | ORDER BY $wpdb->posts.post_date ASC |
2440 | 2440 | LIMIT 100 |
2441 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2441 | + OFFSET ".$give_updates->get_offset(100) |
|
2442 | 2442 | ); |
2443 | 2443 | |
2444 | - if ( ! empty( $logs ) ) { |
|
2445 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 ); |
|
2444 | + if ( ! empty($logs)) { |
|
2445 | + $give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100); |
|
2446 | 2446 | |
2447 | - foreach ( $logs as $log_id ) { |
|
2448 | - $post = get_post( $log_id ); |
|
2449 | - setup_postdata( $post ); |
|
2447 | + foreach ($logs as $log_id) { |
|
2448 | + $post = get_post($log_id); |
|
2449 | + setup_postdata($post); |
|
2450 | 2450 | |
2451 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
2451 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
2452 | 2452 | continue; |
2453 | 2453 | } |
2454 | 2454 | |
2455 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
2456 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
2457 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
2455 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
2456 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
2457 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
2458 | 2458 | |
2459 | 2459 | $log_data = array( |
2460 | 2460 | 'ID' => $post->ID, |
@@ -2467,29 +2467,29 @@ discard block |
||
2467 | 2467 | ); |
2468 | 2468 | $log_meta = array(); |
2469 | 2469 | |
2470 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
2471 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
2472 | - switch ( $meta_key ) { |
|
2470 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
2471 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
2472 | + switch ($meta_key) { |
|
2473 | 2473 | case '_give_log_payment_id': |
2474 | - $log_data['log_parent'] = current( $meta_value ); |
|
2474 | + $log_data['log_parent'] = current($meta_value); |
|
2475 | 2475 | $log_meta['_give_log_form_id'] = $post->post_parent; |
2476 | 2476 | break; |
2477 | 2477 | |
2478 | 2478 | default: |
2479 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
2479 | + $log_meta[$meta_key] = current($meta_value); |
|
2480 | 2480 | } |
2481 | 2481 | } |
2482 | 2482 | } |
2483 | 2483 | |
2484 | - if ( 'api_request' === $term_name ) { |
|
2484 | + if ('api_request' === $term_name) { |
|
2485 | 2485 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
2486 | 2486 | } |
2487 | 2487 | |
2488 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
2488 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
2489 | 2489 | |
2490 | - if ( ! empty( $log_meta ) ) { |
|
2491 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
2492 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
2490 | + if ( ! empty($log_meta)) { |
|
2491 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
2492 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
2493 | 2493 | } |
2494 | 2494 | } |
2495 | 2495 | |
@@ -2502,7 +2502,7 @@ discard block |
||
2502 | 2502 | Give()->logs->delete_cache(); |
2503 | 2503 | |
2504 | 2504 | // No more forms found, finish up. |
2505 | - give_set_upgrade_complete( 'v201_logs_upgrades' ); |
|
2505 | + give_set_upgrade_complete('v201_logs_upgrades'); |
|
2506 | 2506 | } |
2507 | 2507 | } |
2508 | 2508 | |
@@ -2517,51 +2517,51 @@ discard block |
||
2517 | 2517 | global $wpdb; |
2518 | 2518 | give_v201_create_tables(); |
2519 | 2519 | |
2520 | - if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) { |
|
2521 | - $customers = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' ); |
|
2522 | - $donors = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' ); |
|
2520 | + if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) { |
|
2521 | + $customers = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id'); |
|
2522 | + $donors = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id'); |
|
2523 | 2523 | $donor_data = array(); |
2524 | 2524 | |
2525 | - if ( $missing_donors = array_diff( $customers, $donors ) ) { |
|
2526 | - foreach ( $missing_donors as $donor_id ) { |
|
2525 | + if ($missing_donors = array_diff($customers, $donors)) { |
|
2526 | + foreach ($missing_donors as $donor_id) { |
|
2527 | 2527 | $donor_data[] = array( |
2528 | - 'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ), |
|
2529 | - 'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ), |
|
2528 | + 'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)), |
|
2529 | + 'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)), |
|
2530 | 2530 | |
2531 | 2531 | ); |
2532 | 2532 | } |
2533 | 2533 | } |
2534 | 2534 | |
2535 | - if ( ! empty( $donor_data ) ) { |
|
2535 | + if ( ! empty($donor_data)) { |
|
2536 | 2536 | $donor_table_name = Give()->donors->table_name; |
2537 | 2537 | $donor_meta_table_name = Give()->donor_meta->table_name; |
2538 | 2538 | |
2539 | 2539 | Give()->donors->table_name = "{$wpdb->prefix}give_donors"; |
2540 | 2540 | Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta"; |
2541 | 2541 | |
2542 | - foreach ( $donor_data as $donor ) { |
|
2542 | + foreach ($donor_data as $donor) { |
|
2543 | 2543 | $donor['info'][0] = (array) $donor['info'][0]; |
2544 | 2544 | |
2545 | 2545 | // Prevent duplicate meta id issue. |
2546 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) { |
|
2546 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) { |
|
2547 | 2547 | continue; |
2548 | 2548 | } |
2549 | 2549 | |
2550 | - $donor_id = Give()->donors->add( $donor['info'][0] ); |
|
2550 | + $donor_id = Give()->donors->add($donor['info'][0]); |
|
2551 | 2551 | |
2552 | - if ( ! empty( $donor['meta'] ) ) { |
|
2553 | - foreach ( $donor['meta'] as $donor_meta ) { |
|
2552 | + if ( ! empty($donor['meta'])) { |
|
2553 | + foreach ($donor['meta'] as $donor_meta) { |
|
2554 | 2554 | $donor_meta = (array) $donor_meta; |
2555 | 2555 | |
2556 | 2556 | // Prevent duplicate meta id issue. |
2557 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) { |
|
2558 | - unset( $donor_meta['meta_id'] ); |
|
2557 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) { |
|
2558 | + unset($donor_meta['meta_id']); |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | $donor_meta['donor_id'] = $donor_meta['customer_id']; |
2562 | - unset( $donor_meta['customer_id'] ); |
|
2562 | + unset($donor_meta['customer_id']); |
|
2563 | 2563 | |
2564 | - Give()->donor_meta->insert( $donor_meta ); |
|
2564 | + Give()->donor_meta->insert($donor_meta); |
|
2565 | 2565 | } |
2566 | 2566 | } |
2567 | 2567 | |
@@ -2580,35 +2580,35 @@ discard block |
||
2580 | 2580 | ) |
2581 | 2581 | ); |
2582 | 2582 | |
2583 | - $donor = new Give_Donor( $donor_id ); |
|
2583 | + $donor = new Give_Donor($donor_id); |
|
2584 | 2584 | |
2585 | - if ( ! empty( $address ) ) { |
|
2586 | - $address = maybe_unserialize( $address ); |
|
2587 | - $donor->add_address( 'personal', $address ); |
|
2588 | - $donor->add_address( 'billing[]', $address ); |
|
2585 | + if ( ! empty($address)) { |
|
2586 | + $address = maybe_unserialize($address); |
|
2587 | + $donor->add_address('personal', $address); |
|
2588 | + $donor->add_address('billing[]', $address); |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2592 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2593 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2591 | + $donor_name = explode(' ', $donor->name, 2); |
|
2592 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2593 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2594 | 2594 | |
2595 | 2595 | // If first name meta of donor is not created, then create it. |
2596 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2597 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2596 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2597 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2598 | 2598 | } |
2599 | 2599 | |
2600 | 2600 | // If last name meta of donor is not created, then create it. |
2601 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2602 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2601 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2602 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2603 | 2603 | } |
2604 | 2604 | |
2605 | 2605 | // If Donor is connected with WP User then update user meta. |
2606 | - if ( $donor->user_id ) { |
|
2607 | - if ( isset( $donor_name[0] ) ) { |
|
2608 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2606 | + if ($donor->user_id) { |
|
2607 | + if (isset($donor_name[0])) { |
|
2608 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2609 | 2609 | } |
2610 | - if ( isset( $donor_name[1] ) ) { |
|
2611 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2610 | + if (isset($donor_name[1])) { |
|
2611 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2612 | 2612 | } |
2613 | 2613 | } |
2614 | 2614 | } |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | } |
2620 | 2620 | |
2621 | 2621 | Give_Updates::get_instance()->percentage = 100; |
2622 | - give_set_upgrade_complete( 'v201_add_missing_donors' ); |
|
2622 | + give_set_upgrade_complete('v201_add_missing_donors'); |
|
2623 | 2623 | } |
2624 | 2624 | |
2625 | 2625 | |
@@ -2632,14 +2632,14 @@ discard block |
||
2632 | 2632 | global $wpdb; |
2633 | 2633 | |
2634 | 2634 | // Do not auto load option. |
2635 | - $wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) ); |
|
2635 | + $wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades')); |
|
2636 | 2636 | |
2637 | 2637 | // Remove from cache. |
2638 | 2638 | $all_options = wp_load_alloptions(); |
2639 | 2639 | |
2640 | - if ( isset( $all_options['give_completed_upgrades'] ) ) { |
|
2641 | - unset( $all_options['give_completed_upgrades'] ); |
|
2642 | - wp_cache_set( 'alloptions', $all_options, 'options' ); |
|
2640 | + if (isset($all_options['give_completed_upgrades'])) { |
|
2641 | + unset($all_options['give_completed_upgrades']); |
|
2642 | + wp_cache_set('alloptions', $all_options, 'options'); |
|
2643 | 2643 | } |
2644 | 2644 | |
2645 | 2645 | } |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | * |
2651 | 2651 | * @since 2.2.0 |
2652 | 2652 | */ |
2653 | -function give_v220_upgrades(){ |
|
2653 | +function give_v220_upgrades() { |
|
2654 | 2654 | global $wpdb; |
2655 | 2655 | |
2656 | 2656 | /** |
@@ -2703,11 +2703,11 @@ discard block |
||
2703 | 2703 | " |
2704 | 2704 | ); |
2705 | 2705 | |
2706 | - if( ! empty( $option_like ) ) { |
|
2707 | - $options = array_merge( $options, $option_like ); |
|
2706 | + if ( ! empty($option_like)) { |
|
2707 | + $options = array_merge($options, $option_like); |
|
2708 | 2708 | } |
2709 | 2709 | |
2710 | - $options_str = '\'' . implode( "','", $options ) . '\''; |
|
2710 | + $options_str = '\''.implode("','", $options).'\''; |
|
2711 | 2711 | |
2712 | 2712 | $wpdb->query( |
2713 | 2713 | " |
@@ -2731,7 +2731,7 @@ discard block |
||
2731 | 2731 | * |
2732 | 2732 | * Change column length |
2733 | 2733 | */ |
2734 | - $wpdb->query( "ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL" ); |
|
2734 | + $wpdb->query("ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL"); |
|
2735 | 2735 | } |
2736 | 2736 | |
2737 | 2737 | /** |
@@ -2744,7 +2744,7 @@ discard block |
||
2744 | 2744 | $give_updates = Give_Updates::get_instance(); |
2745 | 2745 | |
2746 | 2746 | // form query. |
2747 | - $donation_forms = new WP_Query( array( |
|
2747 | + $donation_forms = new WP_Query(array( |
|
2748 | 2748 | 'paged' => $give_updates->step, |
2749 | 2749 | 'status' => 'any', |
2750 | 2750 | 'order' => 'ASC', |
@@ -2753,16 +2753,16 @@ discard block |
||
2753 | 2753 | ) |
2754 | 2754 | ); |
2755 | 2755 | |
2756 | - if ( $donation_forms->have_posts() ) { |
|
2757 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
2756 | + if ($donation_forms->have_posts()) { |
|
2757 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
2758 | 2758 | |
2759 | - while ( $donation_forms->have_posts() ) { |
|
2759 | + while ($donation_forms->have_posts()) { |
|
2760 | 2760 | $donation_forms->the_post(); |
2761 | 2761 | $form_id = get_the_ID(); |
2762 | 2762 | |
2763 | - $form_closed_status = give_get_meta( $form_id, '_give_form_status', true ); |
|
2764 | - if ( empty( $form_closed_status ) ) { |
|
2765 | - give_set_form_closed_status( $form_id ); |
|
2763 | + $form_closed_status = give_get_meta($form_id, '_give_form_status', true); |
|
2764 | + if (empty($form_closed_status)) { |
|
2765 | + give_set_form_closed_status($form_id); |
|
2766 | 2766 | } |
2767 | 2767 | } |
2768 | 2768 | |
@@ -2772,7 +2772,7 @@ discard block |
||
2772 | 2772 | } else { |
2773 | 2773 | |
2774 | 2774 | // The Update Ran. |
2775 | - give_set_upgrade_complete( 'v210_verify_form_status_upgrades' ); |
|
2775 | + give_set_upgrade_complete('v210_verify_form_status_upgrades'); |
|
2776 | 2776 | } |
2777 | 2777 | } |
2778 | 2778 | |
@@ -2791,22 +2791,22 @@ discard block |
||
2791 | 2791 | SELECT DISTINCT payment_id |
2792 | 2792 | FROM {$donation_meta_table} |
2793 | 2793 | LIMIT 20 |
2794 | - OFFSET {$give_updates->get_offset( 20 )} |
|
2794 | + OFFSET {$give_updates->get_offset(20)} |
|
2795 | 2795 | " |
2796 | 2796 | ); |
2797 | 2797 | |
2798 | - if ( ! empty( $donations ) ) { |
|
2799 | - foreach ( $donations as $donation ) { |
|
2800 | - $donation_obj = get_post( $donation ); |
|
2798 | + if ( ! empty($donations)) { |
|
2799 | + foreach ($donations as $donation) { |
|
2800 | + $donation_obj = get_post($donation); |
|
2801 | 2801 | |
2802 | - if ( ! $donation_obj instanceof WP_Post ) { |
|
2803 | - Give()->payment_meta->delete_all_meta( $donation ); |
|
2802 | + if ( ! $donation_obj instanceof WP_Post) { |
|
2803 | + Give()->payment_meta->delete_all_meta($donation); |
|
2804 | 2804 | } |
2805 | 2805 | } |
2806 | 2806 | } else { |
2807 | 2807 | |
2808 | 2808 | // The Update Ran. |
2809 | - give_set_upgrade_complete( 'v213_delete_donation_meta' ); |
|
2809 | + give_set_upgrade_complete('v213_delete_donation_meta'); |
|
2810 | 2810 | } |
2811 | 2811 | } |
2812 | 2812 | |
@@ -2817,19 +2817,19 @@ discard block |
||
2817 | 2817 | * |
2818 | 2818 | * @since 2.2.0 |
2819 | 2819 | */ |
2820 | -function give_v220_rename_donation_meta_type_callback(){ |
|
2820 | +function give_v220_rename_donation_meta_type_callback() { |
|
2821 | 2821 | global $wpdb; |
2822 | 2822 | |
2823 | 2823 | // Check upgrade before running. |
2824 | - if( |
|
2825 | - give_has_upgrade_completed( 'v220_rename_donation_meta_type' ) |
|
2826 | - || ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) |
|
2824 | + if ( |
|
2825 | + give_has_upgrade_completed('v220_rename_donation_meta_type') |
|
2826 | + || ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta")) |
|
2827 | 2827 | ) { |
2828 | 2828 | return; |
2829 | 2829 | } |
2830 | 2830 | |
2831 | - $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)" ); |
|
2832 | - $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta" ); |
|
2831 | + $wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)"); |
|
2832 | + $wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta"); |
|
2833 | 2833 | |
2834 | 2834 | give_set_upgrade_complete('v220_rename_donation_meta_type'); |
2835 | 2835 | } |
@@ -2841,10 +2841,10 @@ discard block |
||
2841 | 2841 | */ |
2842 | 2842 | function give_v215_update_donor_user_roles_callback() { |
2843 | 2843 | |
2844 | - $role = get_role( 'give_manager' ); |
|
2845 | - $role->add_cap( 'view_give_payments' ); |
|
2844 | + $role = get_role('give_manager'); |
|
2845 | + $role->add_cap('view_give_payments'); |
|
2846 | 2846 | |
2847 | - give_set_upgrade_complete( 'v215_update_donor_user_roles' ); |
|
2847 | + give_set_upgrade_complete('v215_update_donor_user_roles'); |
|
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | |
@@ -2856,8 +2856,8 @@ discard block |
||
2856 | 2856 | * |
2857 | 2857 | * @global wpdb $wpdb |
2858 | 2858 | */ |
2859 | -function give_v220_delete_wp_session_data(){ |
|
2859 | +function give_v220_delete_wp_session_data() { |
|
2860 | 2860 | global $wpdb; |
2861 | 2861 | |
2862 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" ); |
|
2862 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'"); |
|
2863 | 2863 | } |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_Offline_Donation_Instruction_Email |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'offline-donation-instruction', |
43 | - 'label' => __( 'Offline Donation Instructions', 'give' ), |
|
44 | - 'description' => __( 'Sent to the donor when they submit an offline donation.', 'give' ), |
|
45 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
43 | + 'label' => __('Offline Donation Instructions', 'give'), |
|
44 | + 'description' => __('Sent to the donor when they submit an offline donation.', 'give'), |
|
45 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
46 | 46 | 'form_metabox_setting' => true, |
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tag_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | - 'default_email_subject' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
51 | + 'default_email_subject' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
52 | 52 | 'default_email_message' => give_get_default_offline_donation_email_content(), |
53 | - 'default_email_header' => __( 'Offline Donation Instructions', 'give' ), |
|
53 | + 'default_email_header' => __('Offline Donation Instructions', 'give'), |
|
54 | 54 | 'notices' => array( |
55 | 55 | 'non-notification-status-editable' => sprintf( |
56 | 56 | '%1$s <a href="%2$s">%3$s »</a>', |
57 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
58 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
59 | - __( 'Edit Setting', 'give' ) |
|
57 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
58 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
59 | + __('Edit Setting', 'give') |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
65 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
64 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
65 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function get_email_message( $form_id = null ) { |
|
77 | + public function get_email_message($form_id = null) { |
|
78 | 78 | $message = Give_Email_Notification_Util::get_value( |
79 | 79 | $this, |
80 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
80 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
81 | 81 | $form_id, |
82 | 82 | $this->config['default_email_message'] |
83 | 83 | ); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function get_email_subject( $form_id = null ) { |
|
109 | + public function get_email_subject($form_id = null) { |
|
110 | 110 | $subject = wp_strip_all_tags( |
111 | 111 | Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_subject'] |
116 | 116 | ) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param int $form_id |
140 | 140 | * @return array |
141 | 141 | */ |
142 | - public function get_email_attachments( $form_id = null ) { |
|
142 | + public function get_email_attachments($form_id = null) { |
|
143 | 143 | /** |
144 | 144 | * Filter the attachments. |
145 | 145 | * Note: This filter will deprecate soon. |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $this->payment->payment_meta |
203 | 203 | ); |
204 | 204 | |
205 | - Give()->emails->__set( 'from_name', $from_name ); |
|
206 | - Give()->emails->__set( 'from_email', $from_email ); |
|
207 | - Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) ); |
|
205 | + Give()->emails->__set('from_name', $from_name); |
|
206 | + Give()->emails->__set('from_email', $from_email); |
|
207 | + Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta)); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @param int $payment_id |
217 | 217 | */ |
218 | - public function setup_email_notification( $payment_id ) { |
|
219 | - $this->payment = new Give_Payment( $payment_id ); |
|
218 | + public function setup_email_notification($payment_id) { |
|
219 | + $this->payment = new Give_Payment($payment_id); |
|
220 | 220 | |
221 | 221 | // Exit if not donation was not with offline donation. |
222 | - if ( 'offline' !== $this->payment->gateway ) { |
|
222 | + if ('offline' !== $this->payment->gateway) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | $this->setup_email_data(); |
228 | 228 | |
229 | 229 | // Send email. |
230 | - $this->send_email_notification( array( |
|
230 | + $this->send_email_notification(array( |
|
231 | 231 | 'payment_id' => $this->payment->ID, |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | * @param $update_options |
242 | 242 | * @param $option_name |
243 | 243 | */ |
244 | - public function set_notification_status( $update_options, $option_name ) { |
|
244 | + public function set_notification_status($update_options, $option_name) { |
|
245 | 245 | // Get updated settings. |
246 | 246 | $update_options = give_get_settings(); |
247 | 247 | |
248 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
248 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
249 | 249 | |
250 | 250 | if ( |
251 | - empty( $update_options["{$this->config['id']}_notification"] ) |
|
251 | + empty($update_options["{$this->config['id']}_notification"]) |
|
252 | 252 | || $notification_status !== $update_options["{$this->config['id']}_notification"] |
253 | 253 | ) { |
254 | 254 | $update_options["{$this->config['id']}_notification"] = $notification_status; |
255 | - update_option( $option_name, $update_options, false ); |
|
255 | + update_option($option_name, $update_options, false); |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
272 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
271 | + public function add_metabox_setting_field($settings, $form_id) { |
|
272 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
273 | 273 | $settings[] = array( |
274 | 274 | 'id' => $this->config['id'], |
275 | 275 | 'title' => $this->config['label'], |
276 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
276 | + 'fields' => $this->get_setting_fields($form_id), |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if access directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) : |
|
17 | +if ( ! class_exists('Give_New_Donor_Register_Email')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_New_Donor_Register_Email |
@@ -31,35 +31,35 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'new-donor-register', |
36 | - 'label' => __( 'New User Registration', 'give' ), |
|
37 | - 'description' => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ), |
|
36 | + 'label' => __('New User Registration', 'give'), |
|
37 | + 'description' => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'), |
|
38 | 38 | 'has_recipient_field' => true, |
39 | 39 | 'notification_status' => 'enabled', |
40 | 40 | 'has_preview_header' => true, |
41 | - 'email_tag_context' => array( 'donor', 'general' ), |
|
41 | + 'email_tag_context' => array('donor', 'general'), |
|
42 | 42 | 'form_metabox_setting' => false, |
43 | 43 | 'default_email_subject' => sprintf( |
44 | 44 | /* translators: %s: site name */ |
45 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
46 | - get_bloginfo( 'name' ) |
|
45 | + esc_attr__('[%s] New User Registration', 'give'), |
|
46 | + get_bloginfo('name') |
|
47 | 47 | ), |
48 | 48 | 'default_email_message' => $this->get_default_email_message(), |
49 | - 'default_email_header' => __( 'New User Registration', 'give' ), |
|
50 | - ) ); |
|
49 | + 'default_email_header' => __('New User Registration', 'give'), |
|
50 | + )); |
|
51 | 51 | |
52 | 52 | // Setup action hook. |
53 | 53 | add_action( |
54 | 54 | "give_{$this->config['id']}_email_notification", |
55 | - array( $this, 'setup_email_notification' ), |
|
55 | + array($this, 'setup_email_notification'), |
|
56 | 56 | 10, |
57 | 57 | 2 |
58 | 58 | ); |
59 | 59 | |
60 | 60 | add_filter( |
61 | 61 | 'give_email_preview_header', |
62 | - array( $this, 'email_preview_header' ), |
|
62 | + array($this, 'email_preview_header'), |
|
63 | 63 | 10, |
64 | 64 | 2 |
65 | 65 | ); |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @return string |
75 | 75 | */ |
76 | 76 | function get_default_email_message() { |
77 | - $message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n"; |
|
78 | - $message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n"; |
|
79 | - $message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n"; |
|
77 | + $message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n"; |
|
78 | + $message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n"; |
|
79 | + $message .= esc_attr__('Email: {user_email}', 'give')."\r\n"; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Filter the default email message |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function setup_email_notification( $user_id, $user_data ) { |
|
104 | + public function setup_email_notification($user_id, $user_data) { |
|
105 | 105 | $this->setup_email_data(); |
106 | 106 | |
107 | - $this->send_email_notification( array( |
|
107 | + $this->send_email_notification(array( |
|
108 | 108 | 'user_id' => $user_id, |
109 | - ) ); |
|
109 | + )); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -120,42 +120,42 @@ discard block |
||
120 | 120 | * @param Give_New_Donor_Register_Email $email |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - public function email_preview_header( $email_preview_header, $email ) { |
|
123 | + public function email_preview_header($email_preview_header, $email) { |
|
124 | 124 | // Bailout. |
125 | - if ( $this->config['id'] !== $email->config['id'] ) { |
|
125 | + if ($this->config['id'] !== $email->config['id']) { |
|
126 | 126 | return $email_preview_header; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Payment receipt switcher |
130 | - $user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ); |
|
130 | + $user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id'); |
|
131 | 131 | |
132 | 132 | // Get payments. |
133 | 133 | $donors = new Give_API(); |
134 | - $donors = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' ); |
|
134 | + $donors = give_check_variable($donors->get_donors(), 'empty', array(), 'donors'); |
|
135 | 135 | $options = array(); |
136 | 136 | |
137 | 137 | // Default option. |
138 | - $options[0] = esc_html__( 'No donor(s) found.', 'give' ); |
|
138 | + $options[0] = esc_html__('No donor(s) found.', 'give'); |
|
139 | 139 | |
140 | 140 | // Provide nice human readable options. |
141 | - if ( $donors ) { |
|
142 | - $options[0] = esc_html__( '- Select a donor -', 'give' ); |
|
143 | - foreach ( $donors as $donor ) { |
|
141 | + if ($donors) { |
|
142 | + $options[0] = esc_html__('- Select a donor -', 'give'); |
|
143 | + foreach ($donors as $donor) { |
|
144 | 144 | // Exclude customers for which wp user not exist. |
145 | - if ( ! $donor['info']['user_id'] ) { |
|
145 | + if ( ! $donor['info']['user_id']) { |
|
146 | 146 | continue; |
147 | 147 | } |
148 | - $options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] ); |
|
148 | + $options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
152 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
153 | 153 | $query = $request_url_data['query']; |
154 | 154 | |
155 | 155 | // Remove user id query param if set from request url. |
156 | - $query = remove_query_arg( array( 'user_id' ), $query ); |
|
156 | + $query = remove_query_arg(array('user_id'), $query); |
|
157 | 157 | |
158 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
158 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
159 | 159 | ?> |
160 | 160 | <script type="text/javascript"> |
161 | 161 | function change_preview() { |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | <div class="give_preview_email_user_id_main"> |
190 | 190 | |
191 | 191 | <label for="give_preview_email_user_id" class="give_preview_email_user_id_label"> |
192 | - <?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?> |
|
192 | + <?php echo esc_html__('Preview email with a donor:', 'give'); ?> |
|
193 | 193 | </label> |
194 | 194 | |
195 | 195 | <?php |
196 | 196 | // The select field with 100 latest transactions |
197 | - echo Give()->html->select( array( |
|
197 | + echo Give()->html->select(array( |
|
198 | 198 | 'name' => 'preview_email_user_id', |
199 | 199 | 'selected' => $user_id, |
200 | 200 | 'id' => 'give_preview_email_user_id', |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'select_atts' => 'onchange="change_preview()"', |
205 | 205 | 'show_option_all' => false, |
206 | 206 | 'show_option_none' => false, |
207 | - ) ); |
|
207 | + )); |
|
208 | 208 | ?> |
209 | 209 | <!-- Closing tag--> |
210 | 210 | </div> |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_New_Offline_Donation_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_New_Offline_Donation_Email |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'new-offline-donation', |
43 | - 'label' => __( 'New Offline Donation', 'give' ), |
|
44 | - 'description' => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ), |
|
43 | + 'label' => __('New Offline Donation', 'give'), |
|
44 | + 'description' => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'), |
|
45 | 45 | 'has_recipient_field' => true, |
46 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
46 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tags_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | 51 | 'default_email_subject' => $this->get_default_email_subject(), |
52 | 52 | 'default_email_message' => $this->get_default_email_message(), |
53 | - 'default_email_header' => __( 'New Offline Donation!', 'give' ), |
|
53 | + 'default_email_header' => __('New Offline Donation!', 'give'), |
|
54 | 54 | 'notices' => array( |
55 | 55 | 'non-notification-status-editable' => sprintf( |
56 | 56 | '%1$s <a href="%2$s">%3$s »</a>', |
57 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
58 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
59 | - __( 'Edit Setting', 'give' ) |
|
57 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
58 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
59 | + __('Edit Setting', 'give') |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
65 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
64 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
65 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | $subject = apply_filters( |
83 | 83 | 'give_offline_admin_donation_notification_subject', |
84 | - __( 'New Pending Donation', 'give' ) |
|
84 | + __('New Pending Donation', 'give') |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | /** |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | * @return string |
107 | 107 | */ |
108 | 108 | public function get_default_email_message() { |
109 | - $message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
110 | - $message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
111 | - $message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
109 | + $message = __('Dear Admin,', 'give')."\n\n"; |
|
110 | + $message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
111 | + $message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
112 | 112 | |
113 | - $message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
114 | - $message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
113 | + $message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
114 | + $message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
115 | 115 | |
116 | 116 | $message .= sprintf( |
117 | 117 | '<a href="%1$s">%2$s</a>', |
118 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ), |
|
119 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
120 | - ) . "\n\n"; |
|
118 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID), |
|
119 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
120 | + )."\n\n"; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Filter the donation receipt email message |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - public function get_email_message( $form_id = null ) { |
|
158 | + public function get_email_message($form_id = null) { |
|
159 | 159 | $message = Give_Email_Notification_Util::get_value( |
160 | 160 | $this, |
161 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
161 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
162 | 162 | $form_id, |
163 | 163 | $this->config['default_email_message'] |
164 | 164 | ); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return array |
200 | 200 | */ |
201 | - public function get_email_attachments( $form_id = null ) { |
|
201 | + public function get_email_attachments($form_id = null) { |
|
202 | 202 | /** |
203 | 203 | * Filter the attachments. |
204 | 204 | * Note: This filter will deprecate soon. |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param int $payment_id |
251 | 251 | */ |
252 | - public function setup_email_notification( $payment_id ) { |
|
253 | - $this->payment = new Give_Payment( $payment_id ); |
|
252 | + public function setup_email_notification($payment_id) { |
|
253 | + $this->payment = new Give_Payment($payment_id); |
|
254 | 254 | |
255 | 255 | // Exit if not donation was not with offline donation. |
256 | - if ( 'offline' !== $this->payment->gateway ) { |
|
256 | + if ('offline' !== $this->payment->gateway) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | $this->setup_email_data(); |
262 | 262 | |
263 | 263 | // Send email. |
264 | - $this->send_email_notification( array( |
|
264 | + $this->send_email_notification(array( |
|
265 | 265 | 'payment_id' => $this->payment->ID, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -275,18 +275,18 @@ discard block |
||
275 | 275 | * @param $update_options |
276 | 276 | * @param $option_name |
277 | 277 | */ |
278 | - public function set_notification_status( $update_options, $option_name ) { |
|
278 | + public function set_notification_status($update_options, $option_name) { |
|
279 | 279 | // Get updated settings. |
280 | 280 | $update_options = give_get_settings(); |
281 | 281 | |
282 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
282 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
283 | 283 | |
284 | 284 | if ( |
285 | - empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
286 | - || $notification_status !== $update_options[ "{$this->config['id']}_notification" ] |
|
285 | + empty($update_options["{$this->config['id']}_notification"]) |
|
286 | + || $notification_status !== $update_options["{$this->config['id']}_notification"] |
|
287 | 287 | ) { |
288 | - $update_options[ "{$this->config['id']}_notification" ] = $notification_status; |
|
289 | - update_option( $option_name, $update_options, false ); |
|
288 | + $update_options["{$this->config['id']}_notification"] = $notification_status; |
|
289 | + update_option($option_name, $update_options, false); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return array |
303 | 303 | */ |
304 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
304 | + public function add_metabox_setting_field($settings, $form_id) { |
|
305 | 305 | |
306 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
306 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
307 | 307 | $settings[] = array( |
308 | 308 | 'id' => $this->config['id'], |
309 | 309 | 'title' => $this->config['label'], |
310 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
310 | + 'fields' => $this->get_setting_fields($form_id), |
|
311 | 311 | ); |
312 | 312 | } |
313 | 313 |