@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | global $give_receipt_args, $payment; |
7 | 7 | |
8 | 8 | // Validation: Ensure $payment var is set. |
9 | -if ( empty( $payment ) ) { |
|
10 | - $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0; |
|
9 | +if (empty($payment)) { |
|
10 | + $payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Double-Validation: Check for $payment global. |
14 | -if ( empty( $payment ) ) { |
|
15 | - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) ); |
|
14 | +if (empty($payment)) { |
|
15 | + Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give')); |
|
16 | 16 | |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $donation_id = $payment->ID; |
21 | -$form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true ); |
|
22 | -$meta = give_get_payment_meta( $donation_id ); |
|
23 | -$donation = give_get_payment_form_title( $meta ); |
|
24 | -$user = give_get_payment_meta_user_info( $donation_id ); |
|
25 | -$email = give_get_payment_user_email( $donation_id ); |
|
21 | +$form_id = give_get_payment_meta($donation_id, '_give_payment_form_id', true); |
|
22 | +$meta = give_get_payment_meta($donation_id); |
|
23 | +$donation = give_get_payment_form_title($meta); |
|
24 | +$user = give_get_payment_meta_user_info($donation_id); |
|
25 | +$email = give_get_payment_user_email($donation_id); |
|
26 | 26 | $status = $payment->post_status; |
27 | -$status_label = give_get_payment_status( $payment, true ); |
|
27 | +$status_label = give_get_payment_status($payment, true); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Generate Donation Receipt Arguments. |
@@ -35,50 +35,50 @@ discard block |
||
35 | 35 | * @since 1.8.8 |
36 | 36 | */ |
37 | 37 | $give_receipt_args['donation_receipt']['donor'] = array( |
38 | - 'name' => __( 'Donor', 'give' ), |
|
39 | - 'value' => $user['first_name'] . ' ' . $user['last_name'], |
|
38 | + 'name' => __('Donor', 'give'), |
|
39 | + 'value' => $user['first_name'].' '.$user['last_name'], |
|
40 | 40 | 'display' => $give_receipt_args['donor'], |
41 | 41 | ); |
42 | 42 | |
43 | 43 | $give_receipt_args['donation_receipt']['date'] = array( |
44 | - 'name' => __( 'Date', 'give' ), |
|
45 | - 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ), |
|
44 | + 'name' => __('Date', 'give'), |
|
45 | + 'value' => date_i18n(give_date_format(), strtotime($meta['date'])), |
|
46 | 46 | 'display' => $give_receipt_args['date'], |
47 | 47 | ); |
48 | 48 | |
49 | 49 | $give_receipt_args['donation_receipt']['total_donation'] = array( |
50 | - 'name' => __( 'Total Donation', 'give' ), |
|
51 | - 'value' => give_payment_amount( $donation_id ), |
|
50 | + 'name' => __('Total Donation', 'give'), |
|
51 | + 'value' => give_payment_amount($donation_id), |
|
52 | 52 | 'display' => $give_receipt_args['price'], |
53 | 53 | ); |
54 | 54 | |
55 | 55 | $give_receipt_args['donation_receipt']['donation'] = array( |
56 | - 'name' => __( 'Donation', 'give' ), |
|
56 | + 'name' => __('Donation', 'give'), |
|
57 | 57 | 'value' => $donation, |
58 | 58 | 'display' => true, |
59 | 59 | ); |
60 | 60 | |
61 | 61 | $give_receipt_args['donation_receipt']['donation_status'] = array( |
62 | - 'name' => __( 'Donation Status', 'give' ), |
|
63 | - 'value' => esc_attr( $status_label ), |
|
62 | + 'name' => __('Donation Status', 'give'), |
|
63 | + 'value' => esc_attr($status_label), |
|
64 | 64 | 'display' => $give_receipt_args['payment_status'], |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $give_receipt_args['donation_receipt']['donation_id'] = array( |
68 | - 'name' => __( 'Donation ID', 'give' ), |
|
68 | + 'name' => __('Donation ID', 'give'), |
|
69 | 69 | 'value' => $donation_id, |
70 | 70 | 'display' => $give_receipt_args['payment_id'], |
71 | 71 | ); |
72 | 72 | |
73 | 73 | $give_receipt_args['donation_receipt']['payment_key'] = array( |
74 | - 'name' => __( 'Payment Key', 'give' ), |
|
75 | - 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ), |
|
74 | + 'name' => __('Payment Key', 'give'), |
|
75 | + 'value' => get_post_meta($donation_id, '_give_payment_purchase_key', true), |
|
76 | 76 | 'display' => $give_receipt_args['payment_key'], |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $give_receipt_args['donation_receipt']['payment_method'] = array( |
80 | - 'name' => __( 'Payment Method', 'give' ), |
|
81 | - 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ), |
|
80 | + 'name' => __('Payment Method', 'give'), |
|
81 | + 'value' => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)), |
|
82 | 82 | 'display' => $give_receipt_args['payment_method'], |
83 | 83 | ); |
84 | 84 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.8.8 |
95 | 95 | */ |
96 | -$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id ); |
|
96 | +$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id); |
|
97 | 97 | |
98 | 98 | // When the donation were made through offline donation, We won't show receipt and payment status though. |
99 | -if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) { |
|
99 | +if ('offline' === give_get_payment_gateway($payment->ID) && 'pending' === $status) { |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Before the offline donation receipt content starts. |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param Give_Payment $payment Donation payment object. |
107 | 107 | * @param array $give_receipt_args Receipt Arguments. |
108 | 108 | */ |
109 | - do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args ); |
|
109 | + do_action('give_receipt_before_offline_payment', $payment, $give_receipt_args); |
|
110 | 110 | ?> |
111 | - <h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2> |
|
112 | - <div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>"> |
|
111 | + <h2><?php echo apply_filters('give_receipt_offline_payment_heading', __('Your Donation is Almost Complete!', 'give')); ?></h2> |
|
112 | + <div id="give_donation_receipt" class="<?php echo esc_attr(apply_filters('give_receipt_offline_payment_classes', 'give_receipt_offline_payment')); ?>"> |
|
113 | 113 | <?php |
114 | 114 | // Instruction for offline donation. |
115 | - $offline_instruction = give_get_offline_payment_instruction( $form_id, true ); |
|
115 | + $offline_instruction = give_get_offline_payment_instruction($form_id, true); |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Instruction for the offline donation. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param Give_Payment $payment Payment object. |
124 | 124 | * @param integer $form_id Donation form id. |
125 | 125 | */ |
126 | - echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id ); |
|
126 | + echo apply_filters('give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id); |
|
127 | 127 | ?> |
128 | 128 | </div> |
129 | 129 | <?php |
@@ -135,52 +135,52 @@ discard block |
||
135 | 135 | * @param Give_Payment $payment Donation payment object. |
136 | 136 | * @param array $give_receipt_args Receipt Arguments. |
137 | 137 | */ |
138 | - do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args ); |
|
138 | + do_action('give_receipt_after_offline_payment', $payment, $give_receipt_args); |
|
139 | 139 | |
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Show payment status notice based on shortcode attribute. |
144 | -if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
144 | +if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) { |
|
145 | 145 | $notice_message = ''; |
146 | 146 | $notice_type = 'warning'; |
147 | 147 | |
148 | - switch ( $status ) { |
|
148 | + switch ($status) { |
|
149 | 149 | case 'publish': |
150 | - $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' ); |
|
150 | + $notice_message = __('Payment Complete: Thank you for your donation.', 'give'); |
|
151 | 151 | $notice_type = 'success'; |
152 | 152 | break; |
153 | 153 | case 'pending': |
154 | - $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' ); |
|
154 | + $notice_message = __('Payment Pending: Your donation is currently processing.', 'give'); |
|
155 | 155 | $notice_type = 'warning'; |
156 | 156 | break; |
157 | 157 | case 'refunded': |
158 | - $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' ); |
|
158 | + $notice_message = __('Payment Refunded: Your donation has been refunded.', 'give'); |
|
159 | 159 | $notice_type = 'warning'; |
160 | 160 | break; |
161 | 161 | case 'preapproval': |
162 | - $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' ); |
|
162 | + $notice_message = __('Payment Preapproved: Thank you for your donation.', 'give'); |
|
163 | 163 | $notice_type = 'warning'; |
164 | 164 | break; |
165 | 165 | case 'failed': |
166 | - $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' ); |
|
166 | + $notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give'); |
|
167 | 167 | $notice_type = 'error'; |
168 | 168 | break; |
169 | 169 | case 'cancelled': |
170 | - $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' ); |
|
170 | + $notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give'); |
|
171 | 171 | $notice_type = 'error'; |
172 | 172 | break; |
173 | 173 | case 'abandoned': |
174 | - $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' ); |
|
174 | + $notice_message = __('Payment Abandoned: This donation has not been completed.', 'give'); |
|
175 | 175 | $notice_type = 'error'; |
176 | 176 | break; |
177 | 177 | case 'revoked': |
178 | - $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' ); |
|
178 | + $notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give'); |
|
179 | 179 | $notice_type = 'error'; |
180 | 180 | break; |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $notice_message ) ) { |
|
183 | + if ( ! empty($notice_message)) { |
|
184 | 184 | /** |
185 | 185 | * Filters payment status notice for receipts. |
186 | 186 | * |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param string $status Payment status. |
196 | 196 | * @param array $meta Array of meta data related to the payment. |
197 | 197 | */ |
198 | - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta ); |
|
198 | + echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta); |
|
199 | 199 | } |
200 | 200 | }// End if(). |
201 | 201 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param object $payment The payment object. |
210 | 210 | * @param array $give_receipt_args Receipt_argument. |
211 | 211 | */ |
212 | -do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args ); |
|
212 | +do_action('give_payment_receipt_before_table', $payment, $give_receipt_args); |
|
213 | 213 | ?> |
214 | 214 | |
215 | 215 | <table id="give_donation_receipt" class="give-table"> |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | * @param object $payment The payment object. |
226 | 226 | * @param array $give_receipt_args Receipt_argument. |
227 | 227 | */ |
228 | - do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args ); |
|
228 | + do_action('give_payment_receipt_header_before', $payment, $give_receipt_args); |
|
229 | 229 | ?> |
230 | 230 | <tr> |
231 | 231 | <th scope="colgroup" colspan="2"> |
232 | - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span> |
|
232 | + <span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span> |
|
233 | 233 | </th> |
234 | 234 | </tr> |
235 | 235 | <?php |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param object $payment The payment object. |
244 | 244 | * @param array $give_receipt_args Receipt_argument. |
245 | 245 | */ |
246 | - do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args ); |
|
246 | + do_action('give_payment_receipt_header_after', $payment, $give_receipt_args); |
|
247 | 247 | ?> |
248 | 248 | </thead> |
249 | 249 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @param object $payment The payment object. |
260 | 260 | * @param array $give_receipt_args Receipt_argument. |
261 | 261 | */ |
262 | - do_action( 'give_payment_receipt_before', $payment, $give_receipt_args ); |
|
262 | + do_action('give_payment_receipt_before', $payment, $give_receipt_args); |
|
263 | 263 | ?> |
264 | 264 | |
265 | - <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?> |
|
266 | - <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
265 | + <?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?> |
|
266 | + <?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
267 | 267 | <tr> |
268 | 268 | <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td> |
269 | 269 | <td><?php echo $receipt_item['value']; ?></td> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param object $payment The payment object. |
283 | 283 | * @param array $give_receipt_args Receipt_argument. |
284 | 284 | */ |
285 | - do_action( 'give_payment_receipt_after', $payment, $give_receipt_args ); |
|
285 | + do_action('give_payment_receipt_after', $payment, $give_receipt_args); |
|
286 | 286 | ?> |
287 | 287 | </tbody> |
288 | 288 | </table> |
@@ -298,5 +298,5 @@ discard block |
||
298 | 298 | * @param object $payment The payment object. |
299 | 299 | * @param array $give_receipt_args Receipt_argument. |
300 | 300 | */ |
301 | -do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args ); |
|
301 | +do_action('give_payment_receipt_after_table', $payment, $give_receipt_args); |
|
302 | 302 | ?> |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | * @copyright Copyright (c) 2016, WordImpress |
8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
9 | 9 | */ |
10 | -$current_user = wp_get_current_user(); |
|
10 | +$current_user = wp_get_current_user(); |
|
11 | 11 | |
12 | -if ( is_user_logged_in() ): |
|
12 | +if (is_user_logged_in()): |
|
13 | 13 | $user_id = get_current_user_id(); |
14 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
15 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
14 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
15 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
16 | 16 | $display_name = $current_user->display_name; |
17 | - $address = give_get_donor_address( $user_id ); |
|
17 | + $address = give_get_donor_address($user_id); |
|
18 | 18 | |
19 | - if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?> |
|
19 | + if (isset($_GET['updated']) && $_GET['updated'] == true && ! give_get_errors()): ?> |
|
20 | 20 | <p class="give_success"> |
21 | - <strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?> |
|
21 | + <strong><?php esc_html_e('Success:', 'give'); ?></strong> <?php esc_html_e('Your profile has been updated.', 'give'); ?> |
|
22 | 22 | </p> |
23 | 23 | <?php endif; ?> |
24 | 24 | |
25 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
25 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | /** |
@@ -32,39 +32,39 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( 'give_profile_editor_before' ); |
|
35 | + do_action('give_profile_editor_before'); |
|
36 | 36 | ?> |
37 | 37 | |
38 | 38 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
39 | 39 | |
40 | 40 | <fieldset> |
41 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
41 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
42 | 42 | |
43 | - <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
43 | + <h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
44 | 44 | |
45 | 45 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
46 | - <label for="give_first_name"><?php _e( 'First Name', 'give' ); ?></label> |
|
47 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
46 | + <label for="give_first_name"><?php _e('First Name', 'give'); ?></label> |
|
47 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
48 | 48 | </p> |
49 | 49 | |
50 | 50 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
51 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
52 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
51 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
52 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
53 | 53 | </p> |
54 | 54 | |
55 | 55 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
56 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
56 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
57 | 57 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
58 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
59 | - <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
58 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
59 | + <option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
60 | 60 | <?php endif; ?> |
61 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
62 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
63 | - <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
61 | + <option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
62 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
63 | + <option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
64 | 64 | <?php endif; ?> |
65 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
66 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
67 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
65 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
66 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
67 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
68 | 68 | <?php endif; ?> |
69 | 69 | </select> |
70 | 70 | <?php |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_profile_editor_name' ); |
|
78 | + do_action('give_profile_editor_name'); |
|
79 | 79 | ?> |
80 | 80 | </p> |
81 | 81 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @since 1.0 |
89 | 89 | */ |
90 | - do_action( 'give_profile_editor_after_name' ); |
|
90 | + do_action('give_profile_editor_after_name'); |
|
91 | 91 | ?> |
92 | 92 | |
93 | 93 | <p class="form-row form-row-last form-row-responsive"> |
94 | - <label for="give_email"><?php _e( 'Email Address', 'give' ); ?></label> |
|
95 | - <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
94 | + <label for="give_email"><?php _e('Email Address', 'give'); ?></label> |
|
95 | + <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
96 | 96 | <?php |
97 | 97 | /** |
98 | 98 | * Fires in the profile editor shortcode, to the email section. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @since 1.0 |
103 | 103 | */ |
104 | - do_action( 'give_profile_editor_email' ); |
|
104 | + do_action('give_profile_editor_email'); |
|
105 | 105 | ?> |
106 | 106 | </p> |
107 | 107 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | - do_action( 'give_profile_editor_after_email' ); |
|
116 | + do_action('give_profile_editor_after_email'); |
|
117 | 117 | ?> |
118 | 118 | |
119 | - <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e( 'Change your Billing Address', 'give' ); ?></h3> |
|
119 | + <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e('Change your Billing Address', 'give'); ?></h3> |
|
120 | 120 | |
121 | 121 | <div id="give_profile_billing_address_wrap"> |
122 | 122 | <?php |
123 | 123 | // Get selected country from address. |
124 | - $selected_country = ( ! empty( $address['country'] ) ? $address['country'] : '' ); |
|
124 | + $selected_country = ( ! empty($address['country']) ? $address['country'] : ''); |
|
125 | 125 | |
126 | 126 | $selected_state = ''; |
127 | - if ( $selected_country === give_get_country() ) { |
|
127 | + if ($selected_country === give_get_country()) { |
|
128 | 128 | // Get default selected state by admin. |
129 | 129 | $selected_state = give_get_state(); |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Get selected state from address. |
133 | - $selected_state = ! empty( $address['state'] ) ? $address['state'] : $selected_state; |
|
133 | + $selected_state = ! empty($address['state']) ? $address['state'] : $selected_state; |
|
134 | 134 | |
135 | - $label = __( 'State', 'give' ); |
|
135 | + $label = __('State', 'give'); |
|
136 | 136 | $states_label = give_get_states_label(); |
137 | 137 | // Check if $country code exists in the array key for states label. |
138 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
139 | - $label = $states_label[ $selected_country ]; |
|
138 | + if (array_key_exists($selected_country, $states_label)) { |
|
139 | + $label = $states_label[$selected_country]; |
|
140 | 140 | } |
141 | 141 | |
142 | - $states = give_get_states( $selected_country ); |
|
142 | + $states = give_get_states($selected_country); |
|
143 | 143 | |
144 | 144 | // Get the country list that do not have any states init. |
145 | 145 | $no_states_country = give_no_states_country_list(); |
@@ -149,39 +149,39 @@ discard block |
||
149 | 149 | ?> |
150 | 150 | |
151 | 151 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
152 | - <label for="give_address_country"><?php _e( 'Country', 'give' ); ?></label> |
|
152 | + <label for="give_address_country"><?php _e('Country', 'give'); ?></label> |
|
153 | 153 | <select name="give_address_country" id="give_address_country" class="select give-select"> |
154 | - <?php foreach ( give_get_country_list() as $key => $country ) : ?> |
|
155 | - <option value="<?php echo $key; ?>"<?php selected( $selected_country, $key ); ?>><?php echo esc_html( $country ); ?></option> |
|
154 | + <?php foreach (give_get_country_list() as $key => $country) : ?> |
|
155 | + <option value="<?php echo $key; ?>"<?php selected($selected_country, $key); ?>><?php echo esc_html($country); ?></option> |
|
156 | 156 | <?php endforeach; ?> |
157 | 157 | </select> |
158 | 158 | </p> |
159 | 159 | |
160 | 160 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
161 | - <label for="give_address_line1"><?php _e( 'Address 1', 'give' ); ?></label> |
|
161 | + <label for="give_address_line1"><?php _e('Address 1', 'give'); ?></label> |
|
162 | 162 | <input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" |
163 | - value="<?php echo esc_attr( $address['line1'] ); ?>"/> |
|
163 | + value="<?php echo esc_attr($address['line1']); ?>"/> |
|
164 | 164 | </p> |
165 | 165 | |
166 | 166 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
167 | - <label for="give_address_line2"><?php _e( 'Address 2', 'give' ); ?></label> |
|
167 | + <label for="give_address_line2"><?php _e('Address 2', 'give'); ?></label> |
|
168 | 168 | <input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" |
169 | - value="<?php echo esc_attr( $address['line2'] ); ?>"/> |
|
169 | + value="<?php echo esc_attr($address['line2']); ?>"/> |
|
170 | 170 | </p> |
171 | 171 | |
172 | 172 | |
173 | 173 | <p id="give-card-state-wrap" |
174 | - class="form-row form-row-wide <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?>"> |
|
175 | - <label for="give_address_state"><?php _e( 'State / Province / County', 'give' ); ?></label> |
|
174 | + class="form-row form-row-wide <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?>"> |
|
175 | + <label for="give_address_state"><?php _e('State / Province / County', 'give'); ?></label> |
|
176 | 176 | <?php |
177 | - if ( ! empty( $states ) ) : ?> |
|
177 | + if ( ! empty($states)) : ?> |
|
178 | 178 | <select |
179 | 179 | name="give_address_state" |
180 | 180 | id="give_address_state" |
181 | 181 | class="give_address_state" |
182 | 182 | <?php |
183 | - foreach ( $states as $state_code => $state ) { |
|
184 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
183 | + foreach ($states as $state_code => $state) { |
|
184 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | </p> |
195 | 195 | |
196 | 196 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
197 | - <label for="give_address_city"><?php _e( 'City', 'give' ); ?></label> |
|
197 | + <label for="give_address_city"><?php _e('City', 'give'); ?></label> |
|
198 | 198 | <input name="give_address_city" id="give_address_city" class="text give-input" type="text" |
199 | - value="<?php echo esc_attr( $address['city'] ); ?>"/> |
|
199 | + value="<?php echo esc_attr($address['city']); ?>"/> |
|
200 | 200 | </p> |
201 | 201 | |
202 | 202 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
203 | - <label for="give_address_zip"><?php _e( 'Zip / Postal Code', 'give' ); ?></label> |
|
203 | + <label for="give_address_zip"><?php _e('Zip / Postal Code', 'give'); ?></label> |
|
204 | 204 | <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" |
205 | - value="<?php echo esc_attr( $address['zip'] ); ?>"/> |
|
205 | + value="<?php echo esc_attr($address['zip']); ?>"/> |
|
206 | 206 | </p> |
207 | 207 | |
208 | 208 | <?php |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @since 1.0 |
215 | 215 | */ |
216 | - do_action( 'give_profile_editor_address' ); |
|
216 | + do_action('give_profile_editor_address'); |
|
217 | 217 | ?> |
218 | 218 | |
219 | 219 | </div> |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.0 |
228 | 228 | */ |
229 | - do_action( 'give_profile_editor_after_address' ); |
|
229 | + do_action('give_profile_editor_after_address'); |
|
230 | 230 | ?> |
231 | 231 | |
232 | - <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
232 | + <h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
233 | 233 | |
234 | 234 | <div id="give_profile_password_wrap" class="give-clearfix"> |
235 | 235 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
236 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
236 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
237 | 237 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
238 | 238 | </p> |
239 | 239 | |
240 | 240 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
241 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
241 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
242 | 242 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
243 | 243 | <?php |
244 | 244 | /** |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @since 1.0 |
250 | 250 | */ |
251 | - do_action( 'give_profile_editor_password' ); |
|
251 | + do_action('give_profile_editor_password'); |
|
252 | 252 | ?> |
253 | 253 | </p> |
254 | 254 | </div> |
255 | 255 | |
256 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
256 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
257 | 257 | |
258 | 258 | <?php |
259 | 259 | /** |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( 'give_profile_editor_after_password' ); |
|
266 | + do_action('give_profile_editor_after_password'); |
|
267 | 267 | ?> |
268 | 268 | |
269 | 269 | <p id="give_profile_submit_wrap"> |
270 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
270 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
271 | 271 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
272 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
273 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
272 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
273 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
274 | 274 | </p> |
275 | 275 | |
276 | 276 | </fieldset> |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @since 1.0 |
287 | 287 | */ |
288 | - do_action( 'give_profile_editor_after' ); |
|
288 | + do_action('give_profile_editor_after'); |
|
289 | 289 | ?> |
290 | 290 | |
291 | 291 | <?php |
292 | 292 | else: |
293 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
293 | + _e('You need to login to edit your profile.', 'give'); |
|
294 | 294 | echo give_login_form(); |
295 | 295 | endif; |
@@ -185,10 +185,13 @@ discard block |
||
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
188 | - <?php else : ?> |
|
188 | + <?php else { |
|
189 | + : ?> |
|
189 | 190 | <input type="text" size="6" name="give_address_state" id="give_address_state" |
190 | 191 | class="give_address_state give-input" |
191 | - placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/> |
|
192 | + placeholder="<?php echo $label; |
|
193 | +} |
|
194 | +?>" value="<?php echo $selected_state; ?>"/> |
|
192 | 195 | <?php endif; |
193 | 196 | ?> |
194 | 197 | </p> |
@@ -289,7 +292,9 @@ discard block |
||
289 | 292 | ?> |
290 | 293 | |
291 | 294 | <?php |
292 | -else: |
|
295 | +else { |
|
296 | + : |
|
293 | 297 | _e( 'You need to login to edit your profile.', 'give' ); |
298 | +} |
|
294 | 299 | echo give_login_form(); |
295 | 300 | endif; |
@@ -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 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
87 | 87 | */ |
88 | - public function __construct( $args = array() ) { |
|
88 | + public function __construct($args = array()) { |
|
89 | 89 | $defaults = array( |
90 | 90 | 'number' => 20, |
91 | 91 | 'offset' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // 'form' => array(), |
104 | 104 | ); |
105 | 105 | |
106 | - $this->args = wp_parse_args( $args, $defaults ); |
|
106 | + $this->args = wp_parse_args($args, $defaults); |
|
107 | 107 | |
108 | 108 | $this->table_name = Give()->donors->table_name; |
109 | 109 | $this->meta_table_name = Give()->donor_meta->table_name; |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param Give_Donors_Query $this Donors query object. |
148 | 148 | */ |
149 | - do_action( 'give_pre_get_donors', $this ); |
|
149 | + do_action('give_pre_get_donors', $this); |
|
150 | 150 | |
151 | - if ( empty( $this->args['count'] ) ) { |
|
152 | - $this->donors = $wpdb->get_results( $this->get_sql() ); |
|
151 | + if (empty($this->args['count'])) { |
|
152 | + $this->donors = $wpdb->get_results($this->get_sql()); |
|
153 | 153 | } else { |
154 | - $this->donors = $wpdb->get_var( $this->get_sql() ); |
|
154 | + $this->donors = $wpdb->get_var($this->get_sql()); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param Give_Donors_Query $this Donors query object. |
163 | 163 | */ |
164 | - do_action( 'give_post_get_donors', $this ); |
|
164 | + do_action('give_post_get_donors', $this); |
|
165 | 165 | |
166 | 166 | return $this->donors; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function get_sql() { |
179 | 179 | global $wpdb; |
180 | 180 | |
181 | - if ( $this->args['number'] < 1 ) { |
|
181 | + if ($this->args['number'] < 1) { |
|
182 | 182 | $this->args['number'] = 999999999999; |
183 | 183 | } |
184 | 184 | |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | |
187 | 187 | |
188 | 188 | // Set offset. |
189 | - if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) { |
|
190 | - $this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 ); |
|
189 | + if (empty($this->args['offset']) && (0 < $this->args['paged'])) { |
|
190 | + $this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // Set fields. |
194 | 194 | $fields = "{$this->table_name}.*"; |
195 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
196 | - if ( is_string( $this->args['fields'] ) ) { |
|
195 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
196 | + if (is_string($this->args['fields'])) { |
|
197 | 197 | $fields = "{$this->table_name}.{$this->args['fields']}"; |
198 | - } else if ( is_array( $this->args['fields'] ) ) { |
|
199 | - $fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] ); |
|
198 | + } else if (is_array($this->args['fields'])) { |
|
199 | + $fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | // Set count. |
204 | - if ( ! empty( $this->args['count'] ) ) { |
|
204 | + if ( ! empty($this->args['count'])) { |
|
205 | 205 | $fields = "COUNT({$this->table_name}.id)"; |
206 | 206 | } |
207 | 207 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | |
210 | 210 | return $wpdb->prepare( |
211 | 211 | "SELECT {$fields} FROM {$this->table_name} {$where} {$orderby} {$this->args['order']} LIMIT %d,%d;", |
212 | - absint( $this->args['offset'] ), |
|
213 | - absint( $this->args['number'] ) |
|
212 | + absint($this->args['offset']), |
|
213 | + absint($this->args['number']) |
|
214 | 214 | ); |
215 | 215 | } |
216 | 216 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | $where = ''; |
228 | 228 | |
229 | 229 | // Get sql query for meta. |
230 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
231 | - $meta_query_object = new WP_Meta_Query( $this->args['meta_query'] ); |
|
230 | + if ( ! empty($this->args['meta_query'])) { |
|
231 | + $meta_query_object = new WP_Meta_Query($this->args['meta_query']); |
|
232 | 232 | $meta_query = $meta_query_object->get_sql( |
233 | 233 | $this->meta_type, |
234 | 234 | $this->table_name, |
235 | 235 | 'id' |
236 | 236 | ); |
237 | - $where = implode( '', $meta_query ); |
|
237 | + $where = implode('', $meta_query); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $where .= 'WHERE 1=1'; |
@@ -261,17 +261,17 @@ discard block |
||
261 | 261 | |
262 | 262 | $where = ''; |
263 | 263 | |
264 | - if ( ! empty( $this->args['email'] ) ) { |
|
264 | + if ( ! empty($this->args['email'])) { |
|
265 | 265 | |
266 | - if ( is_array( $this->args['email'] ) ) { |
|
266 | + if (is_array($this->args['email'])) { |
|
267 | 267 | |
268 | - $emails_count = count( $this->args['email'] ); |
|
269 | - $emails_placeholder = array_fill( 0, $emails_count, '%s' ); |
|
270 | - $emails = implode( ', ', $emails_placeholder ); |
|
268 | + $emails_count = count($this->args['email']); |
|
269 | + $emails_placeholder = array_fill(0, $emails_count, '%s'); |
|
270 | + $emails = implode(', ', $emails_placeholder); |
|
271 | 271 | |
272 | - $where .= $wpdb->prepare( " AND {$this->table_name}.email IN( $emails ) ", $this->args['email'] ); |
|
272 | + $where .= $wpdb->prepare(" AND {$this->table_name}.email IN( $emails ) ", $this->args['email']); |
|
273 | 273 | } else { |
274 | - $where .= $wpdb->prepare( " AND {$this->table_name}.email = %s ", $this->args['email'] ); |
|
274 | + $where .= $wpdb->prepare(" AND {$this->table_name}.email = %s ", $this->args['email']); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $where = ''; |
292 | 292 | |
293 | 293 | // Specific donors. |
294 | - if ( ! empty( $this->args['donor'] ) ) { |
|
295 | - if ( ! is_array( $this->args['donor'] ) ) { |
|
296 | - $this->args['donor'] = explode( ',', $this->args['donor'] ); |
|
294 | + if ( ! empty($this->args['donor'])) { |
|
295 | + if ( ! is_array($this->args['donor'])) { |
|
296 | + $this->args['donor'] = explode(',', $this->args['donor']); |
|
297 | 297 | } |
298 | - $log_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) ); |
|
298 | + $log_ids = implode(',', array_map('intval', $this->args['donor'])); |
|
299 | 299 | |
300 | 300 | $where .= " AND {$this->table_name}.id IN( {$log_ids} ) "; |
301 | 301 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $where = ''; |
317 | 317 | |
318 | 318 | // Donors created for a specific date or in a date range |
319 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
319 | + if ( ! empty($this->args['date_query'])) { |
|
320 | 320 | $date_query_object = new WP_Date_Query( |
321 | 321 | $this->args['date_query'], |
322 | 322 | "{$this->table_name}.date_created" |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $where = ''; |
342 | 342 | |
343 | 343 | // Donors created for a specific date or in a date range |
344 | - if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) { |
|
345 | - $search_parts = explode( ':', $this->args['s'] ); |
|
344 | + if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) { |
|
345 | + $search_parts = explode(':', $this->args['s']); |
|
346 | 346 | |
347 | - if ( ! empty( $search_parts[0] ) ) { |
|
348 | - switch ( $search_parts[0] ) { |
|
347 | + if ( ! empty($search_parts[0])) { |
|
348 | + switch ($search_parts[0]) { |
|
349 | 349 | case 'name': |
350 | 350 | $where = " AND {$this->table_name}.name LIKE '%{$search_parts[1]}%' "; |
351 | 351 | break; |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | $where = ''; |
374 | 374 | |
375 | 375 | // Donors create for specific wp user. |
376 | - if ( ! empty( $this->args['user'] ) ) { |
|
377 | - if ( ! is_array( $this->args['user'] ) ) { |
|
378 | - $this->args['user'] = explode( ',', $this->args['user'] ); |
|
376 | + if ( ! empty($this->args['user'])) { |
|
377 | + if ( ! is_array($this->args['user'])) { |
|
378 | + $this->args['user'] = explode(',', $this->args['user']); |
|
379 | 379 | } |
380 | - $user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) ); |
|
380 | + $user_ids = implode(',', array_map('intval', $this->args['user'])); |
|
381 | 381 | |
382 | 382 | $where .= " AND {$this->table_name}.user_id IN( {$user_ids} ) "; |
383 | 383 | } |
@@ -396,14 +396,13 @@ discard block |
||
396 | 396 | private function get_order_query() { |
397 | 397 | $table_columns = Give()->donors->get_columns(); |
398 | 398 | |
399 | - $this->args['orderby'] = ! array_key_exists( $this->args['orderby'], $table_columns ) ? |
|
400 | - 'id' : |
|
401 | - $this->args['orderby']; |
|
399 | + $this->args['orderby'] = ! array_key_exists($this->args['orderby'], $table_columns) ? |
|
400 | + 'id' : $this->args['orderby']; |
|
402 | 401 | |
403 | - $this->args['orderby'] = esc_sql( $this->args['orderby'] ); |
|
404 | - $this->args['order'] = esc_sql( $this->args['order'] ); |
|
402 | + $this->args['orderby'] = esc_sql($this->args['orderby']); |
|
403 | + $this->args['order'] = esc_sql($this->args['order']); |
|
405 | 404 | |
406 | - switch ( $table_columns[ $this->args['orderby'] ] ) { |
|
405 | + switch ($table_columns[$this->args['orderby']]) { |
|
407 | 406 | case '%d': |
408 | 407 | case '%f': |
409 | 408 | $query = "ORDER BY {$this->table_name}.{$this->args['orderby']}+0"; |
@@ -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 | * |
24 | 24 | * @return array The altered list of views. |
25 | 25 | */ |
26 | -function give_register_default_donor_views( $views ) { |
|
26 | +function give_register_default_donor_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_donor_notes_view', |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_donor_tabs( $tabs ) { |
|
49 | +function give_register_default_donor_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | 52 | 'overview' => array( |
53 | 53 | 'dashicon' => 'dashicons-admin-users', |
54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
54 | + 'title' => __('Donor Profile', 'give'), |
|
55 | 55 | ), |
56 | 56 | 'notes' => array( |
57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
58 | + 'title' => __('Donor Notes', 'give'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - return array_merge( $tabs, $default_tabs ); |
|
62 | + return array_merge($tabs, $default_tabs); |
|
63 | 63 | } |
64 | 64 | |
65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
75 | 75 | */ |
76 | -function give_register_delete_donor_tab( $tabs ) { |
|
76 | +function give_register_delete_donor_tab($tabs) { |
|
77 | 77 | |
78 | 78 | $tabs['delete'] = array( |
79 | 79 | 'dashicon' => 'dashicons-trash', |
80 | - 'title' => __( 'Delete Donor', 'give' ), |
|
80 | + 'title' => __('Delete Donor', 'give'), |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | return $tabs; |
84 | 84 | } |
85 | 85 | |
86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Connect and Reconnect Donor with User profile. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return array |
98 | 98 | */ |
99 | -function give_connect_user_donor_profile( $donor, $donor_data, $address ) { |
|
99 | +function give_connect_user_donor_profile($donor, $donor_data, $address) { |
|
100 | 100 | |
101 | 101 | $donor_id = $donor->id; |
102 | 102 | $previous_user_id = $donor->user_id; |
@@ -110,40 +110,40 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @since 1.0 |
112 | 112 | */ |
113 | - do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address ); |
|
113 | + do_action('give_pre_edit_donor', $donor_id, $donor_data, $address); |
|
114 | 114 | |
115 | 115 | $output = array(); |
116 | 116 | |
117 | - if ( $donor->update( $donor_data ) ) { |
|
117 | + if ($donor->update($donor_data)) { |
|
118 | 118 | |
119 | - if ( ! empty( $donor->user_id ) && $donor->user_id > 0 ) { |
|
120 | - update_user_meta( $donor->user_id, '_give_user_address', $address ); |
|
119 | + if ( ! empty($donor->user_id) && $donor->user_id > 0) { |
|
120 | + update_user_meta($donor->user_id, '_give_user_address', $address); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Update some donation meta if we need to. |
124 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
124 | + $payments_array = explode(',', $donor->payment_ids); |
|
125 | 125 | |
126 | - if ( $donor->user_id !== $previous_user_id ) { |
|
127 | - foreach ( $payments_array as $payment_id ) { |
|
128 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $donor->user_id ); |
|
126 | + if ($donor->user_id !== $previous_user_id) { |
|
127 | + foreach ($payments_array as $payment_id) { |
|
128 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $donor->user_id); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Fetch disconnected user id, if exists. |
133 | - $disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true ); |
|
133 | + $disconnected_user_id = $donor->get_meta('_give_disconnected_user_id', true); |
|
134 | 134 | |
135 | 135 | // Flag User and Donor Disconnection. |
136 | - delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' ); |
|
136 | + delete_user_meta($disconnected_user_id, '_give_is_donor_disconnected'); |
|
137 | 137 | |
138 | 138 | // Check whether the disconnected user id and the reconnected user id are same or not. |
139 | 139 | // If both are same then delete user id store in donor meta. |
140 | - if( $donor_data['user_id'] === $disconnected_user_id ) { |
|
141 | - delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' ); |
|
142 | - $donor->delete_meta( '_give_disconnected_user_id' ); |
|
140 | + if ($donor_data['user_id'] === $disconnected_user_id) { |
|
141 | + delete_user_meta($disconnected_user_id, '_give_disconnected_donor_id'); |
|
142 | + $donor->delete_meta('_give_disconnected_user_id'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $output['success'] = true; |
146 | - $donor_data = array_merge( $donor_data, $address ); |
|
146 | + $donor_data = array_merge($donor_data, $address); |
|
147 | 147 | $output['customer_info'] = $donor_data; |
148 | 148 | |
149 | 149 | } else { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @since 1.0 |
162 | 162 | */ |
163 | - do_action( 'give_post_edit_donor', $donor_id, $donor_data ); |
|
163 | + do_action('give_post_edit_donor', $donor_id, $donor_data); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | return $output; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
95 | 95 | if ( isset( $_POST['akismet_spam_protection'] ) |
96 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
97 | - && ! give_check_akismet_key() |
|
96 | + && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
97 | + && ! give_check_akismet_key() |
|
98 | 98 | ) { |
99 | 99 | self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
100 | 100 | |
@@ -763,9 +763,9 @@ discard block |
||
763 | 763 | <td class="give-docs-link" colspan="2"> |
764 | 764 | <?php |
765 | 765 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
766 | - . '" target="_blank">' |
|
767 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
768 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
766 | + . '" target="_blank">' |
|
767 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
768 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
769 | 769 | ?> |
770 | 770 | </td> |
771 | 771 | </tr><?php |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
111 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
111 | + if (isset($_POST['akismet_spam_protection']) |
|
112 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
113 | 113 | && ! give_check_akismet_key() |
114 | 114 | ) { |
115 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
115 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
116 | 116 | |
117 | 117 | return; |
118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.8 |
128 | 128 | */ |
129 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
129 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
130 | 130 | |
131 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
131 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Trigger Action. |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @since 1.8 |
141 | 141 | */ |
142 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
142 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public static function add_message( $code, $message ) { |
|
156 | - self::$messages[ $code ] = $message; |
|
155 | + public static function add_message($code, $message) { |
|
156 | + self::$messages[$code] = $message; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function add_error( $code, $message ) { |
|
170 | - self::$errors[ $code ] = $message; |
|
169 | + public static function add_error($code, $message) { |
|
170 | + self::$errors[$code] = $message; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $notice_html = ''; |
181 | 181 | $classes = 'give-notice settings-error notice is-dismissible'; |
182 | 182 | |
183 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
184 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
183 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
184 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
185 | 185 | |
186 | - if ( 0 < count( self::$errors ) ) { |
|
187 | - foreach ( self::$errors as $code => $message ) { |
|
188 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
186 | + if (0 < count(self::$errors)) { |
|
187 | + foreach (self::$errors as $code => $message) { |
|
188 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if ( 0 < count( self::$messages ) ) { |
|
193 | - foreach ( self::$messages as $code => $message ) { |
|
194 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
192 | + if (0 < count(self::$messages)) { |
|
193 | + foreach (self::$messages as $code => $message) { |
|
194 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | self::get_settings_pages(); |
233 | 233 | |
234 | 234 | // Save settings if data has been posted. |
235 | - if ( ! empty( $_POST ) ) { |
|
235 | + if ( ! empty($_POST)) { |
|
236 | 236 | self::save(); |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @since 1.8 |
247 | 247 | */ |
248 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
248 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
249 | 249 | |
250 | 250 | include 'views/html-admin-settings.php'; |
251 | 251 | |
@@ -263,25 +263,25 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return string|bool |
265 | 265 | */ |
266 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
266 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
267 | 267 | // Bailout. |
268 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
268 | + if (empty($option_name) && empty($field_id)) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
272 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
272 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
273 | 273 | // Get field value if any. |
274 | - $option_value = get_option( $option_name ); |
|
274 | + $option_value = get_option($option_name); |
|
275 | 275 | |
276 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
277 | - ? $option_value[ $field_id ] |
|
276 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
277 | + ? $option_value[$field_id] |
|
278 | 278 | : $default; |
279 | 279 | } else { |
280 | 280 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
281 | 281 | $option_name = ! $option_name ? $field_id : $option_name; |
282 | 282 | |
283 | 283 | // Get option value if any. |
284 | - $option_value = get_option( $option_name, $default ); |
|
284 | + $option_value = get_option($option_name, $default); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | return $option_value; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return void |
301 | 301 | */ |
302 | - public static function output_fields( $options, $option_name = '' ) { |
|
302 | + public static function output_fields($options, $option_name = '') { |
|
303 | 303 | $current_tab = give_get_current_setting_tab(); |
304 | 304 | |
305 | 305 | // Field Default values. |
@@ -312,52 +312,52 @@ discard block |
||
312 | 312 | 'table_html' => true, |
313 | 313 | ); |
314 | 314 | |
315 | - foreach ( $options as $value ) { |
|
316 | - if ( ! isset( $value['type'] ) ) { |
|
315 | + foreach ($options as $value) { |
|
316 | + if ( ! isset($value['type'])) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Set title. |
321 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
321 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
322 | 322 | |
323 | 323 | // Set default setting. |
324 | - $value = wp_parse_args( $value, $defaults ); |
|
324 | + $value = wp_parse_args($value, $defaults); |
|
325 | 325 | |
326 | 326 | // Colorpicker field. |
327 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
328 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
327 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
328 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
329 | 329 | |
330 | 330 | |
331 | 331 | // Custom attribute handling. |
332 | 332 | $custom_attributes = array(); |
333 | 333 | |
334 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
335 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
336 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
334 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
335 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
336 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Description handling. |
341 | - $description = self::get_field_description( $value ); |
|
341 | + $description = self::get_field_description($value); |
|
342 | 342 | |
343 | 343 | // Switch based on type. |
344 | - switch ( $value['type'] ) { |
|
344 | + switch ($value['type']) { |
|
345 | 345 | |
346 | 346 | // Section Titles |
347 | 347 | case 'title': |
348 | - if ( ! empty( $value['title'] ) ) { |
|
349 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
348 | + if ( ! empty($value['title'])) { |
|
349 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - if ( ! empty( $value['desc'] ) ) { |
|
353 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
352 | + if ( ! empty($value['desc'])) { |
|
353 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
354 | 354 | } |
355 | 355 | |
356 | - if ( $value['table_html'] ) { |
|
357 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
356 | + if ($value['table_html']) { |
|
357 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( ! empty( $value['id'] ) ) { |
|
360 | + if ( ! empty($value['id'])) { |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * Trigger Action. |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @since 1.8 |
368 | 368 | */ |
369 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
369 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | break; |
373 | 373 | |
374 | 374 | // Section Ends. |
375 | 375 | case 'sectionend': |
376 | - if ( ! empty( $value['id'] ) ) { |
|
376 | + if ( ! empty($value['id'])) { |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Trigger Action. |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | * |
383 | 383 | * @since 1.8 |
384 | 384 | */ |
385 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
385 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
386 | 386 | } |
387 | 387 | |
388 | - if ( $value['table_html'] ) { |
|
388 | + if ($value['table_html']) { |
|
389 | 389 | echo '</table>'; |
390 | 390 | } |
391 | 391 | |
392 | - if ( ! empty( $value['id'] ) ) { |
|
392 | + if ( ! empty($value['id'])) { |
|
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Trigger Action. |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @since 1.8 |
400 | 400 | */ |
401 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
401 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | break; |
@@ -406,27 +406,27 @@ discard block |
||
406 | 406 | // Standard text inputs and subtypes like 'number'. |
407 | 407 | case 'colorpicker': |
408 | 408 | case 'hidden' : |
409 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
409 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
410 | 410 | case 'text': |
411 | 411 | case 'email': |
412 | 412 | case 'number': |
413 | 413 | case 'password' : |
414 | 414 | $type = $value['type']; |
415 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
415 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
416 | 416 | ?> |
417 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
417 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
418 | 418 | <th scope="row" class="titledesc"> |
419 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
419 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
420 | 420 | </th> |
421 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
421 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
422 | 422 | <input |
423 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
424 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
425 | - type="<?php echo esc_attr( $type ); ?>" |
|
426 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
427 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
428 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
429 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
423 | + name="<?php echo esc_attr($value['id']); ?>" |
|
424 | + id="<?php echo esc_attr($value['id']); ?>" |
|
425 | + type="<?php echo esc_attr($type); ?>" |
|
426 | + style="<?php echo esc_attr($value['css']); ?>" |
|
427 | + value="<?php echo esc_attr($option_value); ?>" |
|
428 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
429 | + <?php echo implode(' ', $custom_attributes); ?> |
|
430 | 430 | /> <?php echo $description; ?> |
431 | 431 | </td> |
432 | 432 | </tr> |
@@ -436,23 +436,23 @@ discard block |
||
436 | 436 | // Textarea. |
437 | 437 | case 'textarea': |
438 | 438 | |
439 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
439 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
440 | 440 | |
441 | 441 | ?> |
442 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
442 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
443 | 443 | <th scope="row" class="titledesc"> |
444 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
444 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
445 | 445 | </th> |
446 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
446 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
447 | 447 | <textarea |
448 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
449 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
450 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
451 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
448 | + name="<?php echo esc_attr($value['id']); ?>" |
|
449 | + id="<?php echo esc_attr($value['id']); ?>" |
|
450 | + style="<?php echo esc_attr($value['css']); ?>" |
|
451 | + class="<?php echo esc_attr($value['class']); ?>" |
|
452 | 452 | rows="10" |
453 | 453 | cols="60" |
454 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
455 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
454 | + <?php echo implode(' ', $custom_attributes); ?> |
|
455 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
456 | 456 | <?php echo $description; ?> |
457 | 457 | </td> |
458 | 458 | </tr><?php |
@@ -462,35 +462,35 @@ discard block |
||
462 | 462 | case 'select' : |
463 | 463 | case 'multiselect' : |
464 | 464 | |
465 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
465 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
466 | 466 | |
467 | 467 | ?> |
468 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
468 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
469 | 469 | <th scope="row" class="titledesc"> |
470 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
470 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
471 | 471 | </th> |
472 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
472 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
473 | 473 | <select |
474 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
474 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
475 | 475 | echo '[]'; |
476 | 476 | } ?>" |
477 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
478 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
479 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
480 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
481 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
477 | + id="<?php echo esc_attr($value['id']); ?>" |
|
478 | + style="<?php echo esc_attr($value['css']); ?>" |
|
479 | + class="<?php echo esc_attr($value['class']); ?>" |
|
480 | + <?php echo implode(' ', $custom_attributes); ?> |
|
481 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
482 | 482 | > |
483 | 483 | |
484 | 484 | <?php |
485 | - if ( ! empty( $value['options'] ) ) { |
|
486 | - foreach ( $value['options'] as $key => $val ) { |
|
485 | + if ( ! empty($value['options'])) { |
|
486 | + foreach ($value['options'] as $key => $val) { |
|
487 | 487 | ?> |
488 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
488 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
489 | 489 | |
490 | - if ( is_array( $option_value ) ) { |
|
491 | - selected( in_array( $key, $option_value ), true ); |
|
490 | + if (is_array($option_value)) { |
|
491 | + selected(in_array($key, $option_value), true); |
|
492 | 492 | } else { |
493 | - selected( $option_value, $key ); |
|
493 | + selected($option_value, $key); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | ?>><?php echo $val ?></option> |
@@ -506,28 +506,28 @@ discard block |
||
506 | 506 | |
507 | 507 | // Radio inputs. |
508 | 508 | case 'radio_inline' : |
509 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
509 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
510 | 510 | case 'radio' : |
511 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
511 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
512 | 512 | ?> |
513 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
513 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
514 | 514 | <th scope="row" class="titledesc"> |
515 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
515 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
516 | 516 | </th> |
517 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
517 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
518 | 518 | <fieldset> |
519 | 519 | <ul> |
520 | 520 | <?php |
521 | - foreach ( $value['options'] as $key => $val ) { |
|
521 | + foreach ($value['options'] as $key => $val) { |
|
522 | 522 | ?> |
523 | 523 | <li> |
524 | 524 | <label><input |
525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
526 | 526 | value="<?php echo $key; ?>" |
527 | 527 | type="radio" |
528 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
529 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
530 | - <?php checked( $key, $option_value ); ?> |
|
528 | + style="<?php echo esc_attr($value['css']); ?>" |
|
529 | + <?php echo implode(' ', $custom_attributes); ?> |
|
530 | + <?php checked($key, $option_value); ?> |
|
531 | 531 | /> <?php echo $val ?></label> |
532 | 532 | </li> |
533 | 533 | <?php |
@@ -541,21 +541,21 @@ discard block |
||
541 | 541 | |
542 | 542 | // Checkbox input. |
543 | 543 | case 'checkbox' : |
544 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
544 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
545 | 545 | ?> |
546 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
546 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
547 | 547 | <th scope="row" class="titledesc"> |
548 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
548 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
549 | 549 | </th> |
550 | 550 | <td class="give-forminp"> |
551 | 551 | <input |
552 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
553 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
552 | + name="<?php echo esc_attr($value['id']); ?>" |
|
553 | + id="<?php echo esc_attr($value['id']); ?>" |
|
554 | 554 | type="checkbox" |
555 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
555 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
556 | 556 | value="1" |
557 | - <?php checked( $option_value, 'on' ); ?> |
|
558 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
557 | + <?php checked($option_value, 'on'); ?> |
|
558 | + <?php echo implode(' ', $custom_attributes); ?> |
|
559 | 559 | /> |
560 | 560 | <?php echo $description; ?> |
561 | 561 | </td> |
@@ -565,28 +565,28 @@ discard block |
||
565 | 565 | |
566 | 566 | // Multi Checkbox input. |
567 | 567 | case 'multicheck' : |
568 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
569 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
568 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
569 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
570 | 570 | ?> |
571 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
571 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
572 | 572 | <th scope="row" class="titledesc"> |
573 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
573 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
574 | 574 | </th> |
575 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
575 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
576 | 576 | <fieldset> |
577 | 577 | <ul> |
578 | 578 | <?php |
579 | - foreach ( $value['options'] as $key => $val ) { |
|
579 | + foreach ($value['options'] as $key => $val) { |
|
580 | 580 | ?> |
581 | 581 | <li> |
582 | 582 | <label> |
583 | 583 | <input |
584 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
584 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
585 | 585 | value="<?php echo $key; ?>" |
586 | 586 | type="checkbox" |
587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
589 | - <?php if ( in_array( $key, $option_value ) ) { |
|
587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
589 | + <?php if (in_array($key, $option_value)) { |
|
590 | 590 | echo 'checked="checked"'; |
591 | 591 | } ?> |
592 | 592 | /> <?php echo $val ?> |
@@ -605,35 +605,35 @@ discard block |
||
605 | 605 | // File input field. |
606 | 606 | case 'file' : |
607 | 607 | case 'media' : |
608 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
609 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
610 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
611 | - |
|
612 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
613 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '#'; |
|
614 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
615 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
608 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
609 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
610 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
611 | + |
|
612 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
613 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '#'; |
|
614 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
615 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
616 | 616 | ?> |
617 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
617 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
618 | 618 | <th scope="row" class="titledesc"> |
619 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
619 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
620 | 620 | </th> |
621 | 621 | <td class="give-forminp"> |
622 | 622 | <div class="give-field-wrap"> |
623 | 623 | <label for="<?php echo $value['id'] ?>"> |
624 | 624 | <input |
625 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
626 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
625 | + name="<?php echo esc_attr($value['id']); ?>" |
|
626 | + id="<?php echo esc_attr($value['id']); ?>" |
|
627 | 627 | type="text" |
628 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
628 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
629 | 629 | value="<?php echo $option_value; ?>" |
630 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
631 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
630 | + style="<?php echo esc_attr($value['css']); ?>" |
|
631 | + <?php echo implode(' ', $custom_attributes); ?> |
|
632 | 632 | /> <input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>"> |
633 | 633 | <?php echo $description ?> |
634 | 634 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
635 | 635 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
636 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
636 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
637 | 637 | </div> |
638 | 638 | </label> |
639 | 639 | </div> |
@@ -645,17 +645,17 @@ discard block |
||
645 | 645 | // WordPress Editor. |
646 | 646 | case 'wysiwyg' : |
647 | 647 | // Get option value. |
648 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
648 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
649 | 649 | |
650 | 650 | // Get editor settings. |
651 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
651 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
652 | 652 | ?> |
653 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
653 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
654 | 654 | <th scope="row" class="titledesc"> |
655 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
655 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
656 | 656 | </th> |
657 | 657 | <td class="give-forminp"> |
658 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
658 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
659 | 659 | <?php echo $description; ?> |
660 | 660 | </td> |
661 | 661 | </tr><?php |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | // Custom: System setting field. |
665 | 665 | case 'system_info' : |
666 | 666 | ?> |
667 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
667 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
668 | 668 | <th scope="row" class="titledesc"> |
669 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
669 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
670 | 670 | </th> |
671 | 671 | <td class="give-forminp"> |
672 | 672 | <?php give_system_info_callback(); ?> |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | |
678 | 678 | // Custom: Default gateways setting field. |
679 | 679 | case 'default_gateway' : |
680 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
680 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
681 | 681 | ?> |
682 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
682 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
683 | 683 | <th scope="row" class="titledesc"> |
684 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
684 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
685 | 685 | </th> |
686 | 686 | <td class="give-forminp"> |
687 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
687 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
688 | 688 | <?php echo $description; ?> |
689 | 689 | </td> |
690 | 690 | </tr><?php |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | |
693 | 693 | // Custom: Enable gateways setting field. |
694 | 694 | case 'enabled_gateways' : |
695 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
695 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
696 | 696 | ?> |
697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
698 | 698 | <th scope="row" class="titledesc"> |
699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
700 | 700 | </th> |
701 | 701 | <td class="give-forminp"> |
702 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
702 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
703 | 703 | <?php echo $description; ?> |
704 | 704 | </td> |
705 | 705 | </tr><?php |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | // Custom: Email preview buttons field. |
709 | 709 | case 'email_preview_buttons' : |
710 | 710 | ?> |
711 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
711 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
712 | 712 | <th scope="row" class="titledesc"> |
713 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
713 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
714 | 714 | </th> |
715 | 715 | <td class="give-forminp"> |
716 | 716 | <?php give_email_preview_buttons_callback(); ?> |
@@ -727,22 +727,22 @@ discard block |
||
727 | 727 | |
728 | 728 | // Custom: Gateway API key. |
729 | 729 | case 'api_key' : |
730 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
731 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
730 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
731 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
732 | 732 | ?> |
733 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
733 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
734 | 734 | <th scope="row" class="titledesc"> |
735 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
735 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
736 | 736 | </th> |
737 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
737 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
738 | 738 | <input |
739 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
740 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
741 | - type="<?php echo esc_attr( $type ); ?>" |
|
742 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
743 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
744 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
745 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
739 | + name="<?php echo esc_attr($value['id']); ?>" |
|
740 | + id="<?php echo esc_attr($value['id']); ?>" |
|
741 | + type="<?php echo esc_attr($type); ?>" |
|
742 | + style="<?php echo esc_attr($value['css']); ?>" |
|
743 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
744 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
745 | + <?php echo implode(' ', $custom_attributes); ?> |
|
746 | 746 | /> <?php echo $description; ?> |
747 | 747 | </td> |
748 | 748 | </tr><?php |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @since 1.0 |
761 | 761 | */ |
762 | - do_action( "give_logs_view_{$current_section}" ); |
|
762 | + do_action("give_logs_view_{$current_section}"); |
|
763 | 763 | |
764 | 764 | echo $description; |
765 | 765 | break; |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | // Custom: Data field. |
768 | 768 | case 'data' : |
769 | 769 | |
770 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
770 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
771 | 771 | |
772 | 772 | echo $description; |
773 | 773 | break; |
@@ -775,12 +775,12 @@ discard block |
||
775 | 775 | // Custom: Give Docs Link field type. |
776 | 776 | case 'give_docs_link' : |
777 | 777 | ?> |
778 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
778 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
779 | 779 | <td class="give-docs-link" colspan="2"> |
780 | 780 | <?php |
781 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
781 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
782 | 782 | . '" target="_blank">' |
783 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
783 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
784 | 784 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
785 | 785 | ?> |
786 | 786 | </td> |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | // You can add or handle your custom field action. |
792 | 792 | default: |
793 | 793 | // Get option value. |
794 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
795 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
794 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
795 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
796 | 796 | break; |
797 | 797 | } |
798 | 798 | } |
@@ -808,15 +808,15 @@ discard block |
||
808 | 808 | * |
809 | 809 | * @return string The HTML description of the field. |
810 | 810 | */ |
811 | - public static function get_field_description( $value ) { |
|
811 | + public static function get_field_description($value) { |
|
812 | 812 | $description = ''; |
813 | 813 | |
814 | 814 | // Support for both 'description' and 'desc' args. |
815 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
816 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
815 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
816 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
817 | 817 | |
818 | - if ( ! empty( $value ) ) { |
|
819 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
818 | + if ( ! empty($value)) { |
|
819 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | return $description; |
@@ -833,11 +833,11 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return array The description and tip as a 2 element array |
835 | 835 | */ |
836 | - public static function get_field_title( $value ) { |
|
837 | - $title = esc_html( $value['title'] ); |
|
836 | + public static function get_field_title($value) { |
|
837 | + $title = esc_html($value['title']); |
|
838 | 838 | |
839 | 839 | // If html tag detected then allow them to print. |
840 | - if ( strip_tags( $title ) ) { |
|
840 | + if (strip_tags($title)) { |
|
841 | 841 | $title = $value['title']; |
842 | 842 | } |
843 | 843 | |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @return bool |
858 | 858 | */ |
859 | - public static function save_fields( $options, $option_name = '' ) { |
|
860 | - if ( empty( $_POST ) ) { |
|
859 | + public static function save_fields($options, $option_name = '') { |
|
860 | + if (empty($_POST)) { |
|
861 | 861 | return false; |
862 | 862 | } |
863 | 863 | |
@@ -865,37 +865,37 @@ discard block |
||
865 | 865 | $update_options = array(); |
866 | 866 | |
867 | 867 | // Loop options and get values to save. |
868 | - foreach ( $options as $option ) { |
|
869 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
868 | + foreach ($options as $option) { |
|
869 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
870 | 870 | continue; |
871 | 871 | } |
872 | 872 | |
873 | 873 | // Get posted value. |
874 | - if ( strstr( $option['id'], '[' ) ) { |
|
875 | - parse_str( $option['id'], $option_name_array ); |
|
876 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
877 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
878 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
874 | + if (strstr($option['id'], '[')) { |
|
875 | + parse_str($option['id'], $option_name_array); |
|
876 | + $field_option_name = current(array_keys($option_name_array)); |
|
877 | + $setting_name = key($option_name_array[$field_option_name]); |
|
878 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
879 | 879 | } else { |
880 | 880 | $field_option_name = $option['id']; |
881 | 881 | $setting_name = ''; |
882 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
882 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | // Format the value based on option type. |
886 | - switch ( $option['type'] ) { |
|
886 | + switch ($option['type']) { |
|
887 | 887 | case 'checkbox' : |
888 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
888 | + $value = is_null($raw_value) ? '' : 'on'; |
|
889 | 889 | break; |
890 | 890 | case 'wysiwyg' : |
891 | 891 | case 'textarea' : |
892 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
892 | + $value = wp_kses_post(trim($raw_value)); |
|
893 | 893 | break; |
894 | 894 | case 'multiselect' : |
895 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
895 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
896 | 896 | break; |
897 | 897 | default : |
898 | - $value = give_clean( $raw_value ); |
|
898 | + $value = give_clean($raw_value); |
|
899 | 899 | break; |
900 | 900 | } |
901 | 901 | |
@@ -904,37 +904,37 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @since 1.8 |
906 | 906 | */ |
907 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
907 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
908 | 908 | |
909 | 909 | /** |
910 | 910 | * Sanitize the value of an option by option name. |
911 | 911 | * |
912 | 912 | * @since 1.8 |
913 | 913 | */ |
914 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
914 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
915 | 915 | |
916 | - if ( is_null( $value ) ) { |
|
916 | + if (is_null($value)) { |
|
917 | 917 | continue; |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Check if option is an array and handle that differently to single values. |
921 | - if ( $field_option_name && $setting_name ) { |
|
922 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
923 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
921 | + if ($field_option_name && $setting_name) { |
|
922 | + if ( ! isset($update_options[$field_option_name])) { |
|
923 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
924 | 924 | } |
925 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
926 | - $update_options[ $field_option_name ] = array(); |
|
925 | + if ( ! is_array($update_options[$field_option_name])) { |
|
926 | + $update_options[$field_option_name] = array(); |
|
927 | 927 | } |
928 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
928 | + $update_options[$field_option_name][$setting_name] = $value; |
|
929 | 929 | } else { |
930 | - $update_options[ $field_option_name ] = $value; |
|
930 | + $update_options[$field_option_name] = $value; |
|
931 | 931 | } |
932 | 932 | } |
933 | 933 | |
934 | 934 | // Save all options in our array or there own option name i.e. option id. |
935 | - if ( empty( $option_name ) ) { |
|
936 | - foreach ( $update_options as $name => $value ) { |
|
937 | - update_option( $name, $value ); |
|
935 | + if (empty($option_name)) { |
|
936 | + foreach ($update_options as $name => $value) { |
|
937 | + update_option($name, $value); |
|
938 | 938 | |
939 | 939 | /** |
940 | 940 | * Trigger action. |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | * |
944 | 944 | * @since 1.8 |
945 | 945 | */ |
946 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
946 | + do_action("give_save_option_{$name}", $value, $name); |
|
947 | 947 | } |
948 | 948 | } else { |
949 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
950 | - $update_options = array_merge( $old_options, $update_options ); |
|
949 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
950 | + $update_options = array_merge($old_options, $update_options); |
|
951 | 951 | |
952 | - update_option( $option_name, $update_options ); |
|
952 | + update_option($option_name, $update_options); |
|
953 | 953 | |
954 | 954 | /** |
955 | 955 | * Trigger action. |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | * |
959 | 959 | * @since 1.8 |
960 | 960 | */ |
961 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
961 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | return true; |
@@ -10,17 +10,17 @@ |
||
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 | <div class="wrap" id="poststuff"> |
18 | 18 | <div id="give-updates"> |
19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
20 | 20 | <hr class="wp-header-end"> |
21 | 21 | |
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give' ); ?></p> |
|
23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -18,33 +18,33 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <hr class="wp-header-end"> |
23 | 23 | |
24 | 24 | <div class="give-update-panel-content"> |
25 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
25 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <?php $update_counter = 1; ?> |
29 | 29 | |
30 | 30 | <?php $db_updates = $give_updates->get_db_update_count(); ?> |
31 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
32 | - <?php $db_update_url = add_query_arg( array( |
|
31 | + <?php if ( ! empty($db_updates)) : ?> |
|
32 | + <?php $db_update_url = add_query_arg(array( |
|
33 | 33 | 'type' => 'database', |
34 | - ) ); ?> |
|
34 | + )); ?> |
|
35 | 35 | <div id="give-db-updates"> |
36 | 36 | <div class="postbox-container"> |
37 | 37 | <div class="postbox"> |
38 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
38 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
39 | 39 | <div class="inside"> |
40 | 40 | <div class="panel-content"> |
41 | - <p class="give-update-button"><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now</a>', 'give' ), $db_update_url ); ?></p> |
|
41 | + <p class="give-update-button"><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now</a>', 'give'), $db_update_url); ?></p> |
|
42 | 42 | </div> |
43 | 43 | <div class="progress-container give-hidden"> |
44 | 44 | <p class="update-message" |
45 | 45 | data-update-count="<?php echo $db_updates; ?>" |
46 | 46 | data-resume-update="<?php echo $give_updates->resume_updates(); ?>"> |
47 | - <strong><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong> |
|
47 | + <strong><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong> |
|
48 | 48 | </p> |
49 | 49 | <div class="progress-content"></div> |
50 | 50 | </div> |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | <?php endif; ?> |
62 | 62 | |
63 | 63 | <?php $plugin_updates = $give_updates->get_plugin_update_count(); ?> |
64 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
65 | - <?php $plugin_update_url = add_query_arg( array( |
|
64 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
65 | + <?php $plugin_update_url = add_query_arg(array( |
|
66 | 66 | 's' => 'Give', |
67 | - ), admin_url( '/plugins.php' ) ); ?> |
|
67 | + ), admin_url('/plugins.php')); ?> |
|
68 | 68 | <div id="give-plugin-updates"> |
69 | 69 | <div class="postbox-container"> |
70 | 70 | <div class="postbox"> |
71 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
71 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
72 | 72 | <div class="inside"> |
73 | 73 | <div class="panel-content"> |
74 | - <p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
74 | + <p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
75 | 75 | <?php include_once 'plugins-update-section.php'; ?> |
76 | 76 | </div> |
77 | 77 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | <hr class="wp-header-end"> |
50 | 50 | |
51 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
51 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
52 | 52 | <input type="hidden" name="post_type" value="give_forms" /> |
53 | 53 | <input type="hidden" name="page" value="give-payment-history" /> |
54 | 54 | <?php $payments_table->views() ?> |
55 | 55 | <?php $payments_table->advanced_filters(); ?> |
56 | 56 | </form> |
57 | 57 | |
58 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
58 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
59 | 59 | <input type="hidden" name="post_type" value="give_forms" /> |
60 | 60 | <input type="hidden" name="page" value="give-payment-history" /> |
61 | 61 | <?php $payments_table->display() ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.7 |
69 | 69 | */ |
70 | - do_action( 'give_payments_page_bottom' ); |
|
70 | + do_action('give_payments_page_bottom'); |
|
71 | 71 | ?> |
72 | 72 | |
73 | 73 | </div> |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | * @param $title |
85 | 85 | * @return string |
86 | 86 | */ |
87 | -function give_view_order_details_title( $admin_title, $title ) { |
|
87 | +function give_view_order_details_title($admin_title, $title) { |
|
88 | 88 | |
89 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
89 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
90 | 90 | return $admin_title; |
91 | 91 | } |
92 | 92 | |
93 | - if( ! isset( $_GET['give-action'] ) ) { |
|
93 | + if ( ! isset($_GET['give-action'])) { |
|
94 | 94 | return $admin_title; |
95 | 95 | } |
96 | 96 | |
97 | - switch( $_GET['give-action'] ) : |
|
97 | + switch ($_GET['give-action']) : |
|
98 | 98 | |
99 | 99 | case 'view-payment-details' : |
100 | 100 | $title = sprintf( |
101 | 101 | /* translators: %s: admin title */ |
102 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
102 | + esc_html__('View Donation Details - %s', 'give'), |
|
103 | 103 | $admin_title |
104 | 104 | ); |
105 | 105 | break; |
106 | 106 | case 'edit-payment' : |
107 | 107 | $title = sprintf( |
108 | 108 | /* translators: %s: admin title */ |
109 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
109 | + esc_html__('Edit Donation - %s', 'give'), |
|
110 | 110 | $admin_title |
111 | 111 | ); |
112 | 112 | break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | return $title; |
119 | 119 | } |
120 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
120 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | * @param $context |
130 | 130 | * @return string |
131 | 131 | */ |
132 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
132 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
133 | 133 | |
134 | - $post = get_post( $post_id ); |
|
134 | + $post = get_post($post_id); |
|
135 | 135 | |
136 | - if( ! $post ) { |
|
136 | + if ( ! $post) { |
|
137 | 137 | return $url; |
138 | 138 | } |
139 | 139 | |
140 | - if( 'give_payment' != $post->post_type ) { |
|
140 | + if ('give_payment' != $post->post_type) { |
|
141 | 141 | return $url; |
142 | 142 | } |
143 | 143 | |
144 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
144 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
145 | 145 | |
146 | 146 | return $url; |
147 | 147 | } |
148 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
148 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | <?php |
56 | 56 | $args = array( |
57 | 57 | 'name' => 'form_id', |
58 | - 'number' => - 1, |
|
58 | + 'number' => -1, |
|
59 | 59 | 'chosen' => true, |
60 | 60 | ); |
61 | - echo Give()->html->forms_dropdown( $args ); |
|
61 | + echo Give()->html->forms_dropdown($args); |
|
62 | 62 | ?> |
63 | 63 | </span> |
64 | 64 | |
65 | 65 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
66 | 66 | <label for="delete-import-donors"> |
67 | 67 | <?php |
68 | - echo Give()->html->checkbox( array( |
|
68 | + echo Give()->html->checkbox(array( |
|
69 | 69 | 'name' => 'delete-import-donors' |
70 | - ) ); |
|
71 | - _e( 'Delete imported WordPress users', 'give' ); |
|
70 | + )); |
|
71 | + _e('Delete imported WordPress users', 'give'); |
|
72 | 72 | ?> |
73 | 73 | </label> |
74 | 74 | </span> |
75 | 75 | |
76 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
76 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
77 | 77 | |
78 | 78 | <br/> |
79 | 79 | |
80 | 80 | <span class="give-recount-stats-descriptions"> |
81 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
82 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
83 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
81 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
82 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
83 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | 85 | <?php |
86 | 86 | /** |
87 | 87 | * Fires in the recount stats description area. |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.5 |
92 | 92 | */ |
93 | - do_action( 'give_recount_tool_descriptions' ); |
|
93 | + do_action('give_recount_tool_descriptions'); |
|
94 | 94 | ?> |
95 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
96 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
95 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
96 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
97 | 97 | </span> |
98 | 98 | |
99 | 99 | <span class="spinner"></span> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @since 1.5 |
109 | 109 | */ |
110 | - do_action( 'give_tools_recount_forms' ); |
|
110 | + do_action('give_tools_recount_forms'); |
|
111 | 111 | ?> |
112 | 112 | </div><!-- .inside --> |
113 | 113 | </div><!-- .postbox --> |
@@ -118,4 +118,4 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.5 |
120 | 120 | */ |
121 | -do_action( 'give_tools_recount_stats_after' ); |
|
121 | +do_action('give_tools_recount_stats_after'); |