@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => esc_html__( 'Date', 'give' ), |
|
65 | - 'donations' => esc_html__( 'Donations', 'give' ), |
|
64 | + 'date' => esc_html__('Date', 'give'), |
|
65 | + 'donations' => esc_html__('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( esc_html__( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) ) |
|
67 | + 'earnings' => sprintf(esc_html__('Income (%s)', 'give'), html_entity_decode(give_currency_filter(''))) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array $output Response messages |
25 | 25 | */ |
26 | -function give_edit_customer( $args ) { |
|
26 | +function give_edit_customer($args) { |
|
27 | 27 | |
28 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
28 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $args ) ) { |
|
34 | + if (empty($args)) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $customer_id = (int) $args['customerinfo']['id']; |
40 | 40 | $nonce = $args['_wpnonce']; |
41 | 41 | |
42 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
43 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
42 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
43 | + wp_die(esc_html__('Cheatin\' eh?!', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
44 | 44 | } |
45 | 45 | |
46 | - $customer = new Give_Customer( $customer_id ); |
|
47 | - if ( empty( $customer->id ) ) { |
|
46 | + $customer = new Give_Customer($customer_id); |
|
47 | + if (empty($customer->id)) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | 'user_id' => 0 |
55 | 55 | ); |
56 | 56 | |
57 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
57 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
58 | 58 | |
59 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
60 | - give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) ); |
|
59 | + if ( ! is_email($customer_info['email'])) { |
|
60 | + give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give')); |
|
61 | 61 | } |
62 | 62 | |
63 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
63 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
64 | 64 | |
65 | 65 | // Make sure we don't already have this user attached to a customer |
66 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
67 | - give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
66 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
67 | + give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Make sure it's actually a user |
71 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
72 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
73 | - give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
71 | + $user = get_user_by('id', $customer_info['user_id']); |
|
72 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
73 | + give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | } |
@@ -78,53 +78,53 @@ discard block |
||
78 | 78 | // Record this for later |
79 | 79 | $previous_user_id = $customer->user_id; |
80 | 80 | |
81 | - if ( give_get_errors() ) { |
|
81 | + if (give_get_errors()) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Setup the customer address, if present |
86 | 86 | $address = array(); |
87 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
87 | + if (intval($customer_info['user_id']) > 0) { |
|
88 | 88 | |
89 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
89 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
90 | 90 | |
91 | - if ( false === $current_address ) { |
|
92 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
93 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
94 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
95 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
96 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
97 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
91 | + if (false === $current_address) { |
|
92 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
93 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
94 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
95 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
96 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
97 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
98 | 98 | } else { |
99 | - $current_address = wp_parse_args( $current_address, array( |
|
99 | + $current_address = wp_parse_args($current_address, array( |
|
100 | 100 | 'line1', |
101 | 101 | 'line2', |
102 | 102 | 'city', |
103 | 103 | 'zip', |
104 | 104 | 'state', |
105 | 105 | 'country' |
106 | - ) ); |
|
107 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
110 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
111 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
106 | + )); |
|
107 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
110 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
111 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Sanitize the inputs |
118 | 118 | $customer_data = array(); |
119 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
119 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
120 | 120 | $customer_data['email'] = $customer_info['email']; |
121 | 121 | $customer_data['user_id'] = $customer_info['user_id']; |
122 | 122 | |
123 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
124 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
123 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
124 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
125 | 125 | |
126 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
127 | - $address = array_map( 'sanitize_text_field', $address ); |
|
126 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
127 | + $address = array_map('sanitize_text_field', $address); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | /** |
@@ -136,34 +136,34 @@ discard block |
||
136 | 136 | * @param array $customer_data The customer data. |
137 | 137 | * @param array $address The customer address. |
138 | 138 | */ |
139 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
139 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
140 | 140 | |
141 | 141 | $output = array(); |
142 | 142 | $previous_email = $customer->email; |
143 | 143 | |
144 | - if ( $customer->update( $customer_data ) ) { |
|
144 | + if ($customer->update($customer_data)) { |
|
145 | 145 | |
146 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
147 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
146 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
147 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // Update some payment meta if we need to |
151 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
151 | + $payments_array = explode(',', $customer->payment_ids); |
|
152 | 152 | |
153 | - if ( $customer->email != $previous_email ) { |
|
154 | - foreach ( $payments_array as $payment_id ) { |
|
155 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
153 | + if ($customer->email != $previous_email) { |
|
154 | + foreach ($payments_array as $payment_id) { |
|
155 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - if ( $customer->user_id != $previous_user_id ) { |
|
160 | - foreach ( $payments_array as $payment_id ) { |
|
161 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
159 | + if ($customer->user_id != $previous_user_id) { |
|
160 | + foreach ($payments_array as $payment_id) { |
|
161 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | $output['success'] = true; |
166 | - $customer_data = array_merge( $customer_data, $address ); |
|
166 | + $customer_data = array_merge($customer_data, $address); |
|
167 | 167 | $output['customer_info'] = $customer_data; |
168 | 168 | |
169 | 169 | } else { |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | * @param int $customer_id The ID of the customer. |
181 | 181 | * @param array $customer_data The customer data. |
182 | 182 | */ |
183 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
183 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
184 | 184 | |
185 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
186 | - header( 'Content-Type: application/json' ); |
|
187 | - echo json_encode( $output ); |
|
185 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
186 | + header('Content-Type: application/json'); |
|
187 | + echo json_encode($output); |
|
188 | 188 | wp_die(); |
189 | 189 | } |
190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
195 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Save a customer note being added |
@@ -203,36 +203,36 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return int The Note ID that was saved, or 0 if nothing was saved |
205 | 205 | */ |
206 | -function give_customer_save_note( $args ) { |
|
206 | +function give_customer_save_note($args) { |
|
207 | 207 | |
208 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
208 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
209 | 209 | |
210 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
211 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
210 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
211 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
212 | 212 | } |
213 | 213 | |
214 | - if ( empty( $args ) ) { |
|
214 | + if (empty($args)) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
218 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
219 | 219 | $customer_id = (int) $args['customer_id']; |
220 | 220 | $nonce = $args['add_customer_note_nonce']; |
221 | 221 | |
222 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
223 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
222 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
223 | + wp_die(esc_html__('Cheatin\' eh?!', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( empty( $customer_note ) ) { |
|
227 | - give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) ); |
|
226 | + if (empty($customer_note)) { |
|
227 | + give_set_error('empty-customer-note', esc_html__('A note is required.', 'give')); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( give_get_errors() ) { |
|
230 | + if (give_get_errors()) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | - $customer = new Give_Customer( $customer_id ); |
|
235 | - $new_note = $customer->add_note( $customer_note ); |
|
234 | + $customer = new Give_Customer($customer_id); |
|
235 | + $new_note = $customer->add_note($customer_note); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires before inserting customer note. |
@@ -242,22 +242,22 @@ discard block |
||
242 | 242 | * @param int $customer_id The ID of the customer. |
243 | 243 | * @param string $new_note Note content. |
244 | 244 | */ |
245 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
245 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
246 | 246 | |
247 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
247 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
248 | 248 | |
249 | 249 | ob_start(); |
250 | 250 | ?> |
251 | 251 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
252 | 252 | <span class="note-content-wrap"> |
253 | - <?php echo stripslashes( $new_note ); ?> |
|
253 | + <?php echo stripslashes($new_note); ?> |
|
254 | 254 | </span> |
255 | 255 | </div> |
256 | 256 | <?php |
257 | 257 | $output = ob_get_contents(); |
258 | 258 | ob_end_clean(); |
259 | 259 | |
260 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
260 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
261 | 261 | echo $output; |
262 | 262 | exit; |
263 | 263 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | } |
272 | 272 | |
273 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
273 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Delete a customer |
@@ -281,37 +281,37 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return int Whether it was a successful deletion |
283 | 283 | */ |
284 | -function give_customer_delete( $args ) { |
|
284 | +function give_customer_delete($args) { |
|
285 | 285 | |
286 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
286 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
287 | 287 | |
288 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
289 | - wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
288 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
289 | + wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
290 | 290 | } |
291 | 291 | |
292 | - if ( empty( $args ) ) { |
|
292 | + if (empty($args)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | 296 | $customer_id = (int) $args['customer_id']; |
297 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
298 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
297 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
298 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
299 | 299 | $nonce = $args['_wpnonce']; |
300 | 300 | |
301 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
302 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
301 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
302 | + wp_die(esc_html__('Cheatin\' eh?!', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
303 | 303 | } |
304 | 304 | |
305 | - if ( ! $confirm ) { |
|
306 | - give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) ); |
|
305 | + if ( ! $confirm) { |
|
306 | + give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give')); |
|
307 | 307 | } |
308 | 308 | |
309 | - if ( give_get_errors() ) { |
|
310 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
309 | + if (give_get_errors()) { |
|
310 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
311 | 311 | exit; |
312 | 312 | } |
313 | 313 | |
314 | - $customer = new Give_Customer( $customer_id ); |
|
314 | + $customer = new Give_Customer($customer_id); |
|
315 | 315 | |
316 | 316 | /** |
317 | 317 | * Fires before deleting customer. |
@@ -322,55 +322,55 @@ discard block |
||
322 | 322 | * @param bool $confirm Delete confirmation. |
323 | 323 | * @param bool $remove_data Records delete confirmation. |
324 | 324 | */ |
325 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
325 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
326 | 326 | |
327 | 327 | $success = false; |
328 | 328 | |
329 | - if ( $customer->id > 0 ) { |
|
329 | + if ($customer->id > 0) { |
|
330 | 330 | |
331 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
332 | - $success = Give()->customers->delete( $customer->id ); |
|
331 | + $payments_array = explode(',', $customer->payment_ids); |
|
332 | + $success = Give()->customers->delete($customer->id); |
|
333 | 333 | |
334 | - if ( $success ) { |
|
334 | + if ($success) { |
|
335 | 335 | |
336 | - if ( $remove_data ) { |
|
336 | + if ($remove_data) { |
|
337 | 337 | |
338 | 338 | // Remove all payments, logs, etc |
339 | - foreach ( $payments_array as $payment_id ) { |
|
340 | - give_delete_purchase( $payment_id ); |
|
339 | + foreach ($payments_array as $payment_id) { |
|
340 | + give_delete_purchase($payment_id); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | } else { |
344 | 344 | |
345 | 345 | // Just set the payments to customer_id of 0 |
346 | - foreach ( $payments_array as $payment_id ) { |
|
347 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
346 | + foreach ($payments_array as $payment_id) { |
|
347 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
352 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
353 | 353 | |
354 | 354 | } else { |
355 | 355 | |
356 | - give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) ); |
|
357 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
356 | + give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give')); |
|
357 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
358 | 358 | |
359 | 359 | } |
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
363 | - give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
364 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
363 | + give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give')); |
|
364 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | - wp_redirect( $redirect ); |
|
368 | + wp_redirect($redirect); |
|
369 | 369 | exit; |
370 | 370 | |
371 | 371 | } |
372 | 372 | |
373 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
373 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Disconnect a user ID from a donor |
@@ -381,27 +381,27 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @return bool If the disconnect was successful |
383 | 383 | */ |
384 | -function give_disconnect_customer_user_id( $args ) { |
|
384 | +function give_disconnect_customer_user_id($args) { |
|
385 | 385 | |
386 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
386 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
387 | 387 | |
388 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
389 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
388 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
389 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( empty( $args ) ) { |
|
392 | + if (empty($args)) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $customer_id = (int) $args['customer_id']; |
397 | 397 | $nonce = $args['_wpnonce']; |
398 | 398 | |
399 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
400 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
399 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
400 | + wp_die(esc_html__('Cheatin\' eh?!', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
401 | 401 | } |
402 | 402 | |
403 | - $customer = new Give_Customer( $customer_id ); |
|
404 | - if ( empty( $customer->id ) ) { |
|
403 | + $customer = new Give_Customer($customer_id); |
|
404 | + if (empty($customer->id)) { |
|
405 | 405 | return false; |
406 | 406 | } |
407 | 407 | |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | * @param int $customer_id The ID of the customer. |
416 | 416 | * @param int $user_id The ID of the user. |
417 | 417 | */ |
418 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id ); |
|
418 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id); |
|
419 | 419 | |
420 | - $customer_args = array( 'user_id' => 0 ); |
|
420 | + $customer_args = array('user_id' => 0); |
|
421 | 421 | |
422 | - if ( $customer->update( $customer_args ) ) { |
|
422 | + if ($customer->update($customer_args)) { |
|
423 | 423 | global $wpdb; |
424 | 424 | |
425 | - if ( ! empty( $customer->payment_ids ) ) { |
|
426 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
425 | + if ( ! empty($customer->payment_ids)) { |
|
426 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | $output['success'] = true; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } else { |
432 | 432 | |
433 | 433 | $output['success'] = false; |
434 | - give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) ); |
|
434 | + give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give')); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param int $customer_id The ID of the customer. |
443 | 443 | */ |
444 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
444 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
445 | 445 | |
446 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
447 | - header( 'Content-Type: application/json' ); |
|
448 | - echo json_encode( $output ); |
|
446 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
447 | + header('Content-Type: application/json'); |
|
448 | + echo json_encode($output); |
|
449 | 449 | wp_die(); |
450 | 450 | } |
451 | 451 | |
@@ -453,4 +453,4 @@ discard block |
||
453 | 453 | |
454 | 454 | } |
455 | 455 | |
456 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
456 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats; ?> |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - esc_html__( 'Happy %s!', 'give' ), |
|
55 | - date( 'l', current_time( 'timestamp' ) ) |
|
54 | + esc_html__('Happy %s!', 'give'), |
|
55 | + date('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> |
|
59 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> |
|
60 | 60 | |
61 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> |
|
61 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> |
|
62 | 62 | |
63 | 63 | <p class="give-orders-today"> |
64 | - <?php $donations_today = $stats->get_sales( 0, 'today', false ); ?> |
|
65 | - <?php echo give_format_amount( $donations_today, false ); ?> |
|
66 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> |
|
64 | + <?php $donations_today = $stats->get_sales(0, 'today', false); ?> |
|
65 | + <?php echo give_format_amount($donations_today, false); ?> |
|
66 | + <span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> |
|
67 | 67 | </p> |
68 | 68 | |
69 | 69 | |
@@ -73,34 +73,34 @@ discard block |
||
73 | 73 | <table class="give-table-stats"> |
74 | 74 | <thead style="display: none;"> |
75 | 75 | <tr> |
76 | - <th><?php esc_html_e( 'This Week', 'give' ); ?></th> |
|
77 | - <th><?php esc_html_e( 'This Month', 'give' ); ?></th> |
|
78 | - <th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th> |
|
76 | + <th><?php esc_html_e('This Week', 'give'); ?></th> |
|
77 | + <th><?php esc_html_e('This Month', 'give'); ?></th> |
|
78 | + <th><?php esc_html_e('Past 30 Days', 'give'); ?></th> |
|
79 | 79 | </tr> |
80 | 80 | </thead> |
81 | 81 | <tbody> |
82 | 82 | <tr id="give-table-stats-tr-1"> |
83 | 83 | <td> |
84 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
84 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
85 | 85 | |
86 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this week', 'give' ); ?></p> |
|
86 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this week', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | <td> |
89 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
89 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
90 | 90 | |
91 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this month', 'give' ); ?></p> |
|
91 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this month', 'give'); ?></p> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | <tr id="give-table-stats-tr-2"> |
95 | 95 | <td> |
96 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
96 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
97 | 97 | |
98 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'last month', 'give' ); ?></p> |
|
98 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('last month', 'give'); ?></p> |
|
99 | 99 | </td> |
100 | 100 | <td> |
101 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
101 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
102 | 102 | |
103 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this year', 'give' ); ?></p> |
|
103 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this year', 'give'); ?></p> |
|
104 | 104 | </td> |
105 | 105 | </tr> |
106 | 106 | </tbody> |
@@ -120,25 +120,25 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return array |
122 | 122 | */ |
123 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
124 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
123 | +function give_dashboard_at_a_glance_widget($items) { |
|
124 | + $num_posts = wp_count_posts('give_forms'); |
|
125 | 125 | |
126 | - if ( $num_posts && $num_posts->publish ) { |
|
126 | + if ($num_posts && $num_posts->publish) { |
|
127 | 127 | |
128 | 128 | $text = sprintf( |
129 | 129 | /* translators: 1: number of posts published 2: forms singular label 3: forms plural label */ |
130 | - _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), |
|
130 | + _n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), |
|
131 | 131 | $num_posts->publish, |
132 | 132 | give_get_forms_label_singular(), |
133 | 133 | give_get_forms_label_plural() |
134 | 134 | ); |
135 | 135 | |
136 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
136 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
137 | 137 | |
138 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
139 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); |
|
138 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
139 | + $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); |
|
140 | 140 | } else { |
141 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); |
|
141 | + $text = sprintf('<span class="give-forms-count">%1$s</span>', $text); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $items[] = $text; |
@@ -147,4 +147,4 @@ discard block |
||
147 | 147 | return $items; |
148 | 148 | } |
149 | 149 | |
150 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
150 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | - if ( isset( $_POST['give_payment_mode'] ) ) { |
|
42 | - do_action( 'give_purchase_form', $_POST['give_form_id'] ); |
|
41 | + if (isset($_POST['give_payment_mode'])) { |
|
42 | + do_action('give_purchase_form', $_POST['give_form_id']); |
|
43 | 43 | exit(); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
48 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
47 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
48 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Sets an error on checkout if no gateways are enabled |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | function give_no_gateway_error() { |
58 | 58 | $gateways = give_get_enabled_payment_gateways(); |
59 | 59 | |
60 | - if ( empty( $gateways ) ) { |
|
61 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
60 | + if (empty($gateways)) { |
|
61 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
62 | 62 | } else { |
63 | - give_unset_error( 'no_gateways' ); |
|
63 | + give_unset_error('no_gateways'); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -add_action( 'init', 'give_no_gateway_error' ); |
|
67 | +add_action('init', 'give_no_gateway_error'); |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | * @since 1.0 |
112 | 112 | * @access public |
113 | 113 | * |
114 | - * @param int $column Column ID. |
|
115 | - * @param int $row_id Row ID. |
|
116 | - * |
|
117 | - * @return object |
|
114 | + * @param int $column Column ID. |
|
115 | + * @param int $row_id Row ID. |
|
116 | + * |
|
117 | + * @return object |
|
118 | 118 | */ |
119 | 119 | public function get_by( $column, $row_id ) { |
120 | - /* @var WPDB $wpdb */ |
|
121 | - global $wpdb; |
|
120 | + /* @var WPDB $wpdb */ |
|
121 | + global $wpdb; |
|
122 | 122 | |
123 | 123 | $column = esc_sql( $column ); |
124 | 124 | return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @since 1.0 |
131 | 131 | * @access public |
132 | - * |
|
133 | - * @param int $column Column ID. |
|
134 | - * @param int $row_id Row ID. |
|
135 | - * |
|
132 | + * |
|
133 | + * @param int $column Column ID. |
|
134 | + * @param int $row_id Row ID. |
|
135 | + * |
|
136 | 136 | * @return string Column value. |
137 | 137 | */ |
138 | 138 | public function get_column( $column, $row_id ) { |
139 | - /* @var WPDB $wpdb */ |
|
140 | - global $wpdb; |
|
139 | + /* @var WPDB $wpdb */ |
|
140 | + global $wpdb; |
|
141 | 141 | |
142 | 142 | $column = esc_sql( $column ); |
143 | 143 | return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | * @access public |
151 | - * |
|
152 | - * @param int $column Column ID. |
|
153 | - * @param string $column_where Column name. |
|
154 | - * @param string $column_value Column value. |
|
155 | - * |
|
151 | + * |
|
152 | + * @param int $column Column ID. |
|
153 | + * @param string $column_where Column name. |
|
154 | + * @param string $column_value Column value. |
|
155 | + * |
|
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | public function get_column_by( $column, $column_where, $column_value ) { |
159 | - /* @var WPDB $wpdb */ |
|
160 | - global $wpdb; |
|
159 | + /* @var WPDB $wpdb */ |
|
160 | + global $wpdb; |
|
161 | 161 | |
162 | 162 | $column_where = esc_sql( $column_where ); |
163 | 163 | $column = esc_sql( $column ); |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | * @access public |
172 | - * |
|
173 | - * @param array $data |
|
174 | - * @param string $type |
|
175 | - * |
|
172 | + * |
|
173 | + * @param array $data |
|
174 | + * @param string $type |
|
175 | + * |
|
176 | 176 | * @return int |
177 | 177 | */ |
178 | 178 | public function insert( $data, $type = '' ) { |
179 | - /* @var WPDB $wpdb */ |
|
180 | - global $wpdb; |
|
179 | + /* @var WPDB $wpdb */ |
|
180 | + global $wpdb; |
|
181 | 181 | |
182 | 182 | // Set default values |
183 | 183 | $data = wp_parse_args( $data, $this->get_column_defaults() ); |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @since 1.0 |
211 | 211 | * @access public |
212 | - * |
|
213 | - * @param int $row_id Column ID |
|
214 | - * @param array $data |
|
215 | - * @param string $where Column value |
|
216 | - * |
|
212 | + * |
|
213 | + * @param int $row_id Column ID |
|
214 | + * @param array $data |
|
215 | + * @param string $where Column value |
|
216 | + * |
|
217 | 217 | * @return bool |
218 | 218 | */ |
219 | 219 | public function update( $row_id, $data = array(), $where = '' ) { |
220 | - /* @var WPDB $wpdb */ |
|
221 | - global $wpdb; |
|
220 | + /* @var WPDB $wpdb */ |
|
221 | + global $wpdb; |
|
222 | 222 | |
223 | 223 | // Row ID must be positive integer |
224 | 224 | $row_id = absint( $row_id ); |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @since 1.0 |
258 | 258 | * @access public |
259 | - * |
|
260 | - * @param int $row_id Column ID. |
|
261 | - * |
|
259 | + * |
|
260 | + * @param int $row_id Column ID. |
|
261 | + * |
|
262 | 262 | * @return bool |
263 | 263 | */ |
264 | 264 | public function delete( $row_id = 0 ) { |
265 | - /* @var WPDB $wpdb */ |
|
266 | - global $wpdb; |
|
265 | + /* @var WPDB $wpdb */ |
|
266 | + global $wpdb; |
|
267 | 267 | |
268 | 268 | // Row ID must be positive integer |
269 | 269 | $row_id = absint( $row_id ); |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @since 1.3.2 |
286 | 286 | * @access public |
287 | - * |
|
287 | + * |
|
288 | 288 | * @param string $table The table name. |
289 | - * |
|
289 | + * |
|
290 | 290 | * @return bool If the table name exists. |
291 | 291 | */ |
292 | 292 | public function table_exists( $table ) { |
293 | - /* @var WPDB $wpdb */ |
|
293 | + /* @var WPDB $wpdb */ |
|
294 | 294 | global $wpdb; |
295 | 295 | |
296 | 296 | $table = sanitize_text_field( $table ); |
@@ -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 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return object |
100 | 100 | */ |
101 | - public function get( $row_id ) { |
|
101 | + public function get($row_id) { |
|
102 | 102 | /* @var WPDB $wpdb */ |
103 | 103 | global $wpdb; |
104 | 104 | |
105 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
105 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return object |
118 | 118 | */ |
119 | - public function get_by( $column, $row_id ) { |
|
119 | + public function get_by($column, $row_id) { |
|
120 | 120 | /* @var WPDB $wpdb */ |
121 | 121 | global $wpdb; |
122 | 122 | |
123 | - $column = esc_sql( $column ); |
|
124 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
123 | + $column = esc_sql($column); |
|
124 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string Column value. |
137 | 137 | */ |
138 | - public function get_column( $column, $row_id ) { |
|
138 | + public function get_column($column, $row_id) { |
|
139 | 139 | /* @var WPDB $wpdb */ |
140 | 140 | global $wpdb; |
141 | 141 | |
142 | - $column = esc_sql( $column ); |
|
143 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
142 | + $column = esc_sql($column); |
|
143 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
158 | + public function get_column_by($column, $column_where, $column_value) { |
|
159 | 159 | /* @var WPDB $wpdb */ |
160 | 160 | global $wpdb; |
161 | 161 | |
162 | - $column_where = esc_sql( $column_where ); |
|
163 | - $column = esc_sql( $column ); |
|
164 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
162 | + $column_where = esc_sql($column_where); |
|
163 | + $column = esc_sql($column); |
|
164 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -175,31 +175,31 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return int |
177 | 177 | */ |
178 | - public function insert( $data, $type = '' ) { |
|
178 | + public function insert($data, $type = '') { |
|
179 | 179 | /* @var WPDB $wpdb */ |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Set default values |
183 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
183 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
184 | 184 | |
185 | - do_action( 'give_pre_insert_' . $type, $data ); |
|
185 | + do_action('give_pre_insert_'.$type, $data); |
|
186 | 186 | |
187 | 187 | // Initialise column format array |
188 | 188 | $column_formats = $this->get_columns(); |
189 | 189 | |
190 | 190 | // Force fields to lower case |
191 | - $data = array_change_key_case( $data ); |
|
191 | + $data = array_change_key_case($data); |
|
192 | 192 | |
193 | 193 | // White list columns |
194 | - $data = array_intersect_key( $data, $column_formats ); |
|
194 | + $data = array_intersect_key($data, $column_formats); |
|
195 | 195 | |
196 | 196 | // Reorder $column_formats to match the order of columns given in $data |
197 | - $data_keys = array_keys( $data ); |
|
198 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
197 | + $data_keys = array_keys($data); |
|
198 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
199 | 199 | |
200 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
200 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
201 | 201 | |
202 | - do_action( 'give_post_insert_' . $type, $wpdb->insert_id, $data ); |
|
202 | + do_action('give_post_insert_'.$type, $wpdb->insert_id, $data); |
|
203 | 203 | |
204 | 204 | return $wpdb->insert_id; |
205 | 205 | } |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return bool |
218 | 218 | */ |
219 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
219 | + public function update($row_id, $data = array(), $where = '') { |
|
220 | 220 | /* @var WPDB $wpdb */ |
221 | 221 | global $wpdb; |
222 | 222 | |
223 | 223 | // Row ID must be positive integer |
224 | - $row_id = absint( $row_id ); |
|
224 | + $row_id = absint($row_id); |
|
225 | 225 | |
226 | - if ( empty( $row_id ) ) { |
|
226 | + if (empty($row_id)) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | |
230 | - if ( empty( $where ) ) { |
|
230 | + if (empty($where)) { |
|
231 | 231 | $where = $this->primary_key; |
232 | 232 | } |
233 | 233 | |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | $column_formats = $this->get_columns(); |
236 | 236 | |
237 | 237 | // Force fields to lower case |
238 | - $data = array_change_key_case( $data ); |
|
238 | + $data = array_change_key_case($data); |
|
239 | 239 | |
240 | 240 | // White list columns |
241 | - $data = array_intersect_key( $data, $column_formats ); |
|
241 | + $data = array_intersect_key($data, $column_formats); |
|
242 | 242 | |
243 | 243 | // Reorder $column_formats to match the order of columns given in $data |
244 | - $data_keys = array_keys( $data ); |
|
245 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
244 | + $data_keys = array_keys($data); |
|
245 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
246 | 246 | |
247 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
247 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
248 | 248 | return false; |
249 | 249 | } |
250 | 250 | |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return bool |
263 | 263 | */ |
264 | - public function delete( $row_id = 0 ) { |
|
264 | + public function delete($row_id = 0) { |
|
265 | 265 | /* @var WPDB $wpdb */ |
266 | 266 | global $wpdb; |
267 | 267 | |
268 | 268 | // Row ID must be positive integer |
269 | - $row_id = absint( $row_id ); |
|
269 | + $row_id = absint($row_id); |
|
270 | 270 | |
271 | - if ( empty( $row_id ) ) { |
|
271 | + if (empty($row_id)) { |
|
272 | 272 | return false; |
273 | 273 | } |
274 | 274 | |
275 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
275 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return bool If the table name exists. |
291 | 291 | */ |
292 | - public function table_exists( $table ) { |
|
292 | + public function table_exists($table) { |
|
293 | 293 | /* @var WPDB $wpdb */ |
294 | 294 | global $wpdb; |
295 | 295 | |
296 | - $table = sanitize_text_field( $table ); |
|
296 | + $table = sanitize_text_field($table); |
|
297 | 297 | |
298 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
298 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return bool Returns if the customers table was installed and upgrade routine run. |
308 | 308 | */ |
309 | 309 | public function installed() { |
310 | - return $this->table_exists( $this->table_name ); |
|
310 | + return $this->table_exists($this->table_name); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | } |
@@ -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 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | - if ( isset( $_GET['give_action'] ) ) { |
|
28 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
27 | + if (isset($_GET['give_action'])) { |
|
28 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -add_action( 'init', 'give_get_actions' ); |
|
32 | +add_action('init', 'give_get_actions'); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function give_post_actions() { |
44 | - if ( isset( $_POST['give_action'] ) ) { |
|
45 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
44 | + if (isset($_POST['give_action'])) { |
|
45 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -add_action( 'init', 'give_post_actions' ); |
|
49 | +add_action('init', 'give_post_actions'); |
@@ -398,6 +398,7 @@ |
||
398 | 398 | * |
399 | 399 | * @since 1.6 |
400 | 400 | * |
401 | + * @param Give_Payment $payment |
|
401 | 402 | * @return mixed|void |
402 | 403 | */ |
403 | 404 | function get_row_actions( $payment ) { |
@@ -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 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,37 +118,37 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
124 | 124 | 'ajax' => false // Does this table support ajax? |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function advanced_filters() { |
133 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
134 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
135 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
133 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
134 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
135 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
136 | 136 | ?> |
137 | 137 | <div id="give-payment-filters"> |
138 | 138 | <span id="give-payment-date-filters"> |
139 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
139 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
140 | 140 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
141 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
141 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
142 | 142 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
143 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
143 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
144 | 144 | </span> |
145 | - <?php if ( ! empty( $status ) ) : ?> |
|
146 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
145 | + <?php if ( ! empty($status)) : ?> |
|
146 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
147 | 147 | <?php endif; ?> |
148 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
149 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
148 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
149 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
151 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
152 | 152 | </div> |
153 | 153 | |
154 | 154 | <?php |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function search_box( $text, $input_id ) { |
|
169 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
168 | + public function search_box($text, $input_id) { |
|
169 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - $input_id = $input_id . '-search-input'; |
|
173 | + $input_id = $input_id.'-search-input'; |
|
174 | 174 | |
175 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
176 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
175 | + if ( ! empty($_REQUEST['orderby'])) { |
|
176 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
177 | 177 | } |
178 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
179 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
178 | + if ( ! empty($_REQUEST['order'])) { |
|
179 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | <p class="search-box"> |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_payment_history_search' ); |
|
191 | + do_action('give_payment_history_search'); |
|
192 | 192 | ?> |
193 | 193 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
194 | 194 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
195 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
195 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
196 | 196 | </p> |
197 | 197 | <?php |
198 | 198 | } |
@@ -206,52 +206,52 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_views() { |
208 | 208 | |
209 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
210 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
211 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
212 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
213 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
214 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
215 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
216 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
217 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
209 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
210 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
211 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
212 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
213 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
214 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
215 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
216 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
217 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
218 | 218 | |
219 | 219 | $views = array( |
220 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
220 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
221 | 221 | 'status', |
222 | 222 | 'paged' |
223 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
224 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
223 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
224 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
225 | 225 | 'status' => 'publish', |
226 | 226 | 'paged' => false |
227 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
228 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
227 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
228 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
229 | 229 | 'status' => 'pending', |
230 | 230 | 'paged' => false |
231 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
232 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
231 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
232 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
233 | 233 | 'status' => 'refunded', |
234 | 234 | 'paged' => false |
235 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
236 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
235 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
236 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
237 | 237 | 'status' => 'revoked', |
238 | 238 | 'paged' => false |
239 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
240 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
239 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
240 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
241 | 241 | 'status' => 'failed', |
242 | 242 | 'paged' => false |
243 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
244 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
243 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
244 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
245 | 245 | 'status' => 'cancelled', |
246 | 246 | 'paged' => false |
247 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
248 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
247 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
248 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
249 | 249 | 'status' => 'abandoned', |
250 | 250 | 'paged' => false |
251 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
251 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
252 | 252 | ); |
253 | 253 | |
254 | - return apply_filters( 'give_payments_table_views', $views ); |
|
254 | + return apply_filters('give_payments_table_views', $views); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | public function get_columns() { |
265 | 265 | $columns = array( |
266 | 266 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
267 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
268 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
269 | - 'status' => esc_html__( 'Status', 'give' ), |
|
270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
267 | + 'donation' => esc_html__('Donation', 'give'), |
|
268 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
269 | + 'status' => esc_html__('Status', 'give'), |
|
270 | + 'date' => esc_html__('Date', 'give'), |
|
271 | + 'amount' => esc_html__('Amount', 'give'), |
|
272 | + 'details' => esc_html__('Details', 'give'), |
|
273 | 273 | ); |
274 | 274 | |
275 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
275 | + return apply_filters('give_payments_table_columns', $columns); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_sortable_columns() { |
286 | 286 | $columns = array( |
287 | - 'donation' => array( 'ID', true ), |
|
288 | - 'amount' => array( 'amount', false ), |
|
289 | - 'date' => array( 'date', false ) |
|
287 | + 'donation' => array('ID', true), |
|
288 | + 'amount' => array('amount', false), |
|
289 | + 'date' => array('date', false) |
|
290 | 290 | ); |
291 | 291 | |
292 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
292 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -315,59 +315,59 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Column Name |
317 | 317 | */ |
318 | - public function column_default( $payment, $column_name ) { |
|
318 | + public function column_default($payment, $column_name) { |
|
319 | 319 | |
320 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
321 | - $row_actions = $this->get_row_actions( $payment ); |
|
320 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
321 | + $row_actions = $this->get_row_actions($payment); |
|
322 | 322 | |
323 | - switch ( $column_name ) { |
|
323 | + switch ($column_name) { |
|
324 | 324 | case 'donation' : |
325 | 325 | ob_start(); |
326 | 326 | ?> |
327 | - <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e( 'View details', 'give' ) ?>">#<?php echo $payment->ID; ?></a> <?php _e( 'by', 'give' ); ?> <?php echo $this->get_donor( $payment ); ?> |
|
327 | + <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e('View details', 'give') ?>">#<?php echo $payment->ID; ?></a> <?php _e('by', 'give'); ?> <?php echo $this->get_donor($payment); ?> |
|
328 | 328 | <br> |
329 | - <?php echo $this->get_donor_email( $payment ); ?> |
|
330 | - <?php echo $this->row_actions( $row_actions ); ?> |
|
329 | + <?php echo $this->get_donor_email($payment); ?> |
|
330 | + <?php echo $this->row_actions($row_actions); ?> |
|
331 | 331 | <?php |
332 | 332 | $value = ob_get_clean(); |
333 | 333 | break; |
334 | 334 | |
335 | 335 | case 'amount' : |
336 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
337 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
336 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
337 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'donation_form' : |
341 | 341 | |
342 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
343 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
342 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
343 | + $level = give_get_payment_form_title($payment->meta, true); |
|
344 | 344 | |
345 | - if ( ! empty( $level ) ) { |
|
345 | + if ( ! empty($level)) { |
|
346 | 346 | $value .= $level; |
347 | 347 | } |
348 | 348 | |
349 | 349 | break; |
350 | 350 | |
351 | 351 | case 'date' : |
352 | - $date = strtotime( $payment->date ); |
|
353 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
352 | + $date = strtotime($payment->date); |
|
353 | + $value = date_i18n(get_option('date_format'), $date); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'status' : |
357 | - $value = $this->get_payment_status( $payment ); |
|
357 | + $value = $this->get_payment_status($payment); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'details' : |
361 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_donation_url . '" data-tooltip="' . __( 'View details', 'give' ) . '" class="give-payment-details-link button button-small" title="' . __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
361 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_donation_url.'" data-tooltip="'.__('View details', 'give').'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default: |
365 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
365 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
366 | 366 | break; |
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
370 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return string Data shown in the Email column |
382 | 382 | */ |
383 | - public function get_donor_email( $payment ) { |
|
383 | + public function get_donor_email($payment) { |
|
384 | 384 | |
385 | - $email = give_get_payment_user_email( $payment->ID ); |
|
385 | + $email = give_get_payment_user_email($payment->ID); |
|
386 | 386 | |
387 | - if ( empty( $email ) ) { |
|
388 | - $email = esc_html__( '(unknown)', 'give' ); |
|
387 | + if (empty($email)) { |
|
388 | + $email = esc_html__('(unknown)', 'give'); |
|
389 | 389 | } |
390 | 390 | |
391 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
391 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
392 | 392 | |
393 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
393 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return mixed|void |
402 | 402 | */ |
403 | - function get_row_actions( $payment ) { |
|
403 | + function get_row_actions($payment) { |
|
404 | 404 | |
405 | 405 | $row_actions = array(); |
406 | - $email = give_get_payment_user_email( $payment->ID ); |
|
406 | + $email = give_get_payment_user_email($payment->ID); |
|
407 | 407 | |
408 | 408 | // Add search term string back to base URL |
409 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
410 | - if ( ! empty( $search_terms ) ) { |
|
411 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
409 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
410 | + if ( ! empty($search_terms)) { |
|
411 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
412 | 412 | } |
413 | 413 | |
414 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
415 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
414 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
415 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
416 | 416 | 'give-action' => 'email_links', |
417 | 417 | 'purchase_id' => $payment->ID |
418 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
418 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
422 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
423 | 423 | 'give-action' => 'delete_payment', |
424 | 424 | 'purchase_id' => $payment->ID |
425 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
425 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
426 | 426 | |
427 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
427 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return string Data shown in the Email column |
439 | 439 | */ |
440 | - function get_payment_status( $payment ) { |
|
441 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
442 | - if ( $payment->mode == 'test' ) { |
|
443 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
440 | + function get_payment_status($payment) { |
|
441 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
442 | + if ($payment->mode == 'test') { |
|
443 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $value; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string Displays a checkbox |
458 | 458 | */ |
459 | - public function column_cb( $payment ) { |
|
459 | + public function column_cb($payment) { |
|
460 | 460 | return sprintf( |
461 | 461 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
462 | 462 | 'payment', |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string Displays a checkbox |
476 | 476 | */ |
477 | - public function get_payment_id( $payment ) { |
|
478 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
477 | + public function get_payment_id($payment) { |
|
478 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string Data shown in the User column |
490 | 490 | */ |
491 | - public function get_donor( $payment ) { |
|
491 | + public function get_donor($payment) { |
|
492 | 492 | |
493 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
493 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
494 | 494 | |
495 | - if ( ! empty( $customer_id ) ) { |
|
496 | - $customer = new Give_Customer( $customer_id ); |
|
497 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
495 | + if ( ! empty($customer_id)) { |
|
496 | + $customer = new Give_Customer($customer_id); |
|
497 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
498 | 498 | } else { |
499 | - $email = give_get_payment_user_email( $payment->ID ); |
|
500 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
499 | + $email = give_get_payment_user_email($payment->ID); |
|
500 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
501 | 501 | } |
502 | 502 | |
503 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
503 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -512,18 +512,18 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function get_bulk_actions() { |
514 | 514 | $actions = array( |
515 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
516 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
517 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
518 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
519 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
520 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
521 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
522 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
523 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
515 | + 'delete' => esc_html__('Delete', 'give'), |
|
516 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
517 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
518 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
519 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
520 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
521 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
522 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
523 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
524 | 524 | ); |
525 | 525 | |
526 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
526 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function process_bulk_action() { |
537 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
537 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
538 | 538 | $action = $this->current_action(); |
539 | 539 | |
540 | - if ( ! is_array( $ids ) ) { |
|
541 | - $ids = array( $ids ); |
|
540 | + if ( ! is_array($ids)) { |
|
541 | + $ids = array($ids); |
|
542 | 542 | } |
543 | 543 | |
544 | - if ( empty( $action ) ) { |
|
544 | + if (empty($action)) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - foreach ( $ids as $id ) { |
|
548 | + foreach ($ids as $id) { |
|
549 | 549 | |
550 | 550 | // Detect when a bulk action is being triggered... |
551 | - switch ( $this->current_action() ) { |
|
551 | + switch ($this->current_action()) { |
|
552 | 552 | |
553 | 553 | case'delete': |
554 | - give_delete_purchase( $id ); |
|
554 | + give_delete_purchase($id); |
|
555 | 555 | break; |
556 | 556 | |
557 | 557 | case 'set-status-publish': |
558 | - give_update_payment_status( $id, 'publish' ); |
|
558 | + give_update_payment_status($id, 'publish'); |
|
559 | 559 | break; |
560 | 560 | |
561 | 561 | case 'set-status-pending': |
562 | - give_update_payment_status( $id, 'pending' ); |
|
562 | + give_update_payment_status($id, 'pending'); |
|
563 | 563 | break; |
564 | 564 | |
565 | 565 | case 'set-status-refunded': |
566 | - give_update_payment_status( $id, 'refunded' ); |
|
566 | + give_update_payment_status($id, 'refunded'); |
|
567 | 567 | break; |
568 | 568 | case 'set-status-revoked': |
569 | - give_update_payment_status( $id, 'revoked' ); |
|
569 | + give_update_payment_status($id, 'revoked'); |
|
570 | 570 | break; |
571 | 571 | |
572 | 572 | case 'set-status-failed': |
573 | - give_update_payment_status( $id, 'failed' ); |
|
573 | + give_update_payment_status($id, 'failed'); |
|
574 | 574 | break; |
575 | 575 | |
576 | 576 | case 'set-status-cancelled': |
577 | - give_update_payment_status( $id, 'cancelled' ); |
|
577 | + give_update_payment_status($id, 'cancelled'); |
|
578 | 578 | break; |
579 | 579 | |
580 | 580 | case 'set-status-abandoned': |
581 | - give_update_payment_status( $id, 'abandoned' ); |
|
581 | + give_update_payment_status($id, 'abandoned'); |
|
582 | 582 | break; |
583 | 583 | |
584 | 584 | case 'set-status-preapproval': |
585 | - give_update_payment_status( $id, 'preapproval' ); |
|
585 | + give_update_payment_status($id, 'preapproval'); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | case 'resend-receipt': |
589 | - give_email_donation_receipt( $id, false ); |
|
589 | + give_email_donation_receipt($id, false); |
|
590 | 590 | break; |
591 | 591 | } |
592 | 592 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $id The ID of the payment. |
599 | 599 | * @param string $current_action The action that is being triggered. |
600 | 600 | */ |
601 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
601 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | } |
@@ -614,27 +614,27 @@ discard block |
||
614 | 614 | |
615 | 615 | $args = array(); |
616 | 616 | |
617 | - if ( isset( $_GET['user'] ) ) { |
|
618 | - $args['user'] = urldecode( $_GET['user'] ); |
|
619 | - } elseif ( isset( $_GET['s'] ) ) { |
|
620 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
621 | - if ( $is_user ) { |
|
622 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
623 | - unset( $args['s'] ); |
|
617 | + if (isset($_GET['user'])) { |
|
618 | + $args['user'] = urldecode($_GET['user']); |
|
619 | + } elseif (isset($_GET['s'])) { |
|
620 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
621 | + if ($is_user) { |
|
622 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
623 | + unset($args['s']); |
|
624 | 624 | } else { |
625 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
625 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
630 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
629 | + if ( ! empty($_GET['start-date'])) { |
|
630 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
631 | 631 | } |
632 | 632 | |
633 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
634 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
633 | + if ( ! empty($_GET['end-date'])) { |
|
634 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
635 | 635 | } |
636 | 636 | |
637 | - $payment_count = give_count_payments( $args ); |
|
637 | + $payment_count = give_count_payments($args); |
|
638 | 638 | $this->complete_count = $payment_count->publish; |
639 | 639 | $this->pending_count = $payment_count->pending; |
640 | 640 | $this->refunded_count = $payment_count->refunded; |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $this->cancelled_count = $payment_count->cancelled; |
644 | 644 | $this->abandoned_count = $payment_count->abandoned; |
645 | 645 | |
646 | - foreach ( $payment_count as $count ) { |
|
646 | + foreach ($payment_count as $count) { |
|
647 | 647 | $this->total_count += $count; |
648 | 648 | } |
649 | 649 | } |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | public function payments_data() { |
659 | 659 | |
660 | 660 | $per_page = $this->per_page; |
661 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
662 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
663 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
664 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
666 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
667 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
668 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
669 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
670 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
671 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
672 | - |
|
673 | - if ( ! empty( $search ) ) { |
|
661 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
662 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
663 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
664 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
666 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
667 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
668 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
669 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
670 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
671 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
672 | + |
|
673 | + if ( ! empty($search)) { |
|
674 | 674 | $status = 'any'; // Force all payment statuses when searching |
675 | 675 | } |
676 | 676 | |
677 | 677 | $args = array( |
678 | 678 | 'output' => 'payments', |
679 | 679 | 'number' => $per_page, |
680 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
680 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
681 | 681 | 'orderby' => $orderby, |
682 | 682 | 'order' => $order, |
683 | 683 | 'user' => $user, |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | 'end_date' => $end_date, |
692 | 692 | ); |
693 | 693 | |
694 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
694 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
695 | 695 | |
696 | 696 | $args['search_in_notes'] = true; |
697 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
697 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
701 | - $p_query = new Give_Payments_Query( $args ); |
|
701 | + $p_query = new Give_Payments_Query($args); |
|
702 | 702 | |
703 | 703 | return $p_query->get_payments(); |
704 | 704 | |
@@ -718,17 +718,17 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function prepare_items() { |
720 | 720 | |
721 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
721 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
722 | 722 | |
723 | 723 | $columns = $this->get_columns(); |
724 | 724 | $hidden = array(); // No hidden columns |
725 | 725 | $sortable = $this->get_sortable_columns(); |
726 | 726 | $data = $this->payments_data(); |
727 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
727 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
728 | 728 | |
729 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
729 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
730 | 730 | |
731 | - switch ( $status ) { |
|
731 | + switch ($status) { |
|
732 | 732 | case 'publish': |
733 | 733 | $total_items = $this->complete_count; |
734 | 734 | break; |
@@ -755,19 +755,19 @@ discard block |
||
755 | 755 | break; |
756 | 756 | default: |
757 | 757 | // Retrieve the count of the non-default-Give status |
758 | - $count = wp_count_posts( 'give_payment' ); |
|
758 | + $count = wp_count_posts('give_payment'); |
|
759 | 759 | $total_items = $count->{$status}; |
760 | 760 | break; |
761 | 761 | } |
762 | 762 | |
763 | 763 | $this->items = $data; |
764 | 764 | |
765 | - $this->set_pagination_args( array( |
|
765 | + $this->set_pagination_args(array( |
|
766 | 766 | 'total_items' => $total_items, |
767 | 767 | // WE have to calculate the total number of items |
768 | 768 | 'per_page' => $this->per_page, |
769 | 769 | // WE have to determine how many items to show on a page |
770 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
770 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
771 | 771 | // WE have to calculate the total number of pages |
772 | 772 | ) |
773 | 773 | ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | - 'attributes' => array( |
|
78 | + 'attributes' => array( |
|
79 | 79 | 'placeholder' => give_format_decimal( '1.00' ), |
80 | 80 | 'value' => give_format_decimal( $price ), |
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
111 | 111 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | - 'attributes' => array( |
|
113 | + 'attributes' => array( |
|
114 | 114 | 'placeholder' => give_format_decimal( '1.00' ), |
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
@@ -10,11 +10,11 @@ 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 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,327 +48,327 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => esc_html__('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
61 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => esc_html__('Donation Option', 'give'), |
|
61 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
67 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => esc_html__('Set Donation', 'give'), |
|
67 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
72 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => esc_html__('Set Donation', 'give'), |
|
72 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
80 | - 'value' => give_format_decimal( $price ), |
|
79 | + 'placeholder' => give_format_decimal('1.00'), |
|
80 | + 'value' => give_format_decimal($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
95 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
96 | 96 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => esc_html__( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => esc_html__('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => esc_html__('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | 113 | 'attributes' => array( |
114 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
114 | + 'placeholder' => give_format_decimal('1.00'), |
|
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
117 | 117 | 'before' => 'give_format_admin_multilevel_amount', |
118 | 118 | ), |
119 | 119 | array( |
120 | - 'name' => esc_html__( 'Text', 'give' ), |
|
121 | - 'id' => $prefix . 'text', |
|
120 | + 'name' => esc_html__('Text', 'give'), |
|
121 | + 'id' => $prefix.'text', |
|
122 | 122 | 'type' => 'text', |
123 | 123 | 'attributes' => array( |
124 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
124 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
125 | 125 | 'class' => 'give-multilevel-text-field', |
126 | 126 | ), |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Default', 'give' ), |
|
130 | - 'id' => $prefix . 'default', |
|
129 | + 'name' => esc_html__('Default', 'give'), |
|
130 | + 'id' => $prefix.'default', |
|
131 | 131 | 'type' => 'give_default_radio_inline' |
132 | 132 | ), |
133 | - ) ), |
|
133 | + )), |
|
134 | 134 | ), |
135 | 135 | //Display Style |
136 | 136 | array( |
137 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
138 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
139 | - 'id' => $prefix . 'display_style', |
|
137 | + 'name' => esc_html__('Display Style', 'give'), |
|
138 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
139 | + 'id' => $prefix.'display_style', |
|
140 | 140 | 'type' => 'radio_inline', |
141 | 141 | 'default' => 'buttons', |
142 | 142 | 'options' => array( |
143 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
144 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
145 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
143 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
144 | + 'radios' => esc_html__('Radios', 'give'), |
|
145 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
146 | 146 | ), |
147 | 147 | ), |
148 | 148 | //Custom Amount |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
151 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
152 | - 'id' => $prefix . 'custom_amount', |
|
150 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
151 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
152 | + 'id' => $prefix.'custom_amount', |
|
153 | 153 | 'type' => 'radio_inline', |
154 | 154 | 'default' => 'no', |
155 | 155 | 'options' => array( |
156 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
157 | - 'no' => esc_html__( 'No', 'give' ), |
|
156 | + 'yes' => esc_html__('Yes', 'give'), |
|
157 | + 'no' => esc_html__('No', 'give'), |
|
158 | 158 | ), |
159 | 159 | ), |
160 | 160 | array( |
161 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
162 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
163 | - 'id' => $prefix . 'custom_amount_minimum', |
|
161 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
162 | + 'description' => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
163 | + 'id' => $prefix.'custom_amount_minimum', |
|
164 | 164 | 'type' => 'text_small', |
165 | 165 | 'row_classes' => 'give-subfield', |
166 | 166 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
167 | 167 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
168 | 168 | 'attributes' => array( |
169 | 169 | 'placeholder' => give_format_decimal('1.00'), |
170 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
170 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
171 | 171 | 'class' => 'cmb-type-text-small give-money-field', |
172 | 172 | ) |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
176 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
177 | - 'id' => $prefix . 'custom_amount_text', |
|
175 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
176 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
177 | + 'id' => $prefix.'custom_amount_text', |
|
178 | 178 | 'type' => 'text', |
179 | 179 | 'row_classes' => 'give-subfield', |
180 | 180 | 'attributes' => array( |
181 | 181 | 'rows' => 3, |
182 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
182 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
183 | 183 | ), |
184 | 184 | ), |
185 | 185 | //Goals |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
188 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
189 | - 'id' => $prefix . 'goal_option', |
|
187 | + 'name' => esc_html__('Goal', 'give'), |
|
188 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
189 | + 'id' => $prefix.'goal_option', |
|
190 | 190 | 'type' => 'radio_inline', |
191 | 191 | 'default' => 'no', |
192 | 192 | 'options' => array( |
193 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
194 | - 'no' => esc_html__( 'No', 'give' ), |
|
193 | + 'yes' => esc_html__('Yes', 'give'), |
|
194 | + 'no' => esc_html__('No', 'give'), |
|
195 | 195 | ), |
196 | 196 | ), |
197 | 197 | array( |
198 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
199 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
200 | - 'id' => $prefix . 'set_goal', |
|
198 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
199 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
200 | + 'id' => $prefix.'set_goal', |
|
201 | 201 | 'type' => 'text_small', |
202 | 202 | 'row_classes' => 'give-subfield', |
203 | 203 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
204 | 204 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
207 | - 'value' => give_format_decimal( $goal ), |
|
206 | + 'placeholder' => give_format_decimal('0.00'), |
|
207 | + 'value' => give_format_decimal($goal), |
|
208 | 208 | 'class' => 'cmb-type-text-small give-money-field', |
209 | 209 | ), |
210 | 210 | ), |
211 | 211 | |
212 | 212 | array( |
213 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
214 | - 'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
215 | - 'id' => $prefix . 'goal_format', |
|
213 | + 'name' => esc_html__('Goal Format', 'give'), |
|
214 | + 'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
215 | + 'id' => $prefix.'goal_format', |
|
216 | 216 | 'type' => 'radio_inline', |
217 | 217 | 'default' => 'amount', |
218 | 218 | 'row_classes' => 'give-subfield', |
219 | 219 | 'options' => array( |
220 | - 'amount' => esc_html__( 'Amount ', 'give' ), |
|
221 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
220 | + 'amount' => esc_html__('Amount ', 'give'), |
|
221 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
222 | 222 | ), |
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
226 | - 'id' => $prefix . 'goal_color', |
|
225 | + 'name' => esc_html__('Goal Progress Bar Color', 'give'), |
|
226 | + 'id' => $prefix.'goal_color', |
|
227 | 227 | 'type' => 'colorpicker', |
228 | 228 | 'row_classes' => 'give-subfield', |
229 | 229 | 'default' => '#2bc253', |
230 | 230 | ), |
231 | 231 | |
232 | 232 | array( |
233 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
234 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
235 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
233 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
234 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
235 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
236 | 236 | 'type' => 'radio_inline', |
237 | 237 | 'row_classes' => 'give-subfield', |
238 | 238 | 'options' => array( |
239 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
240 | - 'no' => esc_html__( 'No', 'give' ), |
|
239 | + 'yes' => esc_html__('Yes', 'give'), |
|
240 | + 'no' => esc_html__('No', 'give'), |
|
241 | 241 | ), |
242 | 242 | 'default' => 'no', |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
246 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
247 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
245 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
246 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
247 | + 'id' => $prefix.'form_goal_achieved_message', |
|
248 | 248 | 'type' => 'textarea', |
249 | 249 | 'row_classes' => 'give-subfield', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
252 | 252 | ), |
253 | 253 | ) |
254 | 254 | ) |
255 | 255 | ) |
256 | - ) ); |
|
256 | + )); |
|
257 | 257 | |
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Content Field |
261 | 261 | */ |
262 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
262 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
263 | 263 | 'id' => 'form_content_options', |
264 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
265 | - 'object_types' => array( 'give_forms' ), |
|
264 | + 'title' => esc_html__('Form Content', 'give'), |
|
265 | + 'object_types' => array('give_forms'), |
|
266 | 266 | 'context' => 'normal', |
267 | 267 | 'priority' => 'high', //Show above Content WYSIWYG |
268 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
268 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
269 | 269 | //Donation Option |
270 | 270 | array( |
271 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
272 | - 'description' => esc_html__( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
273 | - 'id' => $prefix . 'content_option', |
|
271 | + 'name' => esc_html__('Display Content', 'give'), |
|
272 | + 'description' => esc_html__('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
273 | + 'id' => $prefix.'content_option', |
|
274 | 274 | 'type' => 'select', |
275 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
276 | - 'none' => esc_html__( 'No content', 'give' ), |
|
277 | - 'give_pre_form' => esc_html__( 'Yes, display content ABOVE the form fields', 'give' ), |
|
278 | - 'give_post_form' => esc_html__( 'Yes, display content BELOW the form fields', 'give' ), |
|
275 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
276 | + 'none' => esc_html__('No content', 'give'), |
|
277 | + 'give_pre_form' => esc_html__('Yes, display content ABOVE the form fields', 'give'), |
|
278 | + 'give_post_form' => esc_html__('Yes, display content BELOW the form fields', 'give'), |
|
279 | 279 | ) |
280 | 280 | ), |
281 | 281 | 'default' => 'none', |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => esc_html__( 'Content', 'give' ), |
|
285 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
286 | - 'id' => $prefix . 'form_content', |
|
284 | + 'name' => esc_html__('Content', 'give'), |
|
285 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
286 | + 'id' => $prefix.'form_content', |
|
287 | 287 | 'row_classes' => 'give-subfield', |
288 | 288 | 'type' => 'wysiwyg' |
289 | 289 | ), |
290 | 290 | ) |
291 | 291 | ) |
292 | - ) ); |
|
292 | + )); |
|
293 | 293 | |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Display Options |
297 | 297 | */ |
298 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
298 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
299 | 299 | 'id' => 'form_display_options', |
300 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
301 | - 'object_types' => array( 'give_forms' ), |
|
300 | + 'title' => esc_html__('Form Display Options', 'give'), |
|
301 | + 'object_types' => array('give_forms'), |
|
302 | 302 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
303 | 303 | 'priority' => 'high', //Show above Content WYSIWYG |
304 | 304 | 'show_names' => true, // Show field names on the left |
305 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
305 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
306 | 306 | array( |
307 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
308 | - 'desc' => esc_html__( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
309 | - 'id' => $prefix . 'payment_display', |
|
307 | + 'name' => esc_html__('Payment Fields', 'give'), |
|
308 | + 'desc' => esc_html__('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
309 | + 'id' => $prefix.'payment_display', |
|
310 | 310 | 'type' => 'select', |
311 | 311 | 'options' => array( |
312 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
313 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
314 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
312 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
313 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
314 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
315 | 315 | ), |
316 | 316 | 'default' => 'onpage', |
317 | 317 | ), |
318 | 318 | array( |
319 | - 'id' => $prefix . 'reveal_label', |
|
320 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
321 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
319 | + 'id' => $prefix.'reveal_label', |
|
320 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
321 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'), |
|
322 | 322 | 'type' => 'text_small', |
323 | 323 | 'row_classes' => 'give-subfield', |
324 | 324 | 'attributes' => array( |
325 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
325 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
326 | 326 | ), |
327 | 327 | ), |
328 | 328 | array( |
329 | - 'id' => $prefix . 'checkout_label', |
|
330 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
331 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
329 | + 'id' => $prefix.'checkout_label', |
|
330 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
331 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
332 | 332 | 'type' => 'text_small', |
333 | 333 | 'attributes' => array( |
334 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
334 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
335 | 335 | ), |
336 | 336 | ), |
337 | 337 | array( |
338 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
339 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
340 | - 'id' => $prefix . 'default_gateway', |
|
338 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
339 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
340 | + 'id' => $prefix.'default_gateway', |
|
341 | 341 | 'type' => 'default_gateway' |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
345 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
345 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'checkbox' |
348 | 348 | ), |
349 | 349 | array( |
350 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
351 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
352 | - 'id' => $prefix . 'show_register_form', |
|
350 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
351 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
352 | + 'id' => $prefix.'show_register_form', |
|
353 | 353 | 'type' => 'select', |
354 | 354 | 'options' => array( |
355 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
356 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
357 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
358 | - 'none' => esc_html__( 'None', 'give' ), |
|
355 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
356 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
357 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
358 | + 'none' => esc_html__('None', 'give'), |
|
359 | 359 | ), |
360 | 360 | 'default' => 'none', |
361 | 361 | ), |
362 | 362 | array( |
363 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
363 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
364 | 364 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
365 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
366 | - 'id' => $prefix . 'form_floating_labels', |
|
365 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
366 | + 'id' => $prefix.'form_floating_labels', |
|
367 | 367 | 'type' => 'select', |
368 | 368 | 'options' => array( |
369 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
370 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
371 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
369 | + '' => esc_html__('Use the global setting', 'give'), |
|
370 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
371 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
372 | 372 | ), |
373 | 373 | 'default' => 'none', |
374 | 374 | ) |
@@ -380,47 +380,47 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Terms & Conditions |
382 | 382 | */ |
383 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
383 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
384 | 384 | 'id' => 'form_terms_options', |
385 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
386 | - 'object_types' => array( 'give_forms' ), |
|
385 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
386 | + 'object_types' => array('give_forms'), |
|
387 | 387 | 'context' => 'normal', |
388 | 388 | 'priority' => 'high', //Show above Content WYSIWYG |
389 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
389 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
390 | 390 | //Donation Option |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
393 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
394 | - 'id' => $prefix . 'terms_option', |
|
392 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
393 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
394 | + 'id' => $prefix.'terms_option', |
|
395 | 395 | 'type' => 'select', |
396 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
397 | - 'none' => esc_html__( 'No', 'give' ), |
|
398 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
396 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
397 | + 'none' => esc_html__('No', 'give'), |
|
398 | + 'yes' => esc_html__('Yes', 'give'), |
|
399 | 399 | ) |
400 | 400 | ), |
401 | 401 | 'default' => 'none', |
402 | 402 | ), |
403 | 403 | array( |
404 | - 'id' => $prefix . 'agree_label', |
|
405 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
406 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
404 | + 'id' => $prefix.'agree_label', |
|
405 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
406 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
407 | 407 | 'type' => 'text', |
408 | 408 | 'row_classes' => 'give-subfield', |
409 | 409 | 'size' => 'regular', |
410 | 410 | 'attributes' => array( |
411 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
411 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
412 | 412 | ), |
413 | 413 | ), |
414 | 414 | array( |
415 | - 'id' => $prefix . 'agree_text', |
|
415 | + 'id' => $prefix.'agree_text', |
|
416 | 416 | 'row_classes' => 'give-subfield', |
417 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
418 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
417 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
418 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
419 | 419 | 'type' => 'wysiwyg' |
420 | 420 | ), |
421 | 421 | ) |
422 | 422 | ) |
423 | - ) ); |
|
423 | + )); |
|
424 | 424 | |
425 | 425 | return $meta_boxes; |
426 | 426 | |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | |
435 | 435 | <div class="table-container"> |
436 | 436 | <div class="table-row"> |
437 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
438 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
439 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
437 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
438 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
439 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
440 | 440 | <?php |
441 | 441 | /** |
442 | 442 | * Fires in repeatable donation levels table head. |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @since 1.0 |
450 | 450 | */ |
451 | - do_action( 'give_donation_levels_table_head' ); |
|
451 | + do_action('give_donation_levels_table_head'); |
|
452 | 452 | ?> |
453 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
453 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
454 | 454 | |
455 | 455 | </div> |
456 | 456 | </div> |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | <?php |
459 | 459 | } |
460 | 460 | |
461 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
461 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
462 | 462 | |
463 | 463 | |
464 | 464 | /** |
@@ -475,25 +475,25 @@ discard block |
||
475 | 475 | * @param $object_type |
476 | 476 | * @param $field_type_object |
477 | 477 | */ |
478 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
478 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
479 | 479 | |
480 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
480 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
481 | 481 | |
482 | 482 | $field_options_array = array( |
483 | 483 | 'class' => 'give-hidden give-level-id-input', |
484 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
485 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
484 | + 'name' => $field_type_object->_name('[level_id]'), |
|
485 | + 'id' => $field_type_object->_id('_level_id'), |
|
486 | 486 | 'value' => $escaped_value, |
487 | 487 | 'type' => 'number', |
488 | 488 | 'desc' => '', |
489 | 489 | ); |
490 | 490 | |
491 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
492 | - echo $field_type_object->input( $field_options_array ); |
|
491 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
492 | + echo $field_type_object->input($field_options_array); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
496 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
497 | 497 | |
498 | 498 | |
499 | 499 | /** |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | * @param $object_type |
506 | 506 | * @param $field_type_object |
507 | 507 | */ |
508 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
509 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
510 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
508 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
509 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
510 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
511 | 511 | |
512 | 512 | } |
513 | 513 | |
514 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
514 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
515 | 515 | |
516 | 516 | |
517 | 517 | /** |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | */ |
522 | 522 | function give_add_shortcode_to_publish_metabox() { |
523 | 523 | |
524 | - if ( 'give_forms' !== get_post_type() ) { |
|
524 | + if ('give_forms' !== get_post_type()) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | |
528 | 528 | global $post; |
529 | 529 | |
530 | 530 | //Only enqueue scripts for CPT on post type screen |
531 | - if ( 'give_forms' === $post->post_type ) { |
|
531 | + if ('give_forms' === $post->post_type) { |
|
532 | 532 | //Shortcode column with select all input |
533 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
534 | - echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
533 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
534 | + echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
540 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,56 +40,56 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | 60 | /* translators: %s: form settings url */ |
61 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
62 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
61 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
62 | + echo wpautop(stripslashes($offline_instructions)); |
|
63 | 63 | ?> |
64 | 64 | </fieldset> |
65 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
65 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
66 | 66 | <?php |
67 | 67 | echo ob_get_clean(); |
68 | 68 | } |
69 | 69 | |
70 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
70 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Give Offline Billing Field |
74 | 74 | * |
75 | 75 | * @param $form_id |
76 | 76 | */ |
77 | -function give_offline_billing_fields( $form_id ) { |
|
77 | +function give_offline_billing_fields($form_id) { |
|
78 | 78 | //Enable Default CC fields (billing info) |
79 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
80 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
79 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
80 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
81 | 81 | |
82 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
82 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
83 | 83 | |
84 | 84 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
85 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
86 | - give_default_cc_address_fields( $form_id ); |
|
87 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | - give_default_cc_address_fields( $form_id ); |
|
85 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
86 | + give_default_cc_address_fields($form_id); |
|
87 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | + give_default_cc_address_fields($form_id); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
92 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Process the payment |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return void |
102 | 102 | */ |
103 | -function give_offline_process_payment( $purchase_data ) { |
|
103 | +function give_offline_process_payment($purchase_data) { |
|
104 | 104 | |
105 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
105 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
106 | 106 | |
107 | 107 | // setup the payment details |
108 | 108 | $payment_data = array( |
109 | 109 | 'price' => $purchase_data['price'], |
110 | 110 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
111 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
112 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
111 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
112 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
113 | 113 | 'date' => $purchase_data['date'], |
114 | 114 | 'user_email' => $purchase_data['user_email'], |
115 | 115 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // record the pending payment |
124 | - $payment = give_insert_payment( $payment_data ); |
|
124 | + $payment = give_insert_payment($payment_data); |
|
125 | 125 | |
126 | - if ( $payment ) { |
|
127 | - give_offline_send_admin_notice( $payment ); |
|
128 | - give_offline_send_donor_instructions( $payment ); |
|
126 | + if ($payment) { |
|
127 | + give_offline_send_admin_notice($payment); |
|
128 | + give_offline_send_donor_instructions($payment); |
|
129 | 129 | give_send_to_success_page(); |
130 | 130 | } else { |
131 | 131 | // if errors are present, send the user back to the donation form so they can be corrected |
132 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
132 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
137 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,47 +147,47 @@ discard block |
||
147 | 147 | * @since 1.0 |
148 | 148 | * @return void |
149 | 149 | */ |
150 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
150 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
151 | 151 | |
152 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
153 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
152 | + $payment_data = give_get_payment_meta($payment_id); |
|
153 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
154 | 154 | |
155 | 155 | //Customize email content depending on whether the single form has been customized |
156 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
156 | + $email_content = give_get_option('global_offline_donation_email'); |
|
157 | 157 | |
158 | - if ( $post_offline_customization_option === 'yes' ) { |
|
159 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
158 | + if ($post_offline_customization_option === 'yes') { |
|
159 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
160 | 160 | } |
161 | 161 | |
162 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
163 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
162 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
163 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
164 | 164 | |
165 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
166 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
165 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
166 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
167 | 167 | |
168 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
168 | + $to_email = give_get_payment_user_email($payment_id); |
|
169 | 169 | |
170 | - $subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
171 | - if ( $post_offline_customization_option === 'yes' ) { |
|
172 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
170 | + $subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give')); |
|
171 | + if ($post_offline_customization_option === 'yes') { |
|
172 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
173 | 173 | } |
174 | 174 | |
175 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
176 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
175 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
176 | + $subject = give_do_email_tags($subject, $payment_id); |
|
177 | 177 | |
178 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
179 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
178 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
179 | + $message = give_do_email_tags($email_content, $payment_id); |
|
180 | 180 | |
181 | 181 | $emails = Give()->emails; |
182 | 182 | |
183 | - $emails->__set( 'from_name', $from_name ); |
|
184 | - $emails->__set( 'from_email', $from_email ); |
|
185 | - $emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
183 | + $emails->__set('from_name', $from_name); |
|
184 | + $emails->__set('from_email', $from_email); |
|
185 | + $emails->__set('heading', esc_html__('Offline Donation Instructions', 'give')); |
|
186 | 186 | |
187 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
188 | - $emails->__set( 'headers', $headers ); |
|
187 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
188 | + $emails->__set('headers', $headers); |
|
189 | 189 | |
190 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
190 | + $emails->send($to_email, $subject, $message, $attachments); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -204,52 +204,52 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | * |
206 | 206 | */ |
207 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
207 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
208 | 208 | |
209 | 209 | /* Send an email notification to the admin */ |
210 | 210 | $admin_email = give_get_admin_notice_emails(); |
211 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
211 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
212 | 212 | |
213 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
214 | - $user_data = get_userdata( $user_info['id'] ); |
|
213 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
214 | + $user_data = get_userdata($user_info['id']); |
|
215 | 215 | $name = $user_data->display_name; |
216 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
217 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
216 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
217 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
218 | 218 | } else { |
219 | 219 | $name = $user_info['email']; |
220 | 220 | } |
221 | 221 | |
222 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
222 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
223 | 223 | |
224 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
224 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
225 | 225 | |
226 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
227 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
228 | - $admin_message .= esc_attr__( '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"; |
|
226 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
227 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
228 | + $admin_message .= esc_attr__('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"; |
|
229 | 229 | |
230 | 230 | |
231 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . '{fullname}' . "\n"; |
|
232 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . '{price}' . "\n\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.'{fullname}'."\n"; |
|
232 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.'{price}'."\n\n"; |
|
233 | 233 | |
234 | 234 | $admin_message .= sprintf( |
235 | 235 | '<a href="%1$s">%2$s</a>', |
236 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
237 | - esc_html__( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
238 | - ) . "\n\n"; |
|
236 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
237 | + esc_html__('Click Here to View and/or Update Donation Details', 'give') |
|
238 | + )."\n\n"; |
|
239 | 239 | |
240 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
241 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
240 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
241 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
242 | 242 | |
243 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
244 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
243 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
244 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
245 | 245 | |
246 | 246 | //Send Email |
247 | 247 | $emails = Give()->emails; |
248 | - if ( ! empty( $admin_headers ) ) { |
|
249 | - $emails->__set( 'headers', $admin_headers ); |
|
248 | + if ( ! empty($admin_headers)) { |
|
249 | + $emails->__set('headers', $admin_headers); |
|
250 | 250 | } |
251 | 251 | |
252 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
252 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | * @since 1.0 |
261 | 261 | * @return array |
262 | 262 | */ |
263 | -function give_offline_add_settings( $settings ) { |
|
263 | +function give_offline_add_settings($settings) { |
|
264 | 264 | |
265 | 265 | //Vars |
266 | 266 | $prefix = '_give_'; |
267 | 267 | |
268 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
268 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
269 | 269 | |
270 | 270 | //this gateway isn't active |
271 | - if ( ! $is_gateway_active ) { |
|
271 | + if ( ! $is_gateway_active) { |
|
272 | 272 | //return settings and bounce |
273 | 273 | return $settings; |
274 | 274 | } |
@@ -277,27 +277,27 @@ discard block |
||
277 | 277 | $check_settings = array( |
278 | 278 | |
279 | 279 | array( |
280 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
281 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
282 | - 'id' => $prefix . 'customize_offline_donations', |
|
280 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
281 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
282 | + 'id' => $prefix.'customize_offline_donations', |
|
283 | 283 | 'type' => 'radio_inline', |
284 | 284 | 'default' => 'no', |
285 | 285 | 'options' => array( |
286 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
287 | - 'no' => esc_attr__( 'No', 'give' ), |
|
286 | + 'yes' => esc_attr__('Yes', 'give'), |
|
287 | + 'no' => esc_attr__('No', 'give'), |
|
288 | 288 | ), |
289 | 289 | ), |
290 | 290 | array( |
291 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
292 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
293 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
291 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
292 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
293 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
294 | 294 | 'row_classes' => 'give-subfield', |
295 | 295 | 'type' => 'checkbox' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'id' => $prefix . 'offline_checkout_notes', |
|
299 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
300 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
298 | + 'id' => $prefix.'offline_checkout_notes', |
|
299 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
300 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
301 | 301 | 'default' => give_get_default_offline_donation_content(), |
302 | 302 | 'type' => 'wysiwyg', |
303 | 303 | 'row_classes' => 'give-subfield', |
@@ -306,17 +306,17 @@ discard block |
||
306 | 306 | ) |
307 | 307 | ), |
308 | 308 | array( |
309 | - 'id' => $prefix . 'offline_donation_subject', |
|
310 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
311 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
312 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
309 | + 'id' => $prefix.'offline_donation_subject', |
|
310 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
311 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
312 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
313 | 313 | 'row_classes' => 'give-subfield', |
314 | 314 | 'type' => 'text' |
315 | 315 | ), |
316 | 316 | array( |
317 | - 'id' => $prefix . 'offline_donation_email', |
|
318 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
319 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
317 | + 'id' => $prefix.'offline_donation_email', |
|
318 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
319 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
320 | 320 | 'default' => give_get_default_offline_donation_email_content(), |
321 | 321 | 'type' => 'wysiwyg', |
322 | 322 | 'row_classes' => 'give-subfield', |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | |
329 | - return array_merge( $settings, $check_settings ); |
|
329 | + return array_merge($settings, $check_settings); |
|
330 | 330 | } |
331 | 331 | |
332 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
332 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -341,32 +341,32 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function give_get_default_offline_donation_content() { |
343 | 343 | |
344 | - $sitename = get_bloginfo( 'sitename' ); |
|
344 | + $sitename = get_bloginfo('sitename'); |
|
345 | 345 | |
346 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
346 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
347 | 347 | $default_text .= '<ol>'; |
348 | 348 | $default_text .= '<li>'; |
349 | 349 | $default_text .= sprintf( |
350 | 350 | /* translators: %s: site name */ |
351 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
351 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
352 | 352 | $sitename |
353 | 353 | ); |
354 | 354 | $default_text .= '</li>'; |
355 | 355 | $default_text .= '<li>'; |
356 | 356 | $default_text .= sprintf( |
357 | 357 | /* translators: %s: site name */ |
358 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
358 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
359 | 359 | $sitename |
360 | 360 | ); |
361 | 361 | $default_text .= '</li>'; |
362 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
362 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
363 | 363 | $default_text .= '</ol>'; |
364 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
364 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
365 | 365 | $default_text .= ' <em>123 G Street </em><br>'; |
366 | 366 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
367 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
367 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
368 | 368 | |
369 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
369 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_email_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
383 | - $default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>'; |
|
384 | - $default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | + $default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>'; |
|
384 | + $default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
389 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>123 G Street </em><br>'; |
404 | 404 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
405 | - $default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
406 | - $default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>'; |
|
407 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
405 | + $default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
406 | + $default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>'; |
|
407 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
408 | 408 | |
409 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
409 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
410 | 410 | |
411 | 411 | } |