@@ -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 | } |
@@ -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,17 +24,17 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => esc_html__( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => esc_html__( 'PayPal', 'give' ), |
|
29 | - 'supports' => array( 'buy_now' ) |
|
27 | + 'admin_label' => esc_html__('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => esc_html__('PayPal', 'give'), |
|
29 | + 'supports' => array('buy_now') |
|
30 | 30 | ), |
31 | 31 | 'manual' => array( |
32 | - 'admin_label' => esc_html__( 'Test Payment', 'give' ), |
|
33 | - 'checkout_label' => esc_html__( 'Test Payment', 'give' ) |
|
32 | + 'admin_label' => esc_html__('Test Payment', 'give'), |
|
33 | + 'checkout_label' => esc_html__('Test Payment', 'give') |
|
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
37 | + return apply_filters('give_payment_gateways', $gateways); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | |
49 | 49 | $gateways = give_get_payment_gateways(); |
50 | 50 | |
51 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
51 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
52 | 52 | |
53 | 53 | $gateway_list = array(); |
54 | 54 | |
55 | - foreach ( $gateways as $key => $gateway ) { |
|
56 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
57 | - $gateway_list[ $key ] = $gateway; |
|
55 | + foreach ($gateways as $key => $gateway) { |
|
56 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
57 | + $gateway_list[$key] = $gateway; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Set order of payment gateway in list. |
62 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
62 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
63 | 63 | |
64 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list ); |
|
64 | + return apply_filters('give_enabled_payment_gateways', $gateway_list); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return boolean true if enabled, false otherwise |
75 | 75 | */ |
76 | -function give_is_gateway_active( $gateway ) { |
|
76 | +function give_is_gateway_active($gateway) { |
|
77 | 77 | $gateways = give_get_enabled_payment_gateways(); |
78 | 78 | |
79 | - $ret = array_key_exists( $gateway, $gateways ); |
|
79 | + $ret = array_key_exists($gateway, $gateways); |
|
80 | 80 | |
81 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
81 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -91,24 +91,24 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return string Gateway ID |
93 | 93 | */ |
94 | -function give_get_default_gateway( $form_id ) { |
|
94 | +function give_get_default_gateway($form_id) { |
|
95 | 95 | |
96 | 96 | global $give_options; |
97 | 97 | |
98 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | - $form_default = get_post_meta( $form_id, '_give_default_gateway', true ); |
|
98 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | + $form_default = get_post_meta($form_id, '_give_default_gateway', true); |
|
100 | 100 | |
101 | 101 | //Single Form settings varies compared to the Global default settings |
102 | - if ( ! empty( $form_default ) && |
|
102 | + if ( ! empty($form_default) && |
|
103 | 103 | $form_id !== null && |
104 | 104 | $default !== $form_default && |
105 | 105 | $form_default !== 'global' && |
106 | - give_is_gateway_active( $form_default ) |
|
106 | + give_is_gateway_active($form_default) |
|
107 | 107 | ) { |
108 | 108 | $default = $form_default; |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_default_gateway', $default ); |
|
111 | + return apply_filters('give_default_gateway', $default); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string Gateway admin label |
122 | 122 | */ |
123 | -function give_get_gateway_admin_label( $gateway ) { |
|
123 | +function give_get_gateway_admin_label($gateway) { |
|
124 | 124 | $gateways = give_get_enabled_payment_gateways(); |
125 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
126 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
125 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
126 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
127 | 127 | |
128 | - if ( $gateway == 'manual' && $payment ) { |
|
129 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
130 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
128 | + if ($gateway == 'manual' && $payment) { |
|
129 | + if (give_get_payment_amount($payment) == 0) { |
|
130 | + $label = esc_html__('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
134 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string Checkout label for the gateway |
145 | 145 | */ |
146 | -function give_get_gateway_checkout_label( $gateway ) { |
|
146 | +function give_get_gateway_checkout_label($gateway) { |
|
147 | 147 | $gateways = give_get_enabled_payment_gateways(); |
148 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
148 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
149 | 149 | |
150 | - if ( $gateway == 'manual' ) { |
|
151 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
150 | + if ($gateway == 'manual') { |
|
151 | + $label = esc_html__('Test Donation', 'give'); |
|
152 | 152 | } |
153 | 153 | |
154 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
154 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array Options the gateway supports |
165 | 165 | */ |
166 | -function give_get_gateway_supports( $gateway ) { |
|
166 | +function give_get_gateway_supports($gateway) { |
|
167 | 167 | $gateways = give_get_enabled_payment_gateways(); |
168 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
168 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
169 | 169 | |
170 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
170 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return bool |
181 | 181 | */ |
182 | -function give_gateway_supports_buy_now( $gateway ) { |
|
183 | - $supports = give_get_gateway_supports( $gateway ); |
|
184 | - $ret = in_array( 'buy_now', $supports ); |
|
182 | +function give_gateway_supports_buy_now($gateway) { |
|
183 | + $supports = give_get_gateway_supports($gateway); |
|
184 | + $ret = in_array('buy_now', $supports); |
|
185 | 185 | |
186 | - return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway ); |
|
186 | + return apply_filters('give_gateway_supports_buy_now', $ret, $gateway); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | $gateways = give_get_enabled_payment_gateways(); |
197 | 197 | $ret = false; |
198 | 198 | |
199 | - if ( $gateways ) { |
|
200 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
201 | - if ( give_gateway_supports_buy_now( $gateway_id ) ) { |
|
199 | + if ($gateways) { |
|
200 | + foreach ($gateways as $gateway_id => $gateway) { |
|
201 | + if (give_gateway_supports_buy_now($gateway_id)) { |
|
202 | 202 | $ret = true; |
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_give_supports_buy_now', $ret ); |
|
208 | + return apply_filters('give_give_supports_buy_now', $ret); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return void |
220 | 220 | */ |
221 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
221 | +function give_send_to_gateway($gateway, $payment_data) { |
|
222 | 222 | |
223 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
223 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
224 | 224 | |
225 | 225 | // $gateway must match the ID used when registering the gateway |
226 | - do_action( 'give_gateway_' . $gateway, $payment_data ); |
|
226 | + do_action('give_gateway_'.$gateway, $payment_data); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -240,32 +240,32 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return string $enabled_gateway The slug of the gateway |
242 | 242 | */ |
243 | -function give_get_chosen_gateway( $form_id ) { |
|
243 | +function give_get_chosen_gateway($form_id) { |
|
244 | 244 | $gateways = give_get_enabled_payment_gateways(); |
245 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
246 | - if ( empty( $request_form_id ) ) { |
|
247 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
245 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
246 | + if (empty($request_form_id)) { |
|
247 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
248 | 248 | } |
249 | - $chosen = give_get_default_gateway( $form_id ); |
|
249 | + $chosen = give_get_default_gateway($form_id); |
|
250 | 250 | $enabled_gateway = ''; |
251 | 251 | |
252 | 252 | //Take into account request Form ID args |
253 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
254 | - $chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
253 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
254 | + $chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( $chosen ) { |
|
258 | - $enabled_gateway = urldecode( $chosen ); |
|
259 | - } else if ( count( $gateways ) >= 1 && ! $chosen ) { |
|
260 | - foreach ( $gateways as $gateway_id => $gateway ): |
|
257 | + if ($chosen) { |
|
258 | + $enabled_gateway = urldecode($chosen); |
|
259 | + } else if (count($gateways) >= 1 && ! $chosen) { |
|
260 | + foreach ($gateways as $gateway_id => $gateway): |
|
261 | 261 | $enabled_gateway = $gateway_id; |
262 | 262 | endforeach; |
263 | 263 | } else { |
264 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
264 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
268 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return int ID of the new log entry |
284 | 284 | */ |
285 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
286 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
285 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
286 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return int |
298 | 298 | */ |
299 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
299 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
300 | 300 | |
301 | 301 | $ret = 0; |
302 | 302 | $args = array( |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | 'fields' => 'ids' |
309 | 309 | ); |
310 | 310 | |
311 | - $payments = new WP_Query( $args ); |
|
311 | + $payments = new WP_Query($args); |
|
312 | 312 | |
313 | - if ( $payments ) { |
|
313 | + if ($payments) { |
|
314 | 314 | $ret = $payments->post_count; |
315 | 315 | } |
316 | 316 | |
@@ -327,27 +327,27 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return array $gateways All the available gateways |
329 | 329 | */ |
330 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
330 | +function give_get_ordered_payment_gateways($gateways) { |
|
331 | 331 | |
332 | 332 | // Get gateways setting. |
333 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
333 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
334 | 334 | |
335 | 335 | // Return from here if we do not have gateways setting. |
336 | - if ( empty( $gateways_setting ) ) { |
|
336 | + if (empty($gateways_setting)) { |
|
337 | 337 | return $gateways; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Reverse array to order payment gateways. |
341 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
341 | + $gateways_setting = array_reverse($gateways_setting); |
|
342 | 342 | |
343 | 343 | // Reorder gateways array |
344 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
344 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
345 | 345 | |
346 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
347 | - unset( $gateways[ $gateway_key ] ); |
|
346 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
347 | + unset($gateways[$gateway_key]); |
|
348 | 348 | |
349 | - if ( ! empty( $new_gateway_value ) ) { |
|
350 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
349 | + if ( ! empty($new_gateway_value)) { |
|
350 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
@@ -358,5 +358,5 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $gateways All the available gateways |
360 | 360 | */ |
361 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
361 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
362 | 362 | } |
@@ -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,7 +23,7 @@ discard block |
||
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | 25 | function give_get_price_decimals() { |
26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
26 | + return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0)); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | 36 | function give_get_price_thousand_separator() { |
37 | - return give_get_option( 'thousands_separator', ',' ); |
|
37 | + return give_get_option('thousands_separator', ','); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | 47 | function give_get_price_decimal_separator() { |
48 | - return give_get_option( 'decimal_separator', '.' ); |
|
48 | + return give_get_option('decimal_separator', '.'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -62,67 +62,67 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string $amount Newly sanitized amount |
64 | 64 | */ |
65 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
65 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
66 | 66 | |
67 | 67 | // Bailout. |
68 | - if( empty( $number ) ) { |
|
68 | + if (empty($number)) { |
|
69 | 69 | return $number; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Remove slash from amount. |
73 | 73 | // If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number. |
74 | 74 | // To prevent notices and warning remove slash from amount/number. |
75 | - $number = wp_unslash( $number ); |
|
75 | + $number = wp_unslash($number); |
|
76 | 76 | |
77 | 77 | $thousand_separator = give_get_price_thousand_separator(); |
78 | 78 | |
79 | 79 | $locale = localeconv(); |
80 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
80 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
81 | 81 | |
82 | 82 | // Remove locale from string |
83 | - if ( ! is_float( $number ) ) { |
|
84 | - $number = str_replace( $decimals, '.', $number ); |
|
83 | + if ( ! is_float($number)) { |
|
84 | + $number = str_replace($decimals, '.', $number); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // Remove thousand amount formatting if amount has. |
88 | 88 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
89 | 89 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
90 | - if( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
91 | - $number = str_replace( $thousand_separator, '', $number ); |
|
92 | - } elseif ( in_array( $thousand_separator, $decimals ) ) { |
|
93 | - $number = preg_replace( '/\.(?=.*\.)/', '', $number ); |
|
90 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
91 | + $number = str_replace($thousand_separator, '', $number); |
|
92 | + } elseif (in_array($thousand_separator, $decimals)) { |
|
93 | + $number = preg_replace('/\.(?=.*\.)/', '', $number); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // Remove non numeric entity before decimal separator. |
97 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
97 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
98 | 98 | $default_dp = give_get_price_decimals(); |
99 | 99 | |
100 | 100 | // Format number of decimals in number. |
101 | - if( false !== $dp ) { |
|
102 | - $dp = intval( empty( $dp ) ? $default_dp : $dp ); |
|
103 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
104 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
101 | + if (false !== $dp) { |
|
102 | + $dp = intval(empty($dp) ? $default_dp : $dp); |
|
103 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
104 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Reset negative amount to zero. |
108 | - if ( 0 > $number ) { |
|
109 | - $number = number_format( 0, $default_dp, '.' ); |
|
108 | + if (0 > $number) { |
|
109 | + $number = number_format(0, $default_dp, '.'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // If number does not have decimal then add number of decimals to it. |
113 | - if( |
|
114 | - false === strpos( $number, '.' ) |
|
115 | - || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) ) |
|
113 | + if ( |
|
114 | + false === strpos($number, '.') |
|
115 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
116 | 116 | ) { |
117 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
117 | + $number = number_format($number, $default_dp, '.', ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Trim zeros. |
121 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
122 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
121 | + if ($trim_zeros && strstr($number, '.')) { |
|
122 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
123 | 123 | } |
124 | 124 | |
125 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
125 | + return apply_filters('give_sanitize_amount', $number); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,22 +135,22 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string $amount Newly formatted amount or Price Not Available |
137 | 137 | */ |
138 | -function give_format_amount( $amount, $decimals = true ) { |
|
139 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
140 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
138 | +function give_format_amount($amount, $decimals = true) { |
|
139 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
140 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
141 | 141 | |
142 | - if ( empty( $amount ) ) { |
|
142 | + if (empty($amount)) { |
|
143 | 143 | $amount = 0; |
144 | 144 | } else { |
145 | 145 | // Sanitize amount before formatting. |
146 | - $amount = give_sanitize_amount( $amount ); |
|
146 | + $amount = give_sanitize_amount($amount); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $decimals = give_get_price_decimals(); |
150 | 150 | |
151 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
151 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
152 | 152 | |
153 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
153 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -166,33 +166,33 @@ discard block |
||
166 | 166 | * @param string $amount formatted amount number. |
167 | 167 | * @return float|string formatted amount number with large number names. |
168 | 168 | */ |
169 | -function give_human_format_large_amount( $amount ) { |
|
169 | +function give_human_format_large_amount($amount) { |
|
170 | 170 | |
171 | 171 | // Get thousand separator. |
172 | 172 | $thousands_sep = give_get_price_thousand_separator(); |
173 | 173 | |
174 | 174 | // Sanitize amount. |
175 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
175 | + $sanitize_amount = give_sanitize_amount($amount); |
|
176 | 176 | |
177 | 177 | // Explode amount to calculate name of large numbers. |
178 | - $amount_array = explode( $thousands_sep, $amount ); |
|
178 | + $amount_array = explode($thousands_sep, $amount); |
|
179 | 179 | |
180 | 180 | // Calculate amount parts count. |
181 | - $amount_count_parts = count( $amount_array ); |
|
181 | + $amount_count_parts = count($amount_array); |
|
182 | 182 | |
183 | 183 | // Human format amount (default). |
184 | 184 | $human_format_amount = $amount; |
185 | 185 | |
186 | 186 | // Calculate large number formatted amount. |
187 | - if ( 4 < $amount_count_parts ){ |
|
188 | - $human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
189 | - } elseif ( 3 < $amount_count_parts ){ |
|
190 | - $human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 )); |
|
191 | - } elseif ( 2 < $amount_count_parts ) { |
|
192 | - $human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) ); |
|
187 | + if (4 < $amount_count_parts) { |
|
188 | + $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
189 | + } elseif (3 < $amount_count_parts) { |
|
190 | + $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
191 | + } elseif (2 < $amount_count_parts) { |
|
192 | + $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
193 | 193 | } |
194 | 194 | |
195 | - return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount ); |
|
195 | + return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $amount Newly formatted amount or Price Not Available |
207 | 207 | */ |
208 | -function give_format_decimal( $amount, $dp = false ){ |
|
208 | +function give_format_decimal($amount, $dp = false) { |
|
209 | 209 | $decimal_separator = give_get_price_decimal_separator(); |
210 | - $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
210 | + $formatted_amount = give_sanitize_amount($amount, $dp); |
|
211 | 211 | |
212 | - if( false !== strpos( $formatted_amount, '.' ) ) { |
|
213 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
212 | + if (false !== strpos($formatted_amount, '.')) { |
|
213 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
214 | 214 | } |
215 | 215 | |
216 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
216 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return bool |
229 | 229 | */ |
230 | -function give_format_admin_multilevel_amount( $field_args, $field ) { |
|
230 | +function give_format_admin_multilevel_amount($field_args, $field) { |
|
231 | 231 | |
232 | - if ( empty( $field->value ) ) { |
|
232 | + if (empty($field->value)) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | - $field->value = give_format_decimal( $field->value ); |
|
236 | + $field->value = give_format_decimal($field->value); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -246,24 +246,24 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @return mixed|string|void |
248 | 248 | */ |
249 | -function give_currency_filter( $price = '', $currency = '' ) { |
|
249 | +function give_currency_filter($price = '', $currency = '') { |
|
250 | 250 | |
251 | - if ( empty( $currency ) ) { |
|
251 | + if (empty($currency)) { |
|
252 | 252 | $currency = give_get_currency(); |
253 | 253 | } |
254 | 254 | |
255 | - $position = give_get_option( 'currency_position', 'before' ); |
|
255 | + $position = give_get_option('currency_position', 'before'); |
|
256 | 256 | |
257 | 257 | $negative = $price < 0; |
258 | 258 | |
259 | - if ( $negative ) { |
|
259 | + if ($negative) { |
|
260 | 260 | // Remove proceeding "-". |
261 | - $price = substr( $price, 1 ); |
|
261 | + $price = substr($price, 1); |
|
262 | 262 | } |
263 | 263 | |
264 | - $symbol = give_currency_symbol( $currency ); |
|
264 | + $symbol = give_currency_symbol($currency); |
|
265 | 265 | |
266 | - switch ( $currency ): |
|
266 | + switch ($currency): |
|
267 | 267 | case 'GBP' : |
268 | 268 | case 'BRL' : |
269 | 269 | case 'EUR' : |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | case 'MAD' : |
293 | 293 | case 'KRW' : |
294 | 294 | case 'ZAR' : |
295 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
295 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
296 | 296 | break; |
297 | 297 | case 'NOK' : |
298 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
298 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
299 | 299 | break; |
300 | 300 | default : |
301 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
301 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
302 | 302 | break; |
303 | 303 | endswitch; |
304 | 304 | |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * filter name will be give_usd_currency_filter_after |
315 | 315 | * |
316 | 316 | */ |
317 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
317 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
318 | 318 | |
319 | - if ( $negative ) { |
|
319 | + if ($negative) { |
|
320 | 320 | // Prepend the minus sign before the currency sign. |
321 | - $formatted = '-' . $formatted; |
|
321 | + $formatted = '-'.$formatted; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | return $formatted; |
@@ -334,22 +334,22 @@ discard block |
||
334 | 334 | */ |
335 | 335 | function give_currency_decimal_filter() { |
336 | 336 | |
337 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
337 | + remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
338 | 338 | |
339 | 339 | // Set default number of decimals. |
340 | 340 | $decimals = give_get_price_decimals(); |
341 | 341 | |
342 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
342 | + add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | // Get number of decimals with backward compatibility ( version < 1.6 ) |
346 | - if( 1 <= func_num_args() ){ |
|
347 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
346 | + if (1 <= func_num_args()) { |
|
347 | + $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0))); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $currency = give_get_currency(); |
351 | 351 | |
352 | - switch ( $currency ) { |
|
352 | + switch ($currency) { |
|
353 | 353 | case 'RIAL' : |
354 | 354 | case 'JPY' : |
355 | 355 | case 'TWD' : |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | break; |
360 | 360 | } |
361 | 361 | |
362 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
362 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
363 | 363 | } |
364 | 364 | |
365 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
366 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
365 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
366 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Sanitize thousand separator |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return mixed |
378 | 378 | */ |
379 | -function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
|
380 | - return stripslashes( $value ); |
|
379 | +function give_sanitize_thousand_separator($value, $field_args, $field) { |
|
380 | + return stripslashes($value); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @return mixed |
394 | 394 | */ |
395 | -function give_sanitize_number_decimals( $value, $field_args, $field ){ |
|
395 | +function give_sanitize_number_decimals($value, $field_args, $field) { |
|
396 | 396 | return absint($value); |
397 | 397 | } |
398 | 398 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * |
408 | 408 | * @return mixed |
409 | 409 | */ |
410 | -function give_sanitize_price_field_value( $value, $field_args, $field ){ |
|
411 | - return give_sanitize_amount( $value ); |
|
410 | +function give_sanitize_price_field_value($value, $field_args, $field) { |
|
411 | + return give_sanitize_amount($value); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -422,29 +422,29 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return void |
424 | 424 | */ |
425 | -function give_cmb_amount_field_render_row_cb( $field_args, $field ) { |
|
425 | +function give_cmb_amount_field_render_row_cb($field_args, $field) { |
|
426 | 426 | |
427 | 427 | // Get args. |
428 | 428 | $id = $field->args('id'); |
429 | - $label = $field->args( 'name' ); |
|
430 | - $name = $field->args( '_name' ); |
|
431 | - $description = $field->args( 'description' ); |
|
432 | - $attributes = $field->args( 'attributes' ); |
|
429 | + $label = $field->args('name'); |
|
430 | + $name = $field->args('_name'); |
|
431 | + $description = $field->args('description'); |
|
432 | + $attributes = $field->args('attributes'); |
|
433 | 433 | $attributes_string = ''; |
434 | 434 | $row_class = $field->row_classes(); |
435 | 435 | |
436 | 436 | // Get attributes. |
437 | - if( ! empty( $attributes ) ) { |
|
438 | - foreach ( $attributes as $attribute_name => $attribute_val ) { |
|
437 | + if ( ! empty($attributes)) { |
|
438 | + foreach ($attributes as $attribute_name => $attribute_val) { |
|
439 | 439 | $attributes_string[] = "$attribute_name=\"$attribute_val\""; |
440 | 440 | } |
441 | 441 | |
442 | - $attributes_string = implode( ' ', $attributes_string ); |
|
442 | + $attributes_string = implode(' ', $attributes_string); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | // Get row class. |
446 | - if( ! empty( $row_class ) && is_array( $row_class ) ) { |
|
447 | - $row_class = implode( ' ', $row_class ); |
|
446 | + if ( ! empty($row_class) && is_array($row_class)) { |
|
447 | + $row_class = implode(' ', $row_class); |
|
448 | 448 | } |
449 | 449 | ?> |
450 | 450 | <div class="cmb-row <?php echo $row_class; ?>"> |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | <label for="<?php echo $id; ?>"><?php echo $label; ?></label> |
453 | 453 | </div> |
454 | 454 | <div class="cmb-td"> |
455 | - <?php echo ( give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); ?> |
|
455 | + <?php echo (give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); ?> |
|
456 | 456 | <input id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>" <?php echo $attributes_string?>/> |
457 | - <?php echo ( give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); ?> |
|
457 | + <?php echo (give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); ?> |
|
458 | 458 | |
459 | 459 | <span class="cmb2-metabox-description"><?php echo $description; ?></span> |
460 | 460 | </div> |
@@ -41,26 +41,26 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | 43 | |
44 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
44 | + add_action('admin_init', array($this, 'init')); |
|
45 | 45 | |
46 | 46 | //Customize CMB2 URL |
47 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
47 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
48 | 48 | |
49 | 49 | //Custom CMB2 Settings Fields |
50 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
54 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
55 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
56 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
57 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
58 | - add_action( 'admin_notices', array( $this, 'settings_notices' ) ); |
|
50 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
51 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
52 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
53 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
54 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
55 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
56 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
57 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
58 | + add_action('admin_notices', array($this, 'settings_notices')); |
|
59 | 59 | |
60 | 60 | // Include CMB CSS in the head to avoid FOUC |
61 | - add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
61 | + add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css')); |
|
62 | 62 | |
63 | - add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 ); |
|
63 | + add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 1.0 |
72 | 72 | */ |
73 | 73 | public function init() { |
74 | - register_setting( $this->key, $this->key ); |
|
74 | + register_setting($this->key, $this->key); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return mixed |
87 | 87 | */ |
88 | - public function give_update_cmb_meta_box_url( $url ) { |
|
88 | + public function give_update_cmb_meta_box_url($url) { |
|
89 | 89 | //Path to Give's CMB |
90 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
90 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function give_get_settings_tabs() { |
101 | 101 | |
102 | - $settings = $this->give_settings( null ); |
|
102 | + $settings = $this->give_settings(null); |
|
103 | 103 | |
104 | 104 | $tabs = array(); |
105 | - $tabs['general'] = esc_html__( 'General', 'give' ); |
|
106 | - $tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' ); |
|
107 | - $tabs['display'] = esc_html__( 'Display Options', 'give' ); |
|
108 | - $tabs['emails'] = esc_html__( 'Emails', 'give' ); |
|
105 | + $tabs['general'] = esc_html__('General', 'give'); |
|
106 | + $tabs['gateways'] = esc_html__('Payment Gateways', 'give'); |
|
107 | + $tabs['display'] = esc_html__('Display Options', 'give'); |
|
108 | + $tabs['emails'] = esc_html__('Emails', 'give'); |
|
109 | 109 | |
110 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
111 | - $tabs['addons'] = esc_html__( 'Add-ons', 'give' ); |
|
110 | + if ( ! empty($settings['addons']['fields'])) { |
|
111 | + $tabs['addons'] = esc_html__('Add-ons', 'give'); |
|
112 | 112 | } |
113 | 113 | |
114 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
115 | - $tabs['licenses'] = esc_html__( 'Licenses', 'give' ); |
|
114 | + if ( ! empty($settings['licenses']['fields'])) { |
|
115 | + $tabs['licenses'] = esc_html__('Licenses', 'give'); |
|
116 | 116 | } |
117 | 117 | |
118 | - $tabs['advanced'] = esc_html__( 'Advanced', 'give' ); |
|
119 | - $tabs['api'] = esc_html__( 'API', 'give' ); |
|
120 | - $tabs['system_info'] = esc_html__( 'System Info', 'give' ); |
|
118 | + $tabs['advanced'] = esc_html__('Advanced', 'give'); |
|
119 | + $tabs['api'] = esc_html__('API', 'give'); |
|
120 | + $tabs['system_info'] = esc_html__('System Info', 'give'); |
|
121 | 121 | |
122 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
122 | + return apply_filters('give_settings_tabs', $tabs); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -129,32 +129,32 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function admin_page_display() { |
131 | 131 | |
132 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
132 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
133 | 133 | |
134 | 134 | ?> |
135 | 135 | |
136 | 136 | <div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>"> |
137 | 137 | |
138 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Give Settings', 'give' ); ?></h1> |
|
138 | + <h1 class="screen-reader-text"><?php esc_html_e('Give Settings', 'give'); ?></h1> |
|
139 | 139 | |
140 | 140 | <h2 class="nav-tab-wrapper"> |
141 | 141 | <?php |
142 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
142 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
143 | 143 | |
144 | - $tab_url = esc_url( add_query_arg( array( |
|
144 | + $tab_url = esc_url(add_query_arg(array( |
|
145 | 145 | 'settings-updated' => false, |
146 | 146 | 'tab' => $tab_id |
147 | - ) ) ); |
|
147 | + ))); |
|
148 | 148 | |
149 | 149 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
150 | 150 | |
151 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
151 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | ?> |
155 | 155 | </h2> |
156 | 156 | |
157 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
157 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
158 | 158 | |
159 | 159 | </div><!-- .wrap --> |
160 | 160 | |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
179 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
180 | 180 | |
181 | 181 | //only modify the give settings form |
182 | - if ( 'give_settings' == $object_id ) { |
|
182 | + if ('give_settings' == $object_id) { |
|
183 | 183 | |
184 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
184 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return array |
200 | 200 | */ |
201 | - public function give_settings( $active_tab ) { |
|
201 | + public function give_settings($active_tab) { |
|
202 | 202 | |
203 | 203 | $give_settings = array( |
204 | 204 | /** |
@@ -206,99 +206,99 @@ discard block |
||
206 | 206 | */ |
207 | 207 | 'general' => array( |
208 | 208 | 'id' => 'general_settings', |
209 | - 'give_title' => esc_html__( 'General Settings', 'give' ), |
|
210 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
211 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
209 | + 'give_title' => esc_html__('General Settings', 'give'), |
|
210 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
211 | + 'fields' => apply_filters('give_settings_general', array( |
|
212 | 212 | array( |
213 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
213 | + 'name' => esc_html__('General Settings', 'give'), |
|
214 | 214 | 'desc' => '', |
215 | 215 | 'type' => 'give_title', |
216 | 216 | 'id' => 'give_title_general_settings_1' |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
219 | + 'name' => esc_html__('Success Page', 'give'), |
|
220 | 220 | /* translators: %s: [give_receipt] */ |
221 | - 'desc' => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
221 | + 'desc' => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
222 | 222 | 'id' => 'success_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1 |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1 |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => esc_html__( 'Failed Transaction Page', 'give' ), |
|
231 | - 'desc' => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
230 | + 'name' => esc_html__('Failed Transaction Page', 'give'), |
|
231 | + 'desc' => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
232 | 232 | 'id' => 'failure_page', |
233 | 233 | 'type' => 'select', |
234 | - 'options' => give_cmb2_get_post_options( array( |
|
234 | + 'options' => give_cmb2_get_post_options(array( |
|
235 | 235 | 'post_type' => 'page', |
236 | - 'numberposts' => - 1 |
|
237 | - ) ), |
|
236 | + 'numberposts' => -1 |
|
237 | + )), |
|
238 | 238 | ), |
239 | 239 | array( |
240 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
240 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
241 | 241 | /* translators: %s: [donation_history] */ |
242 | - 'desc' => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
242 | + 'desc' => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
243 | 243 | 'id' => 'history_page', |
244 | 244 | 'type' => 'select', |
245 | - 'options' => give_cmb2_get_post_options( array( |
|
245 | + 'options' => give_cmb2_get_post_options(array( |
|
246 | 246 | 'post_type' => 'page', |
247 | - 'numberposts' => - 1 |
|
248 | - ) ), |
|
247 | + 'numberposts' => -1 |
|
248 | + )), |
|
249 | 249 | ), |
250 | 250 | array( |
251 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
252 | - 'desc' => esc_html__( 'Where does your site operate from?', 'give' ), |
|
251 | + 'name' => esc_html__('Base Country', 'give'), |
|
252 | + 'desc' => esc_html__('Where does your site operate from?', 'give'), |
|
253 | 253 | 'id' => 'base_country', |
254 | 254 | 'type' => 'select', |
255 | 255 | 'options' => give_get_country_list(), |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
258 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
259 | 259 | 'desc' => '', |
260 | 260 | 'type' => 'give_title', |
261 | 261 | 'id' => 'give_title_general_settings_2' |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
265 | - 'desc' => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
264 | + 'name' => esc_html__('Currency', 'give'), |
|
265 | + 'desc' => esc_html__('Choose your currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
266 | 266 | 'id' => 'currency', |
267 | 267 | 'type' => 'select', |
268 | 268 | 'options' => give_get_currencies(), |
269 | 269 | 'default' => 'USD', |
270 | 270 | ), |
271 | 271 | array( |
272 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
273 | - 'desc' => esc_html__( 'Choose the position of the currency sign.', 'give' ), |
|
272 | + 'name' => esc_html__('Currency Position', 'give'), |
|
273 | + 'desc' => esc_html__('Choose the position of the currency sign.', 'give'), |
|
274 | 274 | 'id' => 'currency_position', |
275 | 275 | 'type' => 'select', |
276 | 276 | 'options' => array( |
277 | 277 | /* translators: %s: currency symbol */ |
278 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
278 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
279 | 279 | /* translators: %s: currency symbol */ |
280 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
280 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
281 | 281 | ), |
282 | 282 | 'default' => 'before', |
283 | 283 | ), |
284 | 284 | array( |
285 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
286 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
285 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
286 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
287 | 287 | 'id' => 'thousands_separator', |
288 | 288 | 'type' => 'text_small', |
289 | 289 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
290 | 290 | 'default' => ',', |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
294 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
293 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
294 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
295 | 295 | 'id' => 'decimal_separator', |
296 | 296 | 'type' => 'text_small', |
297 | 297 | 'default' => '.', |
298 | 298 | ), |
299 | 299 | array( |
300 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
301 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'give' ), |
|
300 | + 'name' => __('Number of Decimals', 'give'), |
|
301 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'give'), |
|
302 | 302 | 'id' => 'number_decimals', |
303 | 303 | 'type' => 'text_small', |
304 | 304 | 'default' => 2, |
@@ -312,83 +312,83 @@ discard block |
||
312 | 312 | */ |
313 | 313 | 'gateways' => array( |
314 | 314 | 'id' => 'payment_gateways', |
315 | - 'give_title' => esc_html__( 'Payment Gateways', 'give' ), |
|
316 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
317 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
315 | + 'give_title' => esc_html__('Payment Gateways', 'give'), |
|
316 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
317 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
318 | 318 | array( |
319 | - 'name' => esc_html__( 'Gateways Settings', 'give' ), |
|
319 | + 'name' => esc_html__('Gateways Settings', 'give'), |
|
320 | 320 | 'desc' => '', |
321 | 321 | 'id' => 'give_title_gateway_settings_1', |
322 | 322 | 'type' => 'give_title' |
323 | 323 | ), |
324 | 324 | array( |
325 | - 'name' => esc_html__( 'Test Mode', 'give' ), |
|
326 | - 'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
325 | + 'name' => esc_html__('Test Mode', 'give'), |
|
326 | + 'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
327 | 327 | 'id' => 'test_mode', |
328 | 328 | 'type' => 'checkbox' |
329 | 329 | ), |
330 | 330 | array( |
331 | - 'name' => esc_html__( 'Enabled Gateways', 'give' ), |
|
332 | - 'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ), |
|
331 | + 'name' => esc_html__('Enabled Gateways', 'give'), |
|
332 | + 'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'), |
|
333 | 333 | 'id' => 'gateways', |
334 | 334 | 'type' => 'enabled_gateways' |
335 | 335 | ), |
336 | 336 | array( |
337 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
338 | - 'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ), |
|
337 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
338 | + 'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'), |
|
339 | 339 | 'id' => 'default_gateway', |
340 | 340 | 'type' => 'default_gateway' |
341 | 341 | ), |
342 | 342 | array( |
343 | - 'name' => esc_html__( 'PayPal Standard', 'give' ), |
|
343 | + 'name' => esc_html__('PayPal Standard', 'give'), |
|
344 | 344 | 'desc' => '', |
345 | 345 | 'type' => 'give_title', |
346 | 346 | 'id' => 'give_title_gateway_settings_2', |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'name' => esc_html__( 'PayPal Email', 'give' ), |
|
350 | - 'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ), |
|
349 | + 'name' => esc_html__('PayPal Email', 'give'), |
|
350 | + 'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'), |
|
351 | 351 | 'id' => 'paypal_email', |
352 | 352 | 'type' => 'text_email', |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => esc_html__( 'PayPal Page Style', 'give' ), |
|
356 | - 'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
355 | + 'name' => esc_html__('PayPal Page Style', 'give'), |
|
356 | + 'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
357 | 357 | 'id' => 'paypal_page_style', |
358 | 358 | 'type' => 'text', |
359 | 359 | ), |
360 | 360 | array( |
361 | - 'name' => esc_html__( 'PayPal Transaction Type', 'give' ), |
|
362 | - 'desc' => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
361 | + 'name' => esc_html__('PayPal Transaction Type', 'give'), |
|
362 | + 'desc' => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
363 | 363 | 'id' => 'paypal_button_type', |
364 | 364 | 'type' => 'radio_inline', |
365 | 365 | 'options' => array( |
366 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
367 | - 'standard' => esc_html__( 'Standard Transaction', 'give' ) |
|
366 | + 'donation' => esc_html__('Donation', 'give'), |
|
367 | + 'standard' => esc_html__('Standard Transaction', 'give') |
|
368 | 368 | ), |
369 | 369 | 'default' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ), |
|
373 | - 'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
372 | + 'name' => esc_html__('Disable PayPal IPN Verification', 'give'), |
|
373 | + 'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
374 | 374 | 'id' => 'disable_paypal_verification', |
375 | 375 | 'type' => 'checkbox' |
376 | 376 | ), |
377 | 377 | array( |
378 | - 'name' => esc_html__( 'Offline Donations', 'give' ), |
|
378 | + 'name' => esc_html__('Offline Donations', 'give'), |
|
379 | 379 | 'desc' => '', |
380 | 380 | 'type' => 'give_title', |
381 | 381 | 'id' => 'give_title_gateway_settings_3', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Collect Billing Details', 'give' ), |
|
385 | - 'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
384 | + 'name' => esc_html__('Collect Billing Details', 'give'), |
|
385 | + 'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
386 | 386 | 'id' => 'give_offline_donation_enable_billing_fields', |
387 | 387 | 'type' => 'checkbox' |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => esc_html__( 'Offline Donation Instructions', 'give' ), |
|
391 | - 'desc' => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
390 | + 'name' => esc_html__('Offline Donation Instructions', 'give'), |
|
391 | + 'desc' => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
392 | 392 | 'id' => 'global_offline_donation_content', |
393 | 393 | 'default' => give_get_default_offline_donation_content(), |
394 | 394 | 'type' => 'wysiwyg', |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | ) |
398 | 398 | ), |
399 | 399 | array( |
400 | - 'name' => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
401 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
400 | + 'name' => esc_html__('Offline Donation Email Instructions Subject', 'give'), |
|
401 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
402 | 402 | 'id' => 'offline_donation_subject', |
403 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
403 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
404 | 404 | 'type' => 'text' |
405 | 405 | ), |
406 | 406 | array( |
407 | - 'name' => esc_html__( 'Offline Donation Email Instructions', 'give' ), |
|
408 | - 'desc' => esc_html__( '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' ), |
|
407 | + 'name' => esc_html__('Offline Donation Email Instructions', 'give'), |
|
408 | + 'desc' => esc_html__('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'), |
|
409 | 409 | 'id' => 'global_offline_donation_email', |
410 | 410 | 'default' => give_get_default_offline_donation_email_content(), |
411 | 411 | 'type' => 'wysiwyg', |
@@ -419,95 +419,95 @@ discard block |
||
419 | 419 | /** Display Settings */ |
420 | 420 | 'display' => array( |
421 | 421 | 'id' => 'display_settings', |
422 | - 'give_title' => esc_html__( 'Display Settings', 'give' ), |
|
423 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
424 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
422 | + 'give_title' => esc_html__('Display Settings', 'give'), |
|
423 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
424 | + 'fields' => apply_filters('give_settings_display', array( |
|
425 | 425 | array( |
426 | - 'name' => esc_html__( 'Display Settings', 'give' ), |
|
426 | + 'name' => esc_html__('Display Settings', 'give'), |
|
427 | 427 | 'desc' => '', |
428 | 428 | 'id' => 'give_title_display_settings_1', |
429 | 429 | 'type' => 'give_title' |
430 | 430 | ), |
431 | 431 | array( |
432 | - 'name' => esc_html__( 'Disable CSS', 'give' ), |
|
433 | - 'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
432 | + 'name' => esc_html__('Disable CSS', 'give'), |
|
433 | + 'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
434 | 434 | 'id' => 'disable_css', |
435 | 435 | 'type' => 'checkbox' |
436 | 436 | ), |
437 | 437 | array( |
438 | - 'name' => esc_html__( 'Enable Floating Labels', 'give' ), |
|
438 | + 'name' => esc_html__('Enable Floating Labels', 'give'), |
|
439 | 439 | /* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
440 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
440 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
441 | 441 | 'id' => 'enable_floatlabels', |
442 | 442 | 'type' => 'checkbox' |
443 | 443 | ), |
444 | 444 | array( |
445 | - 'name' => esc_html__( 'Disable Welcome Screen', 'give' ), |
|
445 | + 'name' => esc_html__('Disable Welcome Screen', 'give'), |
|
446 | 446 | /* translators: %s: about page URL */ |
447 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), array('a' => array('href' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox' |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => esc_html__( 'Post Types', 'give' ), |
|
452 | + 'name' => esc_html__('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title' |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => esc_html__( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => esc_html__('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox' |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => esc_html__( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => esc_html__('Disable Form Archives', 'give'), |
|
465 | + 'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox' |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => esc_html__( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => esc_html__('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox' |
474 | 474 | ), |
475 | 475 | |
476 | 476 | array( |
477 | - 'name' => esc_html__( 'Featured Image Size', 'give' ), |
|
478 | - 'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ), |
|
477 | + 'name' => esc_html__('Featured Image Size', 'give'), |
|
478 | + 'desc' => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'), |
|
479 | 479 | 'id' => 'featured_image_size', |
480 | 480 | 'type' => 'select', |
481 | 481 | 'default' => 'large', |
482 | 482 | 'options' => give_get_featured_image_sizes() |
483 | 483 | ), |
484 | 484 | array( |
485 | - 'name' => esc_html__( 'Disable Form Featured Image', 'give' ), |
|
486 | - 'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
485 | + 'name' => esc_html__('Disable Form Featured Image', 'give'), |
|
486 | + 'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
487 | 487 | 'id' => 'disable_form_featured_img', |
488 | 488 | 'type' => 'checkbox' |
489 | 489 | ), |
490 | 490 | array( |
491 | - 'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ), |
|
492 | - 'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
491 | + 'name' => esc_html__('Disable Single Form Sidebar', 'give'), |
|
492 | + 'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
493 | 493 | 'id' => 'disable_form_sidebar', |
494 | 494 | 'type' => 'checkbox' |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'name' => esc_html__( 'Taxonomies', 'give' ), |
|
497 | + 'name' => esc_html__('Taxonomies', 'give'), |
|
498 | 498 | 'desc' => '', |
499 | 499 | 'id' => 'give_title_display_settings_3', |
500 | 500 | 'type' => 'give_title' |
501 | 501 | ), |
502 | 502 | array( |
503 | - 'name' => esc_html__( 'Enable Form Categories', 'give' ), |
|
504 | - 'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
503 | + 'name' => esc_html__('Enable Form Categories', 'give'), |
|
504 | + 'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
505 | 505 | 'id' => 'enable_categories', |
506 | 506 | 'type' => 'checkbox' |
507 | 507 | ), |
508 | 508 | array( |
509 | - 'name' => esc_html__( 'Enable Form Tags', 'give' ), |
|
510 | - 'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
509 | + 'name' => esc_html__('Enable Form Tags', 'give'), |
|
510 | + 'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
511 | 511 | 'id' => 'enable_tags', |
512 | 512 | 'type' => 'checkbox' |
513 | 513 | ), |
@@ -520,95 +520,95 @@ discard block |
||
520 | 520 | */ |
521 | 521 | 'emails' => array( |
522 | 522 | 'id' => 'email_settings', |
523 | - 'give_title' => esc_html__( 'Email Settings', 'give' ), |
|
524 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
525 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
523 | + 'give_title' => esc_html__('Email Settings', 'give'), |
|
524 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
525 | + 'fields' => apply_filters('give_settings_emails', array( |
|
526 | 526 | array( |
527 | - 'name' => esc_html__( 'Email Settings', 'give' ), |
|
527 | + 'name' => esc_html__('Email Settings', 'give'), |
|
528 | 528 | 'desc' => '', |
529 | 529 | 'id' => 'give_title_email_settings_1', |
530 | 530 | 'type' => 'give_title' |
531 | 531 | ), |
532 | 532 | array( |
533 | 533 | 'id' => 'email_template', |
534 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
535 | - 'desc' => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
534 | + 'name' => esc_html__('Email Template', 'give'), |
|
535 | + 'desc' => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
536 | 536 | 'type' => 'select', |
537 | 537 | 'options' => give_get_email_templates() |
538 | 538 | ), |
539 | 539 | array( |
540 | 540 | 'id' => 'email_logo', |
541 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
542 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
541 | + 'name' => esc_html__('Logo', 'give'), |
|
542 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
543 | 543 | 'type' => 'file' |
544 | 544 | ), |
545 | 545 | array( |
546 | 546 | 'id' => 'from_name', |
547 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
548 | - 'desc' => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ), |
|
549 | - 'default' => get_bloginfo( 'name' ), |
|
547 | + 'name' => esc_html__('From Name', 'give'), |
|
548 | + 'desc' => esc_html__('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), |
|
549 | + 'default' => get_bloginfo('name'), |
|
550 | 550 | 'type' => 'text' |
551 | 551 | ), |
552 | 552 | array( |
553 | 553 | 'id' => 'from_email', |
554 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
555 | - 'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
556 | - 'default' => get_bloginfo( 'admin_email' ), |
|
554 | + 'name' => esc_html__('From Email', 'give'), |
|
555 | + 'desc' => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
556 | + 'default' => get_bloginfo('admin_email'), |
|
557 | 557 | 'type' => 'text' |
558 | 558 | ), |
559 | 559 | array( |
560 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
560 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
561 | 561 | 'desc' => '', |
562 | 562 | 'id' => 'give_title_email_settings_2', |
563 | 563 | 'type' => 'give_title' |
564 | 564 | ), |
565 | 565 | array( |
566 | 566 | 'id' => 'donation_subject', |
567 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
568 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
569 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
567 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
568 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
569 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
570 | 570 | 'type' => 'text' |
571 | 571 | ), |
572 | 572 | array( |
573 | 573 | 'id' => 'donation_receipt', |
574 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
574 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
575 | 575 | /* translators: %s: emails tags list */ |
576 | - 'desc' => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>', |
|
576 | + 'desc' => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>', |
|
577 | 577 | 'type' => 'wysiwyg', |
578 | 578 | 'default' => give_get_default_donation_receipt_email() |
579 | 579 | ), |
580 | 580 | array( |
581 | - 'name' => esc_html__( 'New Donation Notification', 'give' ), |
|
581 | + 'name' => esc_html__('New Donation Notification', 'give'), |
|
582 | 582 | 'desc' => '', |
583 | 583 | 'id' => 'give_title_email_settings_3', |
584 | 584 | 'type' => 'give_title' |
585 | 585 | ), |
586 | 586 | array( |
587 | 587 | 'id' => 'donation_notification_subject', |
588 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
589 | - 'desc' => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ), |
|
588 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
589 | + 'desc' => esc_html__('Enter the subject line for the donation notification email.', 'give'), |
|
590 | 590 | 'type' => 'text', |
591 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
591 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
592 | 592 | ), |
593 | 593 | array( |
594 | 594 | 'id' => 'donation_notification', |
595 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
595 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
596 | 596 | /* translators: %s: emails tags list */ |
597 | - 'desc' => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>', |
|
597 | + 'desc' => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>', |
|
598 | 598 | 'type' => 'wysiwyg', |
599 | 599 | 'default' => give_get_default_donation_notification_email() |
600 | 600 | ), |
601 | 601 | array( |
602 | 602 | 'id' => 'admin_notice_emails', |
603 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
604 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
603 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
604 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
605 | 605 | 'type' => 'textarea', |
606 | - 'default' => get_bloginfo( 'admin_email' ) |
|
606 | + 'default' => get_bloginfo('admin_email') |
|
607 | 607 | ), |
608 | 608 | array( |
609 | 609 | 'id' => 'disable_admin_notices', |
610 | - 'name' => esc_html__( 'Disable Admin Notifications', 'give' ), |
|
611 | - 'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
610 | + 'name' => esc_html__('Disable Admin Notifications', 'give'), |
|
611 | + 'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
612 | 612 | 'type' => 'checkbox' |
613 | 613 | ) |
614 | 614 | ) |
@@ -617,99 +617,99 @@ discard block |
||
617 | 617 | /** Extension Settings */ |
618 | 618 | 'addons' => array( |
619 | 619 | 'id' => 'addons', |
620 | - 'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ), |
|
621 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
622 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
620 | + 'give_title' => esc_html__('Give Add-ons Settings', 'give'), |
|
621 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
622 | + 'fields' => apply_filters('give_settings_addons', array() |
|
623 | 623 | ) |
624 | 624 | ), |
625 | 625 | /** Licenses Settings */ |
626 | 626 | 'licenses' => array( |
627 | 627 | 'id' => 'licenses', |
628 | - 'give_title' => esc_html__( 'Give Licenses', 'give' ), |
|
629 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
630 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
628 | + 'give_title' => esc_html__('Give Licenses', 'give'), |
|
629 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
630 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
631 | 631 | ) |
632 | 632 | ), |
633 | 633 | /** Advanced Options */ |
634 | 634 | 'advanced' => array( |
635 | 635 | 'id' => 'advanced_options', |
636 | - 'give_title' => esc_html__( 'Advanced Options', 'give' ), |
|
637 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
638 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
636 | + 'give_title' => esc_html__('Advanced Options', 'give'), |
|
637 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
638 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
639 | 639 | array( |
640 | - 'name' => esc_html__( 'Access Control', 'give' ), |
|
640 | + 'name' => esc_html__('Access Control', 'give'), |
|
641 | 641 | 'desc' => '', |
642 | 642 | 'id' => 'give_title_session_control_1', |
643 | 643 | 'type' => 'give_title' |
644 | 644 | ), |
645 | 645 | array( |
646 | 646 | 'id' => 'session_lifetime', |
647 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
648 | - 'desc' => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ), |
|
647 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
648 | + 'desc' => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'), |
|
649 | 649 | 'type' => 'select', |
650 | 650 | 'options' => array( |
651 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
652 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
653 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
654 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
651 | + '86400' => esc_html__('24 Hours', 'give'), |
|
652 | + '172800' => esc_html__('48 Hours', 'give'), |
|
653 | + '259200' => esc_html__('72 Hours', 'give'), |
|
654 | + '604800' => esc_html__('1 Week', 'give'), |
|
655 | 655 | ) |
656 | 656 | ), |
657 | 657 | array( |
658 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
659 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
658 | + 'name' => esc_html__('Email Access', 'give'), |
|
659 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
660 | 660 | 'id' => 'email_access', |
661 | 661 | 'type' => 'checkbox', |
662 | 662 | ), |
663 | 663 | array( |
664 | 664 | 'id' => 'recaptcha_key', |
665 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
665 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
666 | 666 | /* translators: %s: https://www.google.com/recaptcha/ */ |
667 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
667 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
668 | 668 | 'default' => '', |
669 | 669 | 'type' => 'text' |
670 | 670 | ), |
671 | 671 | array( |
672 | 672 | 'id' => 'recaptcha_secret', |
673 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
674 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
673 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
674 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
675 | 675 | 'default' => '', |
676 | 676 | 'type' => 'text' |
677 | 677 | ), |
678 | 678 | array( |
679 | - 'name' => esc_html__( 'Data Control', 'give' ), |
|
679 | + 'name' => esc_html__('Data Control', 'give'), |
|
680 | 680 | 'desc' => '', |
681 | 681 | 'id' => 'give_title_data_control_2', |
682 | 682 | 'type' => 'give_title' |
683 | 683 | ), |
684 | 684 | array( |
685 | - 'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ), |
|
686 | - 'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
685 | + 'name' => esc_html__('Remove All Data on Uninstall?', 'give'), |
|
686 | + 'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
687 | 687 | 'id' => 'uninstall_on_delete', |
688 | 688 | 'type' => 'checkbox' |
689 | 689 | ), |
690 | 690 | array( |
691 | - 'name' => esc_html__( 'Filter Control', 'give' ), |
|
691 | + 'name' => esc_html__('Filter Control', 'give'), |
|
692 | 692 | 'desc' => '', |
693 | 693 | 'id' => 'give_title_filter_control', |
694 | 694 | 'type' => 'give_title' |
695 | 695 | ), |
696 | 696 | array( |
697 | 697 | /* translators: %s: the_content */ |
698 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
698 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
699 | 699 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
700 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
700 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
701 | 701 | 'id' => 'disable_the_content_filter', |
702 | 702 | 'type' => 'checkbox' |
703 | 703 | ), |
704 | 704 | array( |
705 | - 'name' => esc_html__( 'Script Loading', 'give' ), |
|
705 | + 'name' => esc_html__('Script Loading', 'give'), |
|
706 | 706 | 'desc' => '', |
707 | 707 | 'id' => 'give_title_script_control', |
708 | 708 | 'type' => 'give_title' |
709 | 709 | ), |
710 | 710 | array( |
711 | - 'name' => esc_html__( 'Load Scripts in Footer?', 'give' ), |
|
712 | - 'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
711 | + 'name' => esc_html__('Load Scripts in Footer?', 'give'), |
|
712 | + 'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
713 | 713 | 'id' => 'scripts_footer', |
714 | 714 | 'type' => 'checkbox' |
715 | 715 | ) |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | /** API Settings */ |
720 | 720 | 'api' => array( |
721 | 721 | 'id' => 'api', |
722 | - 'give_title' => esc_html__( 'API', 'give' ), |
|
723 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
722 | + 'give_title' => esc_html__('API', 'give'), |
|
723 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
724 | 724 | 'show_names' => false, // Hide field names on the left |
725 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
725 | + 'fields' => apply_filters('give_settings_system', array( |
|
726 | 726 | array( |
727 | 727 | 'id' => 'api', |
728 | - 'name' => esc_html__( 'API', 'give' ), |
|
728 | + 'name' => esc_html__('API', 'give'), |
|
729 | 729 | 'type' => 'api' |
730 | 730 | ) |
731 | 731 | ) |
@@ -734,13 +734,13 @@ discard block |
||
734 | 734 | /** Licenses Settings */ |
735 | 735 | 'system_info' => array( |
736 | 736 | 'id' => 'system_info', |
737 | - 'give_title' => esc_html__( 'System Info', 'give' ), |
|
738 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
739 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
737 | + 'give_title' => esc_html__('System Info', 'give'), |
|
738 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
739 | + 'fields' => apply_filters('give_settings_system', array( |
|
740 | 740 | array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'name' => esc_html__( 'System Info', 'give' ), |
|
743 | - 'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
742 | + 'name' => esc_html__('System Info', 'give'), |
|
743 | + 'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
744 | 744 | 'type' => 'system_info' |
745 | 745 | ) |
746 | 746 | ) |
@@ -749,15 +749,15 @@ discard block |
||
749 | 749 | ); |
750 | 750 | |
751 | 751 | //Return all settings array if no active tab |
752 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
752 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
753 | 753 | |
754 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
754 | + return apply_filters('give_registered_settings', $give_settings); |
|
755 | 755 | |
756 | 756 | } |
757 | 757 | |
758 | 758 | |
759 | 759 | // Add other tabs and settings fields as needed |
760 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
760 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
761 | 761 | |
762 | 762 | } |
763 | 763 | |
@@ -766,11 +766,11 @@ discard block |
||
766 | 766 | */ |
767 | 767 | public function settings_notices() { |
768 | 768 | |
769 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
769 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
770 | 770 | return; |
771 | 771 | } |
772 | 772 | |
773 | - add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' ); |
|
773 | + add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated'); |
|
774 | 774 | |
775 | 775 | } |
776 | 776 | |
@@ -784,17 +784,17 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @return mixed Field value or exception is thrown |
786 | 786 | */ |
787 | - public function __get( $field ) { |
|
787 | + public function __get($field) { |
|
788 | 788 | |
789 | 789 | // Allowed fields to retrieve |
790 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
790 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
791 | 791 | return $this->{$field}; |
792 | 792 | } |
793 | - if ( 'option_metabox' === $field ) { |
|
793 | + if ('option_metabox' === $field) { |
|
794 | 794 | return $this->option_metabox(); |
795 | 795 | } |
796 | 796 | |
797 | - throw new Exception( 'Invalid property: ' . $field ); |
|
797 | + throw new Exception('Invalid property: '.$field); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
@@ -812,12 +812,12 @@ discard block |
||
812 | 812 | * |
813 | 813 | * @return mixed Option value |
814 | 814 | */ |
815 | -function give_get_option( $key = '', $default = false ) { |
|
815 | +function give_get_option($key = '', $default = false) { |
|
816 | 816 | global $give_options; |
817 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
818 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
817 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
818 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
819 | 819 | |
820 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
820 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | |
@@ -835,33 +835,33 @@ discard block |
||
835 | 835 | * |
836 | 836 | * @return boolean True if updated, false if not. |
837 | 837 | */ |
838 | -function give_update_option( $key = '', $value = false ) { |
|
838 | +function give_update_option($key = '', $value = false) { |
|
839 | 839 | |
840 | 840 | // If no key, exit |
841 | - if ( empty( $key ) ) { |
|
841 | + if (empty($key)) { |
|
842 | 842 | return false; |
843 | 843 | } |
844 | 844 | |
845 | - if ( empty( $value ) ) { |
|
846 | - $remove_option = give_delete_option( $key ); |
|
845 | + if (empty($value)) { |
|
846 | + $remove_option = give_delete_option($key); |
|
847 | 847 | |
848 | 848 | return $remove_option; |
849 | 849 | } |
850 | 850 | |
851 | 851 | // First let's grab the current settings |
852 | - $options = get_option( 'give_settings' ); |
|
852 | + $options = get_option('give_settings'); |
|
853 | 853 | |
854 | 854 | // Let's let devs alter that value coming in |
855 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
855 | + $value = apply_filters('give_update_option', $value, $key); |
|
856 | 856 | |
857 | 857 | // Next let's try to update the value |
858 | - $options[ $key ] = $value; |
|
859 | - $did_update = update_option( 'give_settings', $options ); |
|
858 | + $options[$key] = $value; |
|
859 | + $did_update = update_option('give_settings', $options); |
|
860 | 860 | |
861 | 861 | // If it updated, let's update the global variable |
862 | - if ( $did_update ) { |
|
862 | + if ($did_update) { |
|
863 | 863 | global $give_options; |
864 | - $give_options[ $key ] = $value; |
|
864 | + $give_options[$key] = $value; |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | return $did_update; |
@@ -878,27 +878,27 @@ discard block |
||
878 | 878 | * |
879 | 879 | * @return boolean True if updated, false if not. |
880 | 880 | */ |
881 | -function give_delete_option( $key = '' ) { |
|
881 | +function give_delete_option($key = '') { |
|
882 | 882 | |
883 | 883 | // If no key, exit |
884 | - if ( empty( $key ) ) { |
|
884 | + if (empty($key)) { |
|
885 | 885 | return false; |
886 | 886 | } |
887 | 887 | |
888 | 888 | // First let's grab the current settings |
889 | - $options = get_option( 'give_settings' ); |
|
889 | + $options = get_option('give_settings'); |
|
890 | 890 | |
891 | 891 | // Next let's try to update the value |
892 | - if ( isset( $options[ $key ] ) ) { |
|
892 | + if (isset($options[$key])) { |
|
893 | 893 | |
894 | - unset( $options[ $key ] ); |
|
894 | + unset($options[$key]); |
|
895 | 895 | |
896 | 896 | } |
897 | 897 | |
898 | - $did_update = update_option( 'give_settings', $options ); |
|
898 | + $did_update = update_option('give_settings', $options); |
|
899 | 899 | |
900 | 900 | // If it updated, let's update the global variable |
901 | - if ( $did_update ) { |
|
901 | + if ($did_update) { |
|
902 | 902 | global $give_options; |
903 | 903 | $give_options = $options; |
904 | 904 | } |
@@ -917,9 +917,9 @@ discard block |
||
917 | 917 | */ |
918 | 918 | function give_get_settings() { |
919 | 919 | |
920 | - $settings = get_option( 'give_settings' ); |
|
920 | + $settings = get_option('give_settings'); |
|
921 | 921 | |
922 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
922 | + return (array) apply_filters('give_get_settings', $settings); |
|
923 | 923 | |
924 | 924 | } |
925 | 925 | |
@@ -937,25 +937,25 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return array |
939 | 939 | */ |
940 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
941 | - if ( is_int( $position ) ) { |
|
942 | - array_splice( $array, $position, 0, $insert ); |
|
940 | +function give_settings_array_insert($array, $position, $insert) { |
|
941 | + if (is_int($position)) { |
|
942 | + array_splice($array, $position, 0, $insert); |
|
943 | 943 | } else { |
944 | 944 | |
945 | - foreach ( $array as $index => $subarray ) { |
|
946 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
945 | + foreach ($array as $index => $subarray) { |
|
946 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
947 | 947 | $pos = $index; |
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | - if ( ! isset( $pos ) ) { |
|
951 | + if ( ! isset($pos)) { |
|
952 | 952 | return $array; |
953 | 953 | } |
954 | 954 | |
955 | 955 | $array = array_merge( |
956 | - array_slice( $array, 0, $pos ), |
|
956 | + array_slice($array, 0, $pos), |
|
957 | 957 | $insert, |
958 | - array_slice( $array, $pos ) |
|
958 | + array_slice($array, $pos) |
|
959 | 959 | ); |
960 | 960 | } |
961 | 961 | |
@@ -978,31 +978,31 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
981 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
982 | 982 | |
983 | 983 | $id = $field_type_object->field->args['id']; |
984 | 984 | $field_description = $field_type_object->field->args['desc']; |
985 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
985 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
986 | 986 | |
987 | 987 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
988 | 988 | |
989 | - foreach ( $gateways as $key => $option ) : |
|
989 | + foreach ($gateways as $key => $option) : |
|
990 | 990 | |
991 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
991 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
992 | 992 | $enabled = '1'; |
993 | 993 | } else { |
994 | 994 | $enabled = null; |
995 | 995 | } |
996 | 996 | |
997 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
998 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
997 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
998 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
999 | 999 | |
1000 | 1000 | endforeach; |
1001 | 1001 | |
1002 | 1002 | echo '</ul>'; |
1003 | 1003 | |
1004 | - if ( $field_description ) { |
|
1005 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1004 | + if ($field_description) { |
|
1005 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | } |
@@ -1018,31 +1018,31 @@ discard block |
||
1018 | 1018 | * |
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1021 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1022 | 1022 | |
1023 | 1023 | $id = $field_type_object->field->args['id']; |
1024 | 1024 | $field_description = $field_type_object->field->args['desc']; |
1025 | 1025 | $gateways = give_get_enabled_payment_gateways(); |
1026 | 1026 | |
1027 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
1027 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
1028 | 1028 | |
1029 | 1029 | //Add a field to the Give Form admin single post view of this field |
1030 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
1031 | - echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>'; |
|
1030 | + if ($field_type_object->field->object_type === 'post') { |
|
1031 | + echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>'; |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | - foreach ( $gateways as $key => $option ) : |
|
1034 | + foreach ($gateways as $key => $option) : |
|
1035 | 1035 | |
1036 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
1036 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
1037 | 1037 | |
1038 | 1038 | |
1039 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1039 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1040 | 1040 | |
1041 | 1041 | endforeach; |
1042 | 1042 | |
1043 | 1043 | echo '</select>'; |
1044 | 1044 | |
1045 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1045 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1046 | 1046 | |
1047 | 1047 | } |
1048 | 1048 | |
@@ -1057,13 +1057,13 @@ discard block |
||
1057 | 1057 | * |
1058 | 1058 | * @return void |
1059 | 1059 | */ |
1060 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1060 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1061 | 1061 | |
1062 | 1062 | $id = $field_type_object->field->args['id']; |
1063 | 1063 | $title = $field_type_object->field->args['name']; |
1064 | 1064 | $field_description = $field_type_object->field->args['desc']; |
1065 | 1065 | |
1066 | - echo '<hr>' . $field_description; |
|
1066 | + echo '<hr>'.$field_description; |
|
1067 | 1067 | |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | * |
1079 | 1079 | * @return void |
1080 | 1080 | */ |
1081 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1081 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1082 | 1082 | |
1083 | 1083 | $id = $field_type_object->field->args['id']; |
1084 | 1084 | $title = $field_type_object->field->args['name']; |
@@ -1098,25 +1098,25 @@ discard block |
||
1098 | 1098 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1099 | 1099 | * @return array An array of options that matches the CMB2 options array |
1100 | 1100 | */ |
1101 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1101 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1102 | 1102 | |
1103 | - $post_options = array( '' => '' ); // Blank option |
|
1103 | + $post_options = array('' => ''); // Blank option |
|
1104 | 1104 | |
1105 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1105 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1106 | 1106 | return $post_options; |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - $args = wp_parse_args( $query_args, array( |
|
1109 | + $args = wp_parse_args($query_args, array( |
|
1110 | 1110 | 'post_type' => 'page', |
1111 | 1111 | 'numberposts' => 10, |
1112 | - ) ); |
|
1112 | + )); |
|
1113 | 1113 | |
1114 | - $posts = get_posts( $args ); |
|
1114 | + $posts = get_posts($args); |
|
1115 | 1115 | |
1116 | - if ( $posts ) { |
|
1117 | - foreach ( $posts as $post ) { |
|
1116 | + if ($posts) { |
|
1117 | + foreach ($posts as $post) { |
|
1118 | 1118 | |
1119 | - $post_options[ $post->ID ] = $post->post_title; |
|
1119 | + $post_options[$post->ID] = $post->post_title; |
|
1120 | 1120 | |
1121 | 1121 | } |
1122 | 1122 | } |
@@ -1136,17 +1136,17 @@ discard block |
||
1136 | 1136 | global $_wp_additional_image_sizes; |
1137 | 1137 | $sizes = array(); |
1138 | 1138 | |
1139 | - foreach ( get_intermediate_image_sizes() as $_size ) { |
|
1139 | + foreach (get_intermediate_image_sizes() as $_size) { |
|
1140 | 1140 | |
1141 | - if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { |
|
1142 | - $sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1143 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1144 | - $sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height']; |
|
1141 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) { |
|
1142 | + $sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1143 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1144 | + $sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height']; |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1149 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | |
@@ -1161,34 +1161,34 @@ discard block |
||
1161 | 1161 | * |
1162 | 1162 | * @return void |
1163 | 1163 | */ |
1164 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1164 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1165 | 1165 | |
1166 | 1166 | $id = $field_type_object->field->args['id']; |
1167 | 1167 | $field_description = $field_type_object->field->args['desc']; |
1168 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1168 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1169 | 1169 | $field_classes = 'regular-text give-license-field'; |
1170 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1170 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1171 | 1171 | |
1172 | - if ( $license_status === 'valid' ) { |
|
1172 | + if ($license_status === 'valid') { |
|
1173 | 1173 | $field_classes .= ' give-license-active'; |
1174 | 1174 | } |
1175 | 1175 | |
1176 | - $html = $field_type_object->input( array( |
|
1176 | + $html = $field_type_object->input(array( |
|
1177 | 1177 | 'class' => $field_classes, |
1178 | 1178 | 'type' => $type |
1179 | - ) ); |
|
1179 | + )); |
|
1180 | 1180 | |
1181 | 1181 | //License is active so show deactivate button |
1182 | - if ( $license_status === 'valid' ) { |
|
1183 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1182 | + if ($license_status === 'valid') { |
|
1183 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1184 | 1184 | } else { |
1185 | 1185 | //This license is not valid so delete it |
1186 | - give_delete_option( $id ); |
|
1186 | + give_delete_option($id); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1189 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1190 | 1190 | |
1191 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1191 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1192 | 1192 | |
1193 | 1193 | echo $html; |
1194 | 1194 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | function give_api_callback() { |
1204 | 1204 | |
1205 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1205 | + if ( ! current_user_can('manage_give_settings')) { |
|
1206 | 1206 | return; |
1207 | 1207 | } |
1208 | 1208 | |
@@ -1211,9 +1211,9 @@ discard block |
||
1211 | 1211 | * |
1212 | 1212 | * @since 1.0 |
1213 | 1213 | */ |
1214 | - do_action( 'give_tools_api_keys_before' ); |
|
1214 | + do_action('give_tools_api_keys_before'); |
|
1215 | 1215 | |
1216 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1216 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1217 | 1217 | |
1218 | 1218 | $api_keys_table = new Give_API_Keys_Table(); |
1219 | 1219 | $api_keys_table->prepare_items(); |
@@ -1222,9 +1222,9 @@ discard block |
||
1222 | 1222 | <span class="cmb2-metabox-description api-description"> |
1223 | 1223 | <?php echo sprintf( |
1224 | 1224 | /* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */ |
1225 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1226 | - esc_url( 'https://givewp.com/documentation/give-api-reference/' ), |
|
1227 | - esc_url( 'https://givewp.com/addons/zapier/' ) |
|
1225 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1226 | + esc_url('https://givewp.com/documentation/give-api-reference/'), |
|
1227 | + esc_url('https://givewp.com/addons/zapier/') |
|
1228 | 1228 | ); ?> |
1229 | 1229 | </span> |
1230 | 1230 | <?php |
@@ -1234,10 +1234,10 @@ discard block |
||
1234 | 1234 | * |
1235 | 1235 | * @since 1.0 |
1236 | 1236 | */ |
1237 | - do_action( 'give_tools_api_keys_after' ); |
|
1237 | + do_action('give_tools_api_keys_after'); |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1240 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1241 | 1241 | |
1242 | 1242 | /** |
1243 | 1243 | * Hook Callback |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * |
1251 | 1251 | * @return void |
1252 | 1252 | */ |
1253 | -function give_hook_callback( $args ) { |
|
1254 | - do_action( 'give_' . $args['id'] ); |
|
1253 | +function give_hook_callback($args) { |
|
1254 | + do_action('give_'.$args['id']); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
@@ -1262,10 +1262,10 @@ discard block |
||
1262 | 1262 | * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin. |
1263 | 1263 | */ |
1264 | 1264 | |
1265 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1266 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1267 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1268 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1269 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1270 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1265 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1266 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1267 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1268 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1269 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1270 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1271 | 1271 | } |
1272 | 1272 | \ No newline at end of file |
@@ -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'); |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id; |
|
71 | + return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id; |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway; |
|
73 | + return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Payment ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Payment ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | 'paged' => $paged |
181 | 181 | ); |
182 | 182 | |
183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
184 | 184 | |
185 | - if ( $logs ) { |
|
186 | - foreach ( $logs as $log ) { |
|
185 | + if ($logs) { |
|
186 | + foreach ($logs as $log) { |
|
187 | 187 | |
188 | 188 | $logs_data[] = array( |
189 | 189 | 'ID' => $log->ID, |
190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
191 | 191 | 'payment_id' => $log->post_parent, |
192 | 192 | 'error' => 'error', |
193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
194 | 194 | 'date' => $log->post_date |
195 | 195 | ); |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $which |
214 | 214 | */ |
215 | - protected function display_tablenav( $which ) { |
|
216 | - if ( 'top' === $which ) { |
|
217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
215 | + protected function display_tablenav($which) { |
|
216 | + if ('top' === $which) { |
|
217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
221 | 221 | |
222 | 222 | <div class="alignleft actions bulkactions"> |
223 | - <?php $this->bulk_actions( $which ); ?> |
|
223 | + <?php $this->bulk_actions($which); ?> |
|
224 | 224 | </div> |
225 | 225 | <?php |
226 | - $this->extra_tablenav( $which ); |
|
227 | - $this->pagination( $which ); |
|
226 | + $this->extra_tablenav($which); |
|
227 | + $this->pagination($which); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | $columns = $this->get_columns(); |
252 | 252 | $hidden = array(); // No hidden columns |
253 | 253 | $sortable = $this->get_sortable_columns(); |
254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
255 | 255 | $this->items = $this->get_logs(); |
256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
257 | 257 | |
258 | - $this->set_pagination_args( array( |
|
258 | + $this->set_pagination_args(array( |
|
259 | 259 | 'total_items' => $total_items, |
260 | 260 | 'per_page' => $this->per_page, |
261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | } |
@@ -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 | ); |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | Give()->roles->remove_caps(); |
73 | 73 | |
74 | 74 | // Delete the Roles. |
75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
76 | - foreach ( $give_roles as $role ) { |
|
77 | - remove_role( $role ); |
|
75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
76 | + foreach ($give_roles as $role) { |
|
77 | + remove_role($role); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Remove all database tables. |
81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
84 | 84 | |
85 | 85 | // Cleanup Cron Events. |
86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
89 | 89 | |
90 | 90 | // Get all options. |
91 | 91 | $give_option_names = $wpdb->get_results( |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | ARRAY_A |
97 | 97 | ); |
98 | 98 | |
99 | - if ( ! empty( $give_option_names ) ) { |
|
99 | + if ( ! empty($give_option_names)) { |
|
100 | 100 | // Convert option name to transient or option name. |
101 | 101 | $new_give_option_names = array(); |
102 | 102 | |
103 | - foreach ( $give_option_names as $option ) { |
|
104 | - $new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) ) |
|
105 | - ? str_replace( '_transient_', '', $option['option_name'] ) |
|
103 | + foreach ($give_option_names as $option) { |
|
104 | + $new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_')) |
|
105 | + ? str_replace('_transient_', '', $option['option_name']) |
|
106 | 106 | : $option['option_name']; |
107 | 107 | } |
108 | 108 | |
109 | 109 | $give_option_names = $new_give_option_names; |
110 | 110 | |
111 | 111 | // Delete all the Plugin Options. |
112 | - foreach ( $give_option_names as $option ) { |
|
113 | - if ( false !== strpos( $option, '_transient_' ) ) { |
|
114 | - delete_transient( $option ); |
|
112 | + foreach ($give_option_names as $option) { |
|
113 | + if (false !== strpos($option, '_transient_')) { |
|
114 | + delete_transient($option); |
|
115 | 115 | } else { |
116 | - delete_option( $option ); |
|
116 | + delete_option($option); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |