@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string $message Fully formatted message |
56 | 56 | */ |
57 | -function give_email_preview_template_tags( $message ) { |
|
57 | +function give_email_preview_template_tags($message) { |
|
58 | 58 | |
59 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
59 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
60 | 60 | |
61 | 61 | $gateway = 'PayPal'; |
62 | 62 | |
63 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
63 | + $receipt_id = strtolower(md5(uniqid())); |
|
64 | 64 | |
65 | - $notes = __( 'These are some sample notes added to a donation.', 'give' ); |
|
65 | + $notes = __('These are some sample notes added to a donation.', 'give'); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - __( 'View the receipt in your browser', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + __('View the receipt in your browser', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{price}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', 'Sample Donation Form Title', $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{product_notes}', $notes, $message ); |
|
87 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
88 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{price}', $price, $message); |
|
82 | + $message = str_replace('{donation}', 'Sample Donation Form Title', $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{product_notes}', $notes, $message); |
|
87 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
88 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | * @since 1.0 |
101 | 101 | * @return array|bool |
102 | 102 | */ |
103 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
103 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
104 | 104 | |
105 | -function give_email_template_preview( $array ) { |
|
105 | +function give_email_template_preview($array) { |
|
106 | 106 | |
107 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
107 | + if ( ! current_user_can('manage_give_settings')) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | $custom_field = array( |
111 | - 'name' => __( 'Preview Email', 'give' ), |
|
112 | - 'desc' => __( 'Click the buttons to preview emails.', 'give' ), |
|
111 | + 'name' => __('Preview Email', 'give'), |
|
112 | + 'desc' => __('Click the buttons to preview emails.', 'give'), |
|
113 | 113 | 'id' => 'give_email_preview_buttons', |
114 | 114 | 'type' => 'email_preview_buttons' |
115 | 115 | ); |
116 | - array_splice( $array, 5, 0, array( $custom_field ) ); |
|
116 | + array_splice($array, 5, 0, array($custom_field)); |
|
117 | 117 | |
118 | 118 | return $array; // splice in at position 3; |
119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | function give_email_preview_buttons_callback() { |
130 | 130 | ob_start(); |
131 | 131 | ?> |
132 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php _e( 'Donation Receipt Preview', 'give' ); ?> "><?php _e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
133 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
132 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php _e('Donation Receipt Preview', 'give'); ?> "><?php _e('Preview Donation Receipt', 'give'); ?></a> |
|
133 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_test_email', |
135 | 135 | 'give-message' => 'sent-test-email' |
136 | - ) ), 'give-test-email' ); ?>" title="<?php _e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php _e( 'Send Test Email', 'give' ); ?></a> |
|
136 | + )), 'give-test-email'); ?>" title="<?php _e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php _e('Send Test Email', 'give'); ?></a> |
|
137 | 137 | <?php |
138 | 138 | echo ob_get_clean(); |
139 | 139 | } |
@@ -146,27 +146,27 @@ discard block |
||
146 | 146 | */ |
147 | 147 | function give_display_email_template_preview() { |
148 | 148 | |
149 | - if ( empty( $_GET['give_action'] ) ) { |
|
149 | + if (empty($_GET['give_action'])) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
153 | + if ('preview_email' !== $_GET['give_action']) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
157 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
157 | + if ( ! current_user_can('manage_give_settings')) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - Give()->emails->heading = __( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = __('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) ); |
|
163 | + echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array()))); |
|
164 | 164 | |
165 | 165 | exit; |
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'template_redirect', 'give_display_email_template_preview' ); |
|
169 | +add_action('template_redirect', 'give_display_email_template_preview'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Email Template Body |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string $email_body Body of the email |
180 | 180 | */ |
181 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
181 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
182 | 182 | |
183 | 183 | global $give_options; |
184 | 184 | |
185 | 185 | $default_email_body = give_get_default_donation_receipt_email(); |
186 | 186 | |
187 | - $email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body; |
|
187 | + $email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body; |
|
188 | 188 | |
189 | - $email_body = wpautop( $email ); |
|
189 | + $email_body = wpautop($email); |
|
190 | 190 | |
191 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
191 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
192 | 192 | |
193 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
193 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -206,37 +206,37 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return string $email_body Body of the email |
208 | 208 | */ |
209 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
209 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
210 | 210 | global $give_options; |
211 | 211 | |
212 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
213 | - $email = give_get_payment_user_email( $payment_id ); |
|
212 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
213 | + $email = give_get_payment_user_email($payment_id); |
|
214 | 214 | |
215 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
216 | - $user_data = get_userdata( $user_info['id'] ); |
|
215 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
216 | + $user_data = get_userdata($user_info['id']); |
|
217 | 217 | $name = $user_data->display_name; |
218 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
219 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
218 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
219 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
220 | 220 | } else { |
221 | 221 | $name = $email; |
222 | 222 | } |
223 | 223 | |
224 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
224 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
225 | 225 | |
226 | - $default_email_body = __( 'Hello', 'give' ) . "\n\n" . __( 'A donation has been made', 'give' ) . ".\n\n"; |
|
227 | - $default_email_body .= sprintf( __( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n"; |
|
226 | + $default_email_body = __('Hello', 'give')."\n\n".__('A donation has been made', 'give').".\n\n"; |
|
227 | + $default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n"; |
|
228 | 228 | |
229 | - $default_email_body .= __( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
230 | - $default_email_body .= __( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
231 | - $default_email_body .= __( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n"; |
|
229 | + $default_email_body .= __('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
230 | + $default_email_body .= __('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
231 | + $default_email_body .= __('Payment Method: ', 'give')." ".$gateway."\n\n"; |
|
232 | 232 | |
233 | - $default_email_body .= __( 'Thank you', 'give' ); |
|
233 | + $default_email_body .= __('Thank you', 'give'); |
|
234 | 234 | |
235 | - $email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body; |
|
235 | + $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body; |
|
236 | 236 | |
237 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
237 | + $email_body = give_do_email_tags($email, $payment_id); |
|
238 | 238 | |
239 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
239 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -249,15 +249,15 @@ discard block |
||
249 | 249 | * @since 1.0 |
250 | 250 | */ |
251 | 251 | function give_render_receipt_in_browser() { |
252 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
253 | - wp_die( __( 'Missing donation payment key.', 'give' ), __( 'Error', 'give' ) ); |
|
252 | + if ( ! isset($_GET['payment_key'])) { |
|
253 | + wp_die(__('Missing donation payment key.', 'give'), __('Error', 'give')); |
|
254 | 254 | } |
255 | 255 | |
256 | - $key = urlencode( $_GET['payment_key'] ); |
|
256 | + $key = urlencode($_GET['payment_key']); |
|
257 | 257 | |
258 | 258 | ob_start(); |
259 | 259 | //Disallows caching of the page |
260 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
260 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
261 | 261 | header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
262 | 262 | header("Cache-Control: post-check=0, pre-check=0", false); |
263 | 263 | header("Pragma: no-cache"); // HTTP/1.0 |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | <!DOCTYPE html> |
267 | 267 | <html lang="en"> |
268 | 268 | <head> |
269 | - <title><?php _e( 'Donation Receipt', 'give' ); ?></title> |
|
269 | + <title><?php _e('Donation Receipt', 'give'); ?></title> |
|
270 | 270 | <meta charset="utf-8" /> |
271 | 271 | |
272 | 272 | <!-- Further disallowing of caching of this page --> |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | |
281 | 281 | <?php wp_head(); ?> |
282 | 282 | </head> |
283 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
283 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
284 | 284 | |
285 | 285 | <div id="give_receipt_wrapper"> |
286 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
287 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
288 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
286 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
287 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
288 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
289 | 289 | </div> |
290 | 290 | |
291 | 291 | <?php wp_footer(); ?> |
@@ -296,4 +296,4 @@ discard block |
||
296 | 296 | die(); |
297 | 297 | } |
298 | 298 | |
299 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
299 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,49 +107,49 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', __( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', __('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | function give_get_admin_notice_emails() { |
163 | 163 | global $give_options; |
164 | 164 | |
165 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
166 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
165 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
166 | + $emails = array_map('trim', explode("\n", $emails)); |
|
167 | 167 | |
168 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
168 | + return apply_filters('give_admin_notice_emails', $emails); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
180 | +function give_admin_notices_disabled($payment_id = 0) { |
|
181 | 181 | |
182 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
182 | + $retval = give_get_option('disable_admin_notices'); |
|
183 | 183 | |
184 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
184 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | */ |
195 | 195 | function give_get_default_donation_notification_email() { |
196 | 196 | |
197 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
198 | - $default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
199 | - $default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
202 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
197 | + $default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
198 | + $default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
199 | + $default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
202 | + $default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}'; |
|
203 | 203 | |
204 | - $custom_message = give_get_option( 'donation_notification' ); |
|
205 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
204 | + $custom_message = give_get_option('donation_notification'); |
|
205 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
206 | 206 | |
207 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
207 | + return apply_filters('give_default_donation_notification_email', $message); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -218,26 +218,26 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function give_get_default_donation_receipt_email() { |
220 | 220 | |
221 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
222 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
223 | - $default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
224 | - $default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
230 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
221 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
222 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
223 | + $default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
224 | + $default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
230 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
231 | 231 | |
232 | 232 | $default_email_body .= "\n\n"; |
233 | - $default_email_body .= __( 'Sincerely,', 'give' ); |
|
234 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
233 | + $default_email_body .= __('Sincerely,', 'give'); |
|
234 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
235 | 235 | |
236 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
236 | + $custom_message = give_get_option('donation_receipt'); |
|
237 | 237 | |
238 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
238 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
239 | 239 | |
240 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
240 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return array $email_names |
251 | 251 | */ |
252 | -function give_get_email_names( $user_info ) { |
|
252 | +function give_get_email_names($user_info) { |
|
253 | 253 | $email_names = array(); |
254 | - $user_info = maybe_unserialize( $user_info ); |
|
254 | + $user_info = maybe_unserialize($user_info); |
|
255 | 255 | |
256 | 256 | $email_names['fullname'] = ''; |
257 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
258 | - $user_data = get_userdata( $user_info['id'] ); |
|
257 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
258 | + $user_data = get_userdata($user_info['id']); |
|
259 | 259 | $email_names['name'] = $user_info['first_name']; |
260 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
260 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
261 | 261 | $email_names['username'] = $user_data->user_login; |
262 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
262 | + } elseif (isset($user_info['first_name'])) { |
|
263 | 263 | $email_names['name'] = $user_info['first_name']; |
264 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
264 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
265 | 265 | $email_names['username'] = $user_info['first_name']; |
266 | 266 | } else { |
267 | 267 | $email_names['name'] = $user_info['email']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
33 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
32 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
33 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">★★★★★</a>' |
|
34 | 34 | ); |
35 | 35 | |
36 | 36 | return $rate_text; |
@@ -39,4 +39,4 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
42 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | 34 | $create_form_link = sprintf( |
35 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
36 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
35 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
36 | + admin_url('post-new.php?post_type=give_forms') |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | return array( |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_text', |
60 | - 'label' => __( 'Show Text:', 'give' ), |
|
61 | - 'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
60 | + 'label' => __('Show Text:', 'give'), |
|
61 | + 'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_bar', |
70 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
70 | + 'label' => __('Show Progress Bar:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | public function define_fields() { |
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,68 +46,68 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
49 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
52 | + 'alert' => __('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_title', |
63 | - 'label' => __( 'Show Title:', 'give' ), |
|
64 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
63 | + 'label' => __('Show Title:', 'give'), |
|
64 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => __( 'Show', 'give' ), |
|
67 | - 'false' => __( 'Hide', 'give' ), |
|
66 | + 'true' => __('Show', 'give'), |
|
67 | + 'false' => __('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_goal', |
73 | - 'label' => __( 'Show Goal:', 'give' ), |
|
74 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
73 | + 'label' => __('Show Goal:', 'give'), |
|
74 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => __( 'Show', 'give' ), |
|
77 | - 'false' => __( 'Hide', 'give' ), |
|
76 | + 'true' => __('Show', 'give'), |
|
77 | + 'false' => __('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | array( |
81 | 81 | 'type' => 'listbox', |
82 | 82 | 'name' => 'show_content', |
83 | 83 | 'minWidth' => 240, |
84 | - 'label' => __( 'Display Content:', 'give' ), |
|
85 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
84 | + 'label' => __('Display Content:', 'give'), |
|
85 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
86 | 86 | 'options' => array( |
87 | - 'none' => __( 'No Content', 'give' ), |
|
88 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
89 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
87 | + 'none' => __('No Content', 'give'), |
|
88 | + 'above' => __('Display above the form fields', 'give'), |
|
89 | + 'below' => __('Display below the form fields', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | 93 | 'type' => 'listbox', |
94 | 94 | 'name' => 'display_style', |
95 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
96 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
95 | + 'label' => __('Payment Fields:', 'give'), |
|
96 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
97 | 97 | 'options' => array( |
98 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
99 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
100 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
98 | + 'onpage' => __('Show on Page', 'give'), |
|
99 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
100 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'type' => 'listbox', |
105 | 105 | 'name' => 'float_labels', |
106 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
107 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
106 | + 'label' => __('Floating Labels:', 'give'), |
|
107 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
108 | 108 | 'options' => array( |
109 | - 'enabled' => __( 'Enabled', 'give' ), |
|
110 | - 'disabled' => __( 'Disabled', 'give' ), |
|
109 | + 'enabled' => __('Enabled', 'give'), |
|
110 | + 'disabled' => __('Disabled', 'give'), |
|
111 | 111 | ), |
112 | 112 | ), |
113 | 113 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param $_banner_details |
26 | 26 | */ |
27 | - function __construct( $_banner_details ) { |
|
27 | + function __construct($_banner_details) { |
|
28 | 28 | |
29 | 29 | global $current_user; |
30 | 30 | $this->banner_details = $_banner_details; |
31 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
32 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
31 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
32 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
33 | 33 | |
34 | 34 | //Get current user |
35 | 35 | $this->user_id = $current_user->ID; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | public function init() { |
49 | 49 | |
50 | 50 | //Testing? |
51 | - if ( $this->test_mode ) { |
|
52 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
51 | + if ($this->test_mode) { |
|
52 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | //Get the current page to add the notice to |
56 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
57 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
56 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
57 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | global $pagenow; |
70 | 70 | |
71 | 71 | //Make sure we're on the plugins page. |
72 | - if ( $pagenow !== 'plugins.php' ) { |
|
72 | + if ($pagenow !== 'plugins.php') { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // If the user hasn't already dismissed our alert, |
77 | 77 | // Output the activation banner |
78 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
78 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
79 | 79 | |
80 | 80 | <!-- * I output inline styles here |
81 | 81 | * because there's no reason to keep these |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | <!-- Your Message --> |
155 | 155 | <h3><?php |
156 | 156 | printf( |
157 | - __( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
158 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
157 | + __("Thank you for installing Give's %s Add-on!", 'give'), |
|
158 | + '<span>'.$this->banner_details['name'].'</span>' |
|
159 | 159 | ); |
160 | 160 | ?></h3> |
161 | 161 | |
162 | 162 | <a href="<?php |
163 | 163 | //The Dismiss Button |
164 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
165 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
164 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
165 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
166 | 166 | |
167 | 167 | <!-- * Now we output a few "actions" |
168 | 168 | * that the user can take from here --> |
@@ -170,24 +170,24 @@ discard block |
||
170 | 170 | <div class="alert-actions"> |
171 | 171 | |
172 | 172 | <?php //Point them to your settings page |
173 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
173 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
174 | 174 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
175 | - <span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?> |
|
175 | + <span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?> |
|
176 | 176 | </a> |
177 | 177 | <?php } ?> |
178 | 178 | |
179 | 179 | <?php |
180 | 180 | // Show them how to configure the Addon |
181 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
182 | - <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf( __( 'Documentation: %s Add-on', 'give' ), $this->banner_details['name'] ); ?> |
|
181 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
182 | + <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf(__('Documentation: %s Add-on', 'give'), $this->banner_details['name']); ?> |
|
183 | 183 | </a> |
184 | 184 | <?php } ?> |
185 | 185 | <?php |
186 | 186 | //Let them signup for plugin updates |
187 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
187 | + if (isset($this->banner_details['support_url'])) { ?> |
|
188 | 188 | |
189 | 189 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
190 | - <span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?> |
|
190 | + <span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?> |
|
191 | 191 | </a> |
192 | 192 | |
193 | 193 | <?php } ?> |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
209 | 209 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
210 | 210 | */ |
211 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
211 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
212 | 212 | |
213 | 213 | //Get the global user |
214 | 214 | global $current_user; |
215 | 215 | $user_id = $current_user->ID; |
216 | 216 | |
217 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
217 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 1.4 |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class Give_Email_Access |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | |
32 | 32 | // get it started |
33 | - add_action( 'init', array( $this, 'init' ) ); |
|
33 | + add_action('init', array($this, 'init')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init() { |
41 | 41 | |
42 | - $is_enabled = give_get_option( 'email_access' ); |
|
42 | + $is_enabled = give_get_option('email_access'); |
|
43 | 43 | |
44 | 44 | //Non-logged in users only |
45 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
45 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Are db columns setup? |
50 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
51 | - if ( empty( $is_setup ) ) { |
|
50 | + $is_setup = give_get_option('email_access_installed'); |
|
51 | + if (empty($is_setup)) { |
|
52 | 52 | $this->create_columns(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Timeouts |
56 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
57 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
56 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
57 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
58 | 58 | |
59 | 59 | // Setup login |
60 | 60 | $this->check_for_token(); |
61 | 61 | |
62 | - if ( $this->token_exists ) { |
|
63 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
64 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
65 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
62 | + if ($this->token_exists) { |
|
63 | + add_filter('give_can_view_receipt', '__return_true'); |
|
64 | + add_filter('give_user_pending_verification', '__return_false'); |
|
65 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - function can_send_email( $customer_id ) { |
|
76 | + function can_send_email($customer_id) { |
|
77 | 77 | global $wpdb; |
78 | 78 | |
79 | 79 | // Prevent multiple emails within X minutes |
80 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
80 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
81 | 81 | |
82 | 82 | // Does a user row exist? |
83 | 83 | $exists = (int) $wpdb->get_var( |
84 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
84 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
85 | 85 | ); |
86 | 86 | |
87 | - if ( 0 < $exists ) { |
|
87 | + if (0 < $exists) { |
|
88 | 88 | $row_id = (int) $wpdb->get_var( |
89 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
89 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
90 | 90 | ); |
91 | 91 | |
92 | - if ( $row_id < 1 ) { |
|
93 | - give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
92 | + if ($row_id < 1) { |
|
93 | + give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
94 | 94 | |
95 | 95 | return false; |
96 | 96 | } |
@@ -106,38 +106,38 @@ discard block |
||
106 | 106 | * @param $customer_id |
107 | 107 | * @param $email |
108 | 108 | */ |
109 | - function send_email( $customer_id, $email ) { |
|
109 | + function send_email($customer_id, $email) { |
|
110 | 110 | |
111 | - $verify_key = wp_generate_password( 20, false ); |
|
111 | + $verify_key = wp_generate_password(20, false); |
|
112 | 112 | |
113 | 113 | // Generate a new verify key |
114 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
114 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
115 | 115 | |
116 | 116 | // Get the purchase history URL |
117 | - $page_id = give_get_option( 'history_page' ); |
|
117 | + $page_id = give_get_option('history_page'); |
|
118 | 118 | |
119 | - $access_url = add_query_arg( array( |
|
119 | + $access_url = add_query_arg(array( |
|
120 | 120 | 'give_nl' => $verify_key, |
121 | - ), get_permalink( $page_id ) ); |
|
121 | + ), get_permalink($page_id)); |
|
122 | 122 | |
123 | 123 | //Nice subject and message |
124 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
124 | + $subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
125 | 125 | |
126 | - $message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
126 | + $message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
127 | 127 | |
128 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access My Donation Details', 'give' ) . ' »</a>'; |
|
128 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access My Donation Details', 'give').' »</a>'; |
|
129 | 129 | |
130 | 130 | $message .= "\n\n"; |
131 | 131 | $message .= "\n\n"; |
132 | - $message .= __( 'Sincerely,', 'give' ); |
|
133 | - $message .= "\n" . get_bloginfo( 'name' ) . "\n"; |
|
132 | + $message .= __('Sincerely,', 'give'); |
|
133 | + $message .= "\n".get_bloginfo('name')."\n"; |
|
134 | 134 | |
135 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
135 | + $message = apply_filters('give_email_access_token_message', $message); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // Send the email |
139 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) ); |
|
140 | - Give()->emails->send( $email, $subject, $message ); |
|
139 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give'))); |
|
140 | + Give()->emails->send($email, $subject, $message); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function check_for_token() { |
149 | 149 | |
150 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
150 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
151 | 151 | |
152 | 152 | // Check for cookie |
153 | - if ( empty( $token ) ) { |
|
154 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
153 | + if (empty($token)) { |
|
154 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | - if ( ! empty( $token ) ) { |
|
158 | - if ( ! $this->is_valid_token( $token ) ) { |
|
159 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
157 | + if ( ! empty($token)) { |
|
158 | + if ( ! $this->is_valid_token($token)) { |
|
159 | + if ( ! $this->is_valid_verify_key($token)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->token_exists = true; |
165 | 165 | // Set cookie |
166 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
167 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
166 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
167 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool |
177 | 177 | */ |
178 | - function is_valid_token( $token ) { |
|
178 | + function is_valid_token($token) { |
|
179 | 179 | |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Make sure token isn't expired |
183 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
183 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
184 | 184 | |
185 | 185 | $email = $wpdb->get_var( |
186 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
186 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
187 | 187 | ); |
188 | 188 | |
189 | - if ( ! empty( $email ) ) { |
|
189 | + if ( ! empty($email)) { |
|
190 | 190 | $this->token_email = $email; |
191 | 191 | $this->token = $token; |
192 | 192 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | //Set error only if email access form isn't being submitted |
197 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
198 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) ); |
|
197 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
198 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give')); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | * @param $email |
211 | 211 | * @param $verify_key |
212 | 212 | */ |
213 | - function set_verify_key( $customer_id, $email, $verify_key ) { |
|
213 | + function set_verify_key($customer_id, $email, $verify_key) { |
|
214 | 214 | global $wpdb; |
215 | 215 | |
216 | - $now = date( 'Y-m-d H:i:s' ); |
|
216 | + $now = date('Y-m-d H:i:s'); |
|
217 | 217 | |
218 | 218 | // Insert or update? |
219 | 219 | $row_id = (int) $wpdb->get_var( |
220 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
220 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | // Update |
224 | - if ( ! empty( $row_id ) ) { |
|
224 | + if ( ! empty($row_id)) { |
|
225 | 225 | $wpdb->query( |
226 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
226 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
227 | 227 | ); |
228 | 228 | } // Insert |
229 | 229 | else { |
230 | 230 | $wpdb->query( |
231 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
231 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
232 | 232 | ); |
233 | 233 | } |
234 | 234 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - function is_valid_verify_key( $token ) { |
|
243 | + function is_valid_verify_key($token) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // See if the verify_key exists |
247 | 247 | $row = $wpdb->get_row( |
248 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
248 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
249 | 249 | ); |
250 | 250 | |
251 | - $now = date( 'Y-m-d H:i:s' ); |
|
251 | + $now = date('Y-m-d H:i:s'); |
|
252 | 252 | |
253 | 253 | // Set token |
254 | - if ( ! empty( $row ) ) { |
|
254 | + if ( ! empty($row)) { |
|
255 | 255 | $wpdb->query( |
256 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
256 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | $this->token_email = $row->email; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - function users_purchases_args( $args ) { |
|
275 | + function users_purchases_args($args) { |
|
276 | 276 | $args['user'] = $this->token_email; |
277 | 277 | |
278 | 278 | return $args; |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | global $wpdb; |
290 | 290 | |
291 | 291 | //Create columns in customers table |
292 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
292 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
293 | 293 | |
294 | 294 | //Columns added properly |
295 | - if ( $query ) { |
|
296 | - give_update_option( 'email_access_installed', 1 ); |
|
295 | + if ($query) { |
|
296 | + give_update_option('email_access_installed', 1); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,55 +40,55 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
60 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' ); |
|
61 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>'); |
|
61 | + echo wpautop(stripslashes($offline_instructions)); |
|
62 | 62 | ?> |
63 | 63 | </fieldset> |
64 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
64 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
65 | 65 | <?php |
66 | 66 | echo ob_get_clean(); |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
69 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Give Offline Billing Field |
73 | 73 | * |
74 | 74 | * @param $form_id |
75 | 75 | */ |
76 | -function give_offline_billing_fields( $form_id ) { |
|
76 | +function give_offline_billing_fields($form_id) { |
|
77 | 77 | //Enable Default CC fields (billing info) |
78 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
79 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
78 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
79 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
80 | 80 | |
81 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
81 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
82 | 82 | |
83 | 83 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
84 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
85 | - give_default_cc_address_fields( $form_id ); |
|
86 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
87 | - give_default_cc_address_fields( $form_id ); |
|
84 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
85 | + give_default_cc_address_fields($form_id); |
|
86 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
87 | + give_default_cc_address_fields($form_id); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
91 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Process the payment |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_offline_process_payment( $purchase_data ) { |
|
102 | +function give_offline_process_payment($purchase_data) { |
|
103 | 103 | |
104 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
104 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
105 | 105 | |
106 | 106 | // setup the payment details |
107 | 107 | $payment_data = array( |
108 | 108 | 'price' => $purchase_data['price'], |
109 | 109 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
110 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
111 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
110 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
111 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
112 | 112 | 'date' => $purchase_data['date'], |
113 | 113 | 'user_email' => $purchase_data['user_email'], |
114 | 114 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | // record the pending payment |
123 | - $payment = give_insert_payment( $payment_data ); |
|
123 | + $payment = give_insert_payment($payment_data); |
|
124 | 124 | |
125 | - if ( $payment ) { |
|
126 | - give_offline_send_admin_notice( $payment ); |
|
127 | - give_offline_send_donor_instructions( $payment ); |
|
125 | + if ($payment) { |
|
126 | + give_offline_send_admin_notice($payment); |
|
127 | + give_offline_send_donor_instructions($payment); |
|
128 | 128 | give_send_to_success_page(); |
129 | 129 | } else { |
130 | 130 | // if errors are present, send the user back to the donation form so they can be corrected |
131 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
131 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | } |
135 | 135 | |
136 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
136 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -146,47 +146,47 @@ discard block |
||
146 | 146 | * @since 1.0 |
147 | 147 | * @return void |
148 | 148 | */ |
149 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
149 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
150 | 150 | |
151 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
152 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
151 | + $payment_data = give_get_payment_meta($payment_id); |
|
152 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
153 | 153 | |
154 | 154 | //Customize email content depending on whether the single form has been customized |
155 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
155 | + $email_content = give_get_option('global_offline_donation_email'); |
|
156 | 156 | |
157 | - if ( $post_offline_customization_option === 'yes' ) { |
|
158 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
157 | + if ($post_offline_customization_option === 'yes') { |
|
158 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
159 | 159 | } |
160 | 160 | |
161 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
162 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
161 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
162 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
163 | 163 | |
164 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
165 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
164 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
165 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
166 | 166 | |
167 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
167 | + $to_email = give_get_payment_user_email($payment_id); |
|
168 | 168 | |
169 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
170 | - if ( $post_offline_customization_option === 'yes' ) { |
|
171 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
169 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
170 | + if ($post_offline_customization_option === 'yes') { |
|
171 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
172 | 172 | } |
173 | 173 | |
174 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
175 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
174 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
175 | + $subject = give_do_email_tags($subject, $payment_id); |
|
176 | 176 | |
177 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
178 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
177 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
178 | + $message = give_do_email_tags($email_content, $payment_id); |
|
179 | 179 | |
180 | 180 | $emails = Give()->emails; |
181 | 181 | |
182 | - $emails->__set( 'from_name', $from_name ); |
|
183 | - $emails->__set( 'from_email', $from_email ); |
|
184 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
182 | + $emails->__set('from_name', $from_name); |
|
183 | + $emails->__set('from_email', $from_email); |
|
184 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
185 | 185 | |
186 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
187 | - $emails->__set( 'headers', $headers ); |
|
186 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
187 | + $emails->__set('headers', $headers); |
|
188 | 188 | |
189 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
189 | + $emails->send($to_email, $subject, $message, $attachments); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
@@ -203,50 +203,50 @@ discard block |
||
203 | 203 | * @return void |
204 | 204 | * |
205 | 205 | */ |
206 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
206 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
207 | 207 | |
208 | 208 | /* Send an email notification to the admin */ |
209 | 209 | $admin_email = give_get_admin_notice_emails(); |
210 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
210 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
211 | 211 | |
212 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
213 | - $user_data = get_userdata( $user_info['id'] ); |
|
212 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
213 | + $user_data = get_userdata($user_info['id']); |
|
214 | 214 | $name = $user_data->display_name; |
215 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
216 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
215 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
216 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
217 | 217 | } else { |
218 | 218 | $name = $user_info['email']; |
219 | 219 | } |
220 | 220 | |
221 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
221 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
222 | 222 | |
223 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
223 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
224 | 224 | |
225 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
226 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
227 | - $admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
225 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
226 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
227 | + $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
228 | 228 | |
229 | 229 | |
230 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
231 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n"; |
|
230 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n"; |
|
232 | 232 | |
233 | 233 | $admin_message .= sprintf( |
234 | 234 | '<a href="%1$s">%2$s</a>', |
235 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
236 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
237 | - ) . "\n\n"; |
|
235 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
236 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
237 | + )."\n\n"; |
|
238 | 238 | |
239 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
240 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
241 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
239 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
240 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
241 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
242 | 242 | |
243 | 243 | //Send Email |
244 | 244 | $emails = Give()->emails; |
245 | - if ( ! empty( $admin_headers ) ) { |
|
246 | - $emails->__set( 'headers', $admin_headers ); |
|
245 | + if ( ! empty($admin_headers)) { |
|
246 | + $emails->__set('headers', $admin_headers); |
|
247 | 247 | } |
248 | 248 | |
249 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
249 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | * @since 1.0 |
258 | 258 | * @return array |
259 | 259 | */ |
260 | -function give_offline_add_settings( $settings ) { |
|
260 | +function give_offline_add_settings($settings) { |
|
261 | 261 | |
262 | 262 | //Vars |
263 | 263 | $prefix = '_give_'; |
264 | 264 | |
265 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
265 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
266 | 266 | |
267 | 267 | //this gateway isn't active |
268 | - if ( ! $is_gateway_active ) { |
|
268 | + if ( ! $is_gateway_active) { |
|
269 | 269 | //return settings and bounce |
270 | 270 | return $settings; |
271 | 271 | } |
@@ -274,27 +274,27 @@ discard block |
||
274 | 274 | $check_settings = array( |
275 | 275 | |
276 | 276 | array( |
277 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
278 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
279 | - 'id' => $prefix . 'customize_offline_donations', |
|
277 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
278 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
279 | + 'id' => $prefix.'customize_offline_donations', |
|
280 | 280 | 'type' => 'radio_inline', |
281 | 281 | 'default' => 'no', |
282 | 282 | 'options' => array( |
283 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
284 | - 'no' => esc_attr__( 'No', 'give' ), |
|
283 | + 'yes' => esc_attr__('Yes', 'give'), |
|
284 | + 'no' => esc_attr__('No', 'give'), |
|
285 | 285 | ), |
286 | 286 | ), |
287 | 287 | array( |
288 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
289 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
290 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
288 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
289 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
290 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
291 | 291 | 'row_classes' => 'give-subfield', |
292 | 292 | 'type' => 'checkbox' |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'offline_checkout_notes', |
|
296 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
297 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
295 | + 'id' => $prefix.'offline_checkout_notes', |
|
296 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
297 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
298 | 298 | 'default' => give_get_default_offline_donation_content(), |
299 | 299 | 'type' => 'wysiwyg', |
300 | 300 | 'row_classes' => 'give-subfield', |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | ) |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'id' => $prefix . 'offline_donation_subject', |
|
307 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
308 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
309 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
306 | + 'id' => $prefix.'offline_donation_subject', |
|
307 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
308 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
309 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
310 | 310 | 'row_classes' => 'give-subfield', |
311 | 311 | 'type' => 'text' |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'id' => $prefix . 'offline_donation_email', |
|
315 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
316 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
314 | + 'id' => $prefix.'offline_donation_email', |
|
315 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
316 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
317 | 317 | 'default' => give_get_default_offline_donation_email_content(), |
318 | 318 | 'type' => 'wysiwyg', |
319 | 319 | 'row_classes' => 'give-subfield', |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | ) |
324 | 324 | ); |
325 | 325 | |
326 | - return array_merge( $settings, $check_settings ); |
|
326 | + return array_merge($settings, $check_settings); |
|
327 | 327 | } |
328 | 328 | |
329 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
329 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
330 | 330 | |
331 | 331 | |
332 | 332 | /** |
@@ -338,20 +338,20 @@ discard block |
||
338 | 338 | */ |
339 | 339 | function give_get_default_offline_donation_content() { |
340 | 340 | |
341 | - $sitename = get_bloginfo( 'sitename' ); |
|
341 | + $sitename = get_bloginfo('sitename'); |
|
342 | 342 | |
343 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
343 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
344 | 344 | $default_text .= '<ol>'; |
345 | - $default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>'; |
|
346 | - $default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>'; |
|
347 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
345 | + $default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>'; |
|
346 | + $default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>'; |
|
347 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
348 | 348 | $default_text .= '</ol>'; |
349 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
349 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
350 | 350 | $default_text .= ' <em>123 G Street </em><br>'; |
351 | 351 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
352 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
352 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
353 | 353 | |
354 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
354 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
355 | 355 | |
356 | 356 | } |
357 | 357 | |
@@ -364,21 +364,21 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function give_get_default_offline_donation_email_content() { |
366 | 366 | |
367 | - $sitename = get_bloginfo( 'sitename' ); |
|
368 | - $default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>'; |
|
369 | - $default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
367 | + $sitename = get_bloginfo('sitename'); |
|
368 | + $default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>'; |
|
369 | + $default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
370 | 370 | $default_text .= '<ol>'; |
371 | - $default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>'; |
|
372 | - $default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>'; |
|
373 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
371 | + $default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>'; |
|
372 | + $default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>'; |
|
373 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
374 | 374 | $default_text .= '</ol>'; |
375 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
375 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
376 | 376 | $default_text .= ' <em>123 G Street </em><br>'; |
377 | 377 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
378 | - $default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
379 | - $default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>'; |
|
380 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
378 | + $default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
379 | + $default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>'; |
|
380 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
381 | 381 | |
382 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
382 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
383 | 383 | |
384 | 384 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => __( 'Income', 'give' ), |
|
75 | + 'earnings' => __('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => __( 'Donors', 'give' ), |
|
78 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => __('Donors', 'give'), |
|
78 | + 'gateways' => __('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,52 +284,52 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | 316 | <?php |
317 | 317 | printf( |
318 | - __( '%1$s to %2$s', 'give' ), |
|
319 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
320 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
318 | + __('%1$s to %2$s', 'give'), |
|
319 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
320 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
321 | 321 | ); |
322 | 322 | ?> |
323 | 323 | <input type="hidden" name="give-action" value="earnings_export"/> |
324 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
324 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
325 | 325 | </form> |
326 | 326 | </td> |
327 | 327 | </tr> |
328 | 328 | <tr class="give-export-payment-history"> |
329 | 329 | <td class="row-title"> |
330 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
330 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
331 | 331 | |
332 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
332 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
333 | 333 | </td> |
334 | 334 | <td> |
335 | 335 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -337,29 +337,29 @@ discard block |
||
337 | 337 | $args = array( |
338 | 338 | 'id' => 'give-payment-export-start', |
339 | 339 | 'name' => 'start', |
340 | - 'placeholder' => __( 'Start date', 'give' ) |
|
340 | + 'placeholder' => __('Start date', 'give') |
|
341 | 341 | ); |
342 | - echo Give()->html->date_field( $args ); ?> |
|
342 | + echo Give()->html->date_field($args); ?> |
|
343 | 343 | <?php |
344 | 344 | $args = array( |
345 | 345 | 'id' => 'give-payment-export-end', |
346 | 346 | 'name' => 'end', |
347 | - 'placeholder' => __( 'End date', 'give' ) |
|
347 | + 'placeholder' => __('End date', 'give') |
|
348 | 348 | ); |
349 | - echo Give()->html->date_field( $args ); ?> |
|
349 | + echo Give()->html->date_field($args); ?> |
|
350 | 350 | <select name="status"> |
351 | - <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
351 | + <option value="any"><?php _e('All Statuses', 'give'); ?></option> |
|
352 | 352 | <?php |
353 | 353 | $statuses = give_get_payment_statuses(); |
354 | - foreach ( $statuses as $status => $label ) { |
|
355 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
354 | + foreach ($statuses as $status => $label) { |
|
355 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
356 | 356 | } |
357 | 357 | ?> |
358 | 358 | </select> |
359 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
359 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
360 | 360 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
361 | 361 | <span> |
362 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
362 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
363 | 363 | <span class="spinner"></span> |
364 | 364 | </span> |
365 | 365 | </form> |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | </tr> |
369 | 369 | <tr class="alternate give-export-donors"> |
370 | 370 | <td class="row-title"> |
371 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
371 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
372 | 372 | |
373 | - <p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
373 | + <p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
374 | 374 | </td> |
375 | 375 | <td> |
376 | 376 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -381,54 +381,54 @@ discard block |
||
381 | 381 | 'id' => 'give_customer_export_form', |
382 | 382 | 'chosen' => true |
383 | 383 | ); |
384 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
384 | + echo Give()->html->forms_dropdown($args); ?> |
|
385 | 385 | |
386 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
386 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
387 | 387 | |
388 | 388 | <div id="export-donor-options-wrap" class="give-clearfix"> |
389 | - <p><?php _e( 'Export Columns', 'give' ); ?>:</p> |
|
389 | + <p><?php _e('Export Columns', 'give'); ?>:</p> |
|
390 | 390 | <ul id="give-export-option-ul"> |
391 | 391 | <li> |
392 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?> |
|
392 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?> |
|
393 | 393 | </label> |
394 | 394 | </li> |
395 | 395 | <li> |
396 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?> |
|
396 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?> |
|
397 | 397 | </label> |
398 | 398 | </li> |
399 | 399 | <li> |
400 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?> |
|
400 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?> |
|
401 | 401 | </label> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?> |
|
404 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?> |
|
405 | 405 | </label> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?> |
|
408 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?> |
|
409 | 409 | </label> |
410 | 410 | </li> |
411 | 411 | <li> |
412 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?> |
|
412 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?> |
|
413 | 413 | </label> |
414 | 414 | </li> |
415 | 415 | <li> |
416 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?> |
|
416 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?> |
|
417 | 417 | </label> |
418 | 418 | </li> |
419 | 419 | </ul> |
420 | 420 | </div> |
421 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
421 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
422 | 422 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
423 | 423 | <input type="hidden" name="give-action" value="email_export"/> |
424 | 424 | </form> |
425 | 425 | </td> |
426 | 426 | </tr> |
427 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
427 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
428 | 428 | </tbody> |
429 | 429 | </table> |
430 | 430 | |
431 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
431 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
432 | 432 | |
433 | 433 | </div> |
434 | 434 | <!-- .post-body-content --> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | <?php |
439 | 439 | } |
440 | 440 | |
441 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
441 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
442 | 442 | |
443 | 443 | /** |
444 | 444 | * Renders the Reports page |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | */ |
449 | 449 | function give_reports_tab_logs() { |
450 | 450 | |
451 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
451 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
452 | 452 | |
453 | 453 | $current_view = 'sales'; |
454 | 454 | $log_views = give_log_default_views(); |
455 | 455 | |
456 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
456 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
457 | 457 | $current_view = $_GET['view']; |
458 | 458 | } |
459 | 459 | |
460 | - do_action( 'give_logs_view_' . $current_view ); |
|
460 | + do_action('give_logs_view_'.$current_view); |
|
461 | 461 | } |
462 | 462 | |
463 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
463 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Retrieves estimated monthly earnings and sales |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | */ |
471 | 471 | function give_estimated_monthly_stats() { |
472 | 472 | |
473 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
473 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
474 | 474 | |
475 | - if ( false === $estimated ) { |
|
475 | + if (false === $estimated) { |
|
476 | 476 | |
477 | 477 | $estimated = array( |
478 | 478 | 'earnings' => 0, |
@@ -481,20 +481,20 @@ discard block |
||
481 | 481 | |
482 | 482 | $stats = new Give_Payment_Stats; |
483 | 483 | |
484 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
485 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
484 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
485 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
486 | 486 | |
487 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
488 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
489 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
490 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
487 | + $current_day = date('d', current_time('timestamp')); |
|
488 | + $current_month = date('n', current_time('timestamp')); |
|
489 | + $current_year = date('Y', current_time('timestamp')); |
|
490 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
491 | 491 | |
492 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
493 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
492 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
493 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
494 | 494 | |
495 | 495 | // Cache for one day |
496 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
496 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
497 | 497 | } |
498 | 498 | |
499 | - return maybe_unserialize( $estimated ); |
|
499 | + return maybe_unserialize($estimated); |
|
500 | 500 | } |