@@ -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 | /** |
@@ -56,45 +56,45 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | // Set user. |
77 | 77 | $user = wp_get_current_user(); |
78 | 78 | |
79 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
82 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
83 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
84 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
85 | - $message = str_replace( '{amount}', $price, $message ); |
|
86 | - $message = str_replace( '{price}', $price, $message ); |
|
87 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
88 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
89 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
90 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
91 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
92 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
93 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
94 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
95 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
96 | - |
|
97 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
79 | + $message = str_replace('{name}', $user->display_name, $message); |
|
80 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
81 | + $message = str_replace('{username}', $user->user_login, $message); |
|
82 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
83 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
84 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
85 | + $message = str_replace('{amount}', $price, $message); |
|
86 | + $message = str_replace('{price}', $price, $message); |
|
87 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
88 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
89 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
90 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
91 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
92 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
93 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
94 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
95 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
96 | + |
|
97 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | * @since 1.0 |
107 | 107 | * @return array|bool |
108 | 108 | */ |
109 | -function give_email_template_preview( $array ) { |
|
109 | +function give_email_template_preview($array) { |
|
110 | 110 | |
111 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
111 | + if ( ! current_user_can('manage_give_settings')) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | $custom_field = array( |
115 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
116 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
115 | + 'name' => esc_html__('Preview Email', 'give'), |
|
116 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
117 | 117 | 'id' => 'give_email_preview_buttons', |
118 | 118 | 'type' => 'email_preview_buttons', |
119 | 119 | ); |
120 | 120 | |
121 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
121 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
125 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Output Email Template Preview Buttons. |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | function give_email_preview_buttons_callback() { |
135 | 135 | ob_start(); |
136 | 136 | ?> |
137 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" |
|
138 | - target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
139 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
137 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" |
|
138 | + target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
139 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
140 | 140 | 'give_action' => 'send_test_email', |
141 | 141 | 'give-message' => 'sent-test-email', |
142 | 142 | 'tag' => 'emails', |
143 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" |
|
144 | - class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
143 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" |
|
144 | + class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
145 | 145 | <?php |
146 | 146 | echo ob_get_clean(); |
147 | 147 | } |
@@ -154,46 +154,46 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function give_display_email_template_preview() { |
156 | 156 | |
157 | - if ( empty( $_GET['give_action'] ) ) { |
|
157 | + if (empty($_GET['give_action'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
161 | + if ('preview_email' !== $_GET['give_action']) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
165 | + if ( ! current_user_can('manage_give_settings')) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
170 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
171 | 171 | |
172 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
172 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
173 | 173 | |
174 | 174 | echo give_get_preview_email_header(); |
175 | 175 | |
176 | 176 | //Are we previewing an actual payment? |
177 | - if ( ! empty( $payment_id ) ) { |
|
177 | + if ( ! empty($payment_id)) { |
|
178 | 178 | |
179 | - $content = give_get_email_body_content( $payment_id ); |
|
179 | + $content = give_get_email_body_content($payment_id); |
|
180 | 180 | |
181 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
181 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
182 | 182 | |
183 | 183 | } else { |
184 | 184 | |
185 | 185 | //No payment ID, use sample preview content |
186 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
186 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | - echo Give()->emails->build_email( $preview_content ); |
|
190 | + echo Give()->emails->build_email($preview_content); |
|
191 | 191 | |
192 | 192 | exit; |
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
196 | +add_action('init', 'give_display_email_template_preview'); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Email Template Body. |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $email_body Body of the email |
207 | 207 | */ |
208 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
208 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
209 | 209 | |
210 | 210 | $default_email_body = give_get_default_donation_receipt_email(); |
211 | 211 | |
212 | - $email_content = give_get_option( 'donation_receipt' ); |
|
213 | - $email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
212 | + $email_content = give_get_option('donation_receipt'); |
|
213 | + $email_content = ($email_content) ? stripslashes($email_content) : $default_email_body; |
|
214 | 214 | |
215 | - $email_body = wpautop( $email_content ); |
|
215 | + $email_body = wpautop($email_content); |
|
216 | 216 | |
217 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
217 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
218 | 218 | |
219 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
219 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -229,35 +229,35 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string $email_body Body of the email |
231 | 231 | */ |
232 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
232 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
233 | 233 | |
234 | - $payment = new Give_Payment( $payment_id ); |
|
234 | + $payment = new Give_Payment($payment_id); |
|
235 | 235 | |
236 | - if ( $payment->user_id > 0 ) { |
|
237 | - $user_data = get_userdata( $payment->user_id ); |
|
236 | + if ($payment->user_id > 0) { |
|
237 | + $user_data = get_userdata($payment->user_id); |
|
238 | 238 | $name = $user_data->display_name; |
239 | - } elseif ( ! empty( $payment->first_name ) && ! empty( $payment->last_name ) ) { |
|
240 | - $name = $payment->first_name . ' ' . $payment->last_name; |
|
239 | + } elseif ( ! empty($payment->first_name) && ! empty($payment->last_name)) { |
|
240 | + $name = $payment->first_name.' '.$payment->last_name; |
|
241 | 241 | } else { |
242 | 242 | $name = $payment->email; |
243 | 243 | } |
244 | 244 | |
245 | - $gateway = give_get_gateway_admin_label( $payment->gateway ); |
|
245 | + $gateway = give_get_gateway_admin_label($payment->gateway); |
|
246 | 246 | |
247 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
248 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
250 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
251 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
252 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
253 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
247 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
248 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
250 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
251 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount($payment->total, array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n"; |
|
252 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
253 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
254 | 254 | |
255 | - $message = give_get_option( 'donation_notification' ); |
|
256 | - $message = isset( $message ) ? stripslashes( $message ) : $default_email_body; |
|
255 | + $message = give_get_option('donation_notification'); |
|
256 | + $message = isset($message) ? stripslashes($message) : $default_email_body; |
|
257 | 257 | |
258 | - $email_body = give_do_email_tags( $message, $payment_id ); |
|
258 | + $email_body = give_do_email_tags($message, $payment_id); |
|
259 | 259 | |
260 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
260 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -270,19 +270,19 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | */ |
272 | 272 | function give_render_receipt_in_browser() { |
273 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
274 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
273 | + if ( ! isset($_GET['payment_key'])) { |
|
274 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
275 | 275 | } |
276 | 276 | |
277 | - $key = urlencode( $_GET['payment_key'] ); |
|
277 | + $key = urlencode($_GET['payment_key']); |
|
278 | 278 | |
279 | 279 | ob_start(); |
280 | 280 | //Disallows caching of the page |
281 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
282 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
283 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
284 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
285 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
281 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
282 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
283 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
284 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
285 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
286 | 286 | ?> |
287 | 287 | <!DOCTYPE html> |
288 | 288 | <html lang="en"> |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @since 1.0 |
295 | 295 | */ |
296 | - do_action( 'give_receipt_head' ); |
|
296 | + do_action('give_receipt_head'); |
|
297 | 297 | ?> |
298 | 298 | </head> |
299 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
299 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
300 | 300 | |
301 | 301 | <div id="give_receipt_wrapper"> |
302 | 302 | <?php |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @since 1.0 |
307 | 307 | */ |
308 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
308 | + do_action('give_render_receipt_in_browser_before'); |
|
309 | 309 | |
310 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
310 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
311 | 311 | |
312 | 312 | /** |
313 | 313 | * Fires in the receipt template after the content. |
314 | 314 | * |
315 | 315 | * @since 1.0 |
316 | 316 | */ |
317 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
317 | + do_action('give_render_receipt_in_browser_after'); |
|
318 | 318 | ?> |
319 | 319 | </div> |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 1.0 |
326 | 326 | */ |
327 | - do_action( 'give_receipt_footer' ); |
|
327 | + do_action('give_receipt_footer'); |
|
328 | 328 | ?> |
329 | 329 | </body> |
330 | 330 | </html> |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | die(); |
334 | 334 | } |
335 | 335 | |
336 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
336 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
337 | 337 | |
338 | 338 | |
339 | 339 | /** |
@@ -348,29 +348,29 @@ discard block |
||
348 | 348 | |
349 | 349 | //Payment receipt switcher |
350 | 350 | $payment_count = give_count_payments()->publish; |
351 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
351 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
352 | 352 | |
353 | - if ( $payment_count <= 0 ) { |
|
353 | + if ($payment_count <= 0) { |
|
354 | 354 | return false; |
355 | 355 | } |
356 | 356 | |
357 | 357 | //Get payments. |
358 | - $payments = new Give_Payments_Query( array( |
|
358 | + $payments = new Give_Payments_Query(array( |
|
359 | 359 | 'number' => 100, |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | $payments = $payments->get_payments(); |
362 | 362 | $options = array(); |
363 | 363 | |
364 | 364 | //Provide nice human readable options. |
365 | - if ( $payments ) { |
|
366 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
367 | - foreach ( $payments as $payment ) { |
|
365 | + if ($payments) { |
|
366 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
367 | + foreach ($payments as $payment) { |
|
368 | 368 | |
369 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
369 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | } else { |
373 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
373 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | //Start constructing HTML output. |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | var selected_trans = transactions.options[transactions.selectedIndex]; |
384 | 384 | console.log(selected_trans); |
385 | 385 | if (selected_trans){ |
386 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
386 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
387 | 387 | window.location = url_string; |
388 | 388 | } |
389 | 389 | } |
390 | 390 | </script>'; |
391 | 391 | |
392 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
392 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
393 | 393 | |
394 | 394 | //The select field with 100 latest transactions |
395 | - $transaction_header .= Give()->html->select( array( |
|
395 | + $transaction_header .= Give()->html->select(array( |
|
396 | 396 | 'name' => 'preview_email_payment_id', |
397 | 397 | 'selected' => $payment_id, |
398 | 398 | 'id' => 'give_preview_email_payment_id', |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | 'select_atts' => 'onchange="change_preview()">', |
403 | 403 | 'show_option_all' => false, |
404 | 404 | 'show_option_none' => false, |
405 | - ) ); |
|
405 | + )); |
|
406 | 406 | |
407 | 407 | //Closing tag |
408 | 408 | $transaction_header .= '</div>'; |
409 | 409 | |
410 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
410 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
411 | 411 | |
412 | 412 | } |
413 | 413 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | function give_receipt_head_content() { |
422 | 422 | |
423 | 423 | //Title. |
424 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
424 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
425 | 425 | |
426 | 426 | //Meta. |
427 | 427 | $output .= '<meta charset="utf-8"/> |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | <meta name="robots" content="noindex, nofollow"/>'; |
436 | 436 | |
437 | 437 | //CSS |
438 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
438 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
439 | 439 | |
440 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
440 | + echo apply_filters('give_receipt_head_content', $output); |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
445 | 444 | \ No newline at end of file |
445 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
446 | 446 | \ No newline at end of file |
@@ -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,11 +26,11 @@ 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 ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= esc_html__( '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"; |
|
293 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= esc_html__('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"; |
|
293 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -345,22 +345,22 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @return array $email_names |
347 | 347 | */ |
348 | -function give_get_email_names( $user_info, $payment = false ) { |
|
348 | +function give_get_email_names($user_info, $payment = false) { |
|
349 | 349 | $email_names = array(); |
350 | 350 | |
351 | - if ( is_a( $payment, 'Give_Payment' ) ) { |
|
351 | + if (is_a($payment, 'Give_Payment')) { |
|
352 | 352 | |
353 | - if ( $payment->user_id > 0 ) { |
|
353 | + if ($payment->user_id > 0) { |
|
354 | 354 | |
355 | - $user_data = get_userdata( $payment->user_id ); |
|
355 | + $user_data = get_userdata($payment->user_id); |
|
356 | 356 | $email_names['name'] = $payment->first_name; |
357 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
357 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
358 | 358 | $email_names['username'] = $user_data->user_login; |
359 | 359 | |
360 | - } elseif ( ! empty( $payment->first_name ) ) { |
|
360 | + } elseif ( ! empty($payment->first_name)) { |
|
361 | 361 | |
362 | 362 | $email_names['name'] = $payment->first_name; |
363 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
363 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
364 | 364 | $email_names['username'] = $payment->first_name; |
365 | 365 | |
366 | 366 | } else { |
@@ -373,30 +373,30 @@ discard block |
||
373 | 373 | } else { |
374 | 374 | |
375 | 375 | // Support for old serialized data |
376 | - if ( is_serialized( $user_info ) ) { |
|
376 | + if (is_serialized($user_info)) { |
|
377 | 377 | |
378 | 378 | // Security check. |
379 | - preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches ); |
|
380 | - if ( ! empty( $matches ) ) { |
|
379 | + preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches); |
|
380 | + if ( ! empty($matches)) { |
|
381 | 381 | return array( |
382 | 382 | 'name' => '', |
383 | 383 | 'fullname' => '', |
384 | 384 | 'username' => '', |
385 | 385 | ); |
386 | 386 | } else { |
387 | - $user_info = maybe_unserialize( $user_info ); |
|
387 | + $user_info = maybe_unserialize($user_info); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } |
391 | 391 | |
392 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
393 | - $user_data = get_userdata( $user_info['id'] ); |
|
392 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
393 | + $user_data = get_userdata($user_info['id']); |
|
394 | 394 | $email_names['name'] = $user_info['first_name']; |
395 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
395 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
396 | 396 | $email_names['username'] = $user_data->user_login; |
397 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
397 | + } elseif (isset($user_info['first_name'])) { |
|
398 | 398 | $email_names['name'] = $user_info['first_name']; |
399 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
399 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
400 | 400 | $email_names['username'] = $user_info['first_name']; |
401 | 401 | } else { |
402 | 402 | $email_names['name'] = $user_info['email']; |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) { |
|
23 | +if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | Give()->roles->remove_caps(); |
74 | 74 | |
75 | 75 | // Delete the Roles. |
76 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' ); |
|
77 | - foreach ( $give_roles as $role ) { |
|
78 | - remove_role( $role ); |
|
76 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor'); |
|
77 | + foreach ($give_roles as $role) { |
|
78 | + remove_role($role); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Remove all database tables. |
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
84 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
84 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
85 | 85 | |
86 | 86 | // Cleanup Cron Events. |
87 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_scheduled_events' ); |
|
89 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
90 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
87 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_scheduled_events'); |
|
89 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
90 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
91 | 91 | |
92 | 92 | // Get all options. |
93 | 93 | $give_option_names = $wpdb->get_col( |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | |
100 | - if ( ! empty( $give_option_names ) ) { |
|
100 | + if ( ! empty($give_option_names)) { |
|
101 | 101 | // Convert option name to transient or option name. |
102 | 102 | $new_give_option_names = array(); |
103 | 103 | |
104 | 104 | // Delete all the Plugin Options. |
105 | - foreach ( $give_option_names as $option ) { |
|
106 | - if ( false !== strpos( $option, 'give_cache' ) ) { |
|
107 | - Give_Cache::delete( $option ); |
|
105 | + foreach ($give_option_names as $option) { |
|
106 | + if (false !== strpos($option, 'give_cache')) { |
|
107 | + Give_Cache::delete($option); |
|
108 | 108 | } else { |
109 | - delete_option( $option ); |
|
109 | + delete_option($option); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -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,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_donors_page() { |
26 | 26 | $default_views = give_donor_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_donor_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_donor_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_donors_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_donor_views', $views ); |
|
45 | + return apply_filters('give_donor_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
59 | + return apply_filters('give_donor_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_donors_list() { |
70 | - include dirname( __FILE__ ) . '/class-donor-table.php'; |
|
70 | + include dirname(__FILE__).'/class-donor-table.php'; |
|
71 | 71 | |
72 | 72 | $donors_table = new Give_Donor_List_Table(); |
73 | 73 | $donors_table->prepare_items(); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
86 | 86 | <?php |
87 | - $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
87 | + $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
88 | 88 | $donors_table->display(); |
89 | 89 | ?> |
90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_donors_table_bottom' ); |
|
100 | + do_action('give_donors_table_bottom'); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | -function give_render_donor_view( $view, $callbacks ) { |
|
116 | +function give_render_donor_view($view, $callbacks) { |
|
117 | 117 | |
118 | 118 | $render = true; |
119 | 119 | |
120 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
120 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
121 | 121 | |
122 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
123 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
122 | + if ( ! current_user_can($donor_view_role)) { |
|
123 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
124 | 124 | $render = false; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
128 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $donor_id = (int) $_GET['id']; |
133 | - $donor = new Give_Donor( $donor_id ); |
|
133 | + $donor = new Give_Donor($donor_id); |
|
134 | 134 | |
135 | - if ( empty( $donor->id ) ) { |
|
136 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
135 | + if (empty($donor->id)) { |
|
136 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class='wrap'> |
144 | 144 | |
145 | - <?php if ( give_get_errors() ) : ?> |
|
145 | + <?php if (give_get_errors()) : ?> |
|
146 | 146 | <div class="error settings-error"> |
147 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
147 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
148 | 148 | </div> |
149 | 149 | <?php endif; ?> |
150 | 150 | |
@@ -152,32 +152,32 @@ discard block |
||
152 | 152 | <?php |
153 | 153 | printf( |
154 | 154 | /* translators: %s: donor number */ |
155 | - esc_html__( 'Donor %s', 'give' ), |
|
155 | + esc_html__('Donor %s', 'give'), |
|
156 | 156 | $donor_id |
157 | 157 | ); |
158 | 158 | ?> |
159 | 159 | </h1> |
160 | 160 | |
161 | - <?php if ( $donor && $render ) : ?> |
|
161 | + <?php if ($donor && $render) : ?> |
|
162 | 162 | |
163 | 163 | <h2 class="nav-tab-wrapper"> |
164 | 164 | <?php |
165 | - foreach ( $donor_tabs as $key => $tab ) : |
|
165 | + foreach ($donor_tabs as $key => $tab) : |
|
166 | 166 | $active = $key === $view ? true : false; |
167 | 167 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
168 | 168 | printf( |
169 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
170 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
171 | - esc_attr( $class ), |
|
172 | - sanitize_html_class( $tab['dashicon'] ), |
|
173 | - esc_html( $tab['title'] ) |
|
169 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
170 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
171 | + esc_attr($class), |
|
172 | + sanitize_html_class($tab['dashicon']), |
|
173 | + esc_html($tab['title']) |
|
174 | 174 | ); |
175 | 175 | endforeach; |
176 | 176 | ?> |
177 | 177 | </h2> |
178 | 178 | |
179 | 179 | <div id="give-donor-card-wrapper"> |
180 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
180 | + <?php $callbacks[$view]($donor) ?> |
|
181 | 181 | </div> |
182 | 182 | |
183 | 183 | <?php endif; ?> |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return void |
199 | 199 | */ |
200 | -function give_donor_view( $donor ) { |
|
200 | +function give_donor_view($donor) { |
|
201 | 201 | |
202 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
202 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Fires in donor profile screen, above the donor card. |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @param object $donor The donor object being displayed. |
210 | 210 | */ |
211 | - do_action( 'give_donor_card_top', $donor ); |
|
211 | + do_action('give_donor_card_top', $donor); |
|
212 | 212 | ?> |
213 | 213 | |
214 | 214 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
215 | 215 | |
216 | - <form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
216 | + <form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
217 | 217 | |
218 | 218 | <div class="donor-info"> |
219 | 219 | |
220 | 220 | <div class="donor-bio-header clearfix"> |
221 | 221 | |
222 | 222 | <div class="avatar-wrap left" id="donor-avatar"> |
223 | - <?php echo get_avatar( $donor->email ); ?> |
|
223 | + <?php echo get_avatar($donor->email); ?> |
|
224 | 224 | </div> |
225 | 225 | |
226 | 226 | <div id="donor-name-wrap" class="left"> |
227 | 227 | <span class="donor-id">#<?php echo $donor->id; ?></span> |
228 | - <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
228 | + <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
229 | 229 | <span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span> |
230 | 230 | </div> |
231 | 231 | <p class="donor-since info-item"> |
232 | - <?php _e( 'Donor since', 'give' ); ?> |
|
233 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
232 | + <?php _e('Donor since', 'give'); ?> |
|
233 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
234 | 234 | </p> |
235 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
236 | - <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
235 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
236 | + <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
237 | 237 | <?php endif; ?> |
238 | 238 | </div> |
239 | 239 | <!-- /donor-bio-header --> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | <table class="widefat"> |
244 | 244 | <tbody> |
245 | 245 | <tr class="alternate"> |
246 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
246 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
247 | 247 | <td> |
248 | 248 | <span class="donor-user-id info-item edit-item"> |
249 | 249 | <?php |
@@ -260,48 +260,48 @@ discard block |
||
260 | 260 | 'data' => $data_atts, |
261 | 261 | ); |
262 | 262 | |
263 | - if ( ! empty( $user_id ) ) { |
|
264 | - $userdata = get_userdata( $user_id ); |
|
263 | + if ( ! empty($user_id)) { |
|
264 | + $userdata = get_userdata($user_id); |
|
265 | 265 | $user_args['selected'] = $user_id; |
266 | 266 | } |
267 | 267 | |
268 | - echo Give()->html->ajax_user_search( $user_args ); |
|
268 | + echo Give()->html->ajax_user_search($user_args); |
|
269 | 269 | ?> |
270 | 270 | </span> |
271 | 271 | |
272 | 272 | <span class="donor-user-id info-item editable"> |
273 | - <?php if ( ! empty( $userdata ) ) { ?> |
|
274 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
273 | + <?php if ( ! empty($userdata)) { ?> |
|
274 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
275 | 275 | <?php } else { ?> |
276 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
276 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
277 | 277 | <?php } ?> |
278 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?> |
|
278 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?> |
|
279 | 279 | <span class="disconnect-user"> |
280 | 280 | - |
281 | - <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"> |
|
282 | - <?php _e( 'Disconnect User', 'give' ); ?> |
|
281 | + <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e('Disconnects the current user ID from this donor record.', 'give'); ?>"> |
|
282 | + <?php _e('Disconnect User', 'give'); ?> |
|
283 | 283 | </a> |
284 | 284 | </span> |
285 | 285 | <span class="view-user-profile"> |
286 | 286 | | |
287 | - <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id=' . $donor->user_id; ?>" aria-label="<?php _e( 'View User Profile of current user ID.', 'give' ); ?>"> |
|
288 | - <?php _e( 'View User Profile', 'give' ); ?> |
|
287 | + <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id='.$donor->user_id; ?>" aria-label="<?php _e('View User Profile of current user ID.', 'give'); ?>"> |
|
288 | + <?php _e('View User Profile', 'give'); ?> |
|
289 | 289 | </a> |
290 | 290 | </span> |
291 | 291 | <?php } ?> |
292 | 292 | </span> |
293 | 293 | </td> |
294 | 294 | </tr> |
295 | - <?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?> |
|
295 | + <?php if (isset($donor->user_id) && $donor->user_id > 0) : ?> |
|
296 | 296 | |
297 | 297 | <tr> |
298 | - <th scope="col"><?php _e( 'Address:', 'give' ); ?></th> |
|
298 | + <th scope="col"><?php _e('Address:', 'give'); ?></th> |
|
299 | 299 | <td class="row-title"> |
300 | 300 | |
301 | 301 | <div class="donor-address-wrapper"> |
302 | 302 | |
303 | 303 | <?php |
304 | - $address = get_user_meta( $donor->user_id, '_give_user_address', true ); |
|
304 | + $address = get_user_meta($donor->user_id, '_give_user_address', true); |
|
305 | 305 | $defaults = array( |
306 | 306 | 'line1' => '', |
307 | 307 | 'line2' => '', |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | 'zip' => '', |
312 | 312 | ); |
313 | 313 | |
314 | - $address = wp_parse_args( $address, $defaults ); |
|
314 | + $address = wp_parse_args($address, $defaults); |
|
315 | 315 | ?> |
316 | 316 | |
317 | - <?php if ( ! empty( $address ) ) { ?> |
|
317 | + <?php if ( ! empty($address)) { ?> |
|
318 | 318 | <span class="donor-address info-item editable"> |
319 | 319 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
320 | 320 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -325,43 +325,43 @@ discard block |
||
325 | 325 | </span> |
326 | 326 | <?php } ?> |
327 | 327 | <span class="donor-address info-item edit-item"> |
328 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
329 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
330 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
328 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
329 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
330 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
331 | 331 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
332 | 332 | <?php |
333 | 333 | |
334 | 334 | $selected_country = $address['country']; |
335 | 335 | |
336 | 336 | $countries = give_get_country_list(); |
337 | - foreach ( $countries as $country_code => $country ) { |
|
338 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
337 | + foreach ($countries as $country_code => $country) { |
|
338 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
339 | 339 | } |
340 | 340 | ?> |
341 | 341 | </select> |
342 | 342 | <?php |
343 | 343 | $selected_state = give_get_state(); |
344 | - $states = give_get_states( $selected_country ); |
|
344 | + $states = give_get_states($selected_country); |
|
345 | 345 | |
346 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
346 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
347 | 347 | |
348 | - if ( ! empty( $states ) ) { |
|
348 | + if ( ! empty($states)) { |
|
349 | 349 | ?> |
350 | 350 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
351 | 351 | <?php |
352 | - foreach ( $states as $state_code => $state ) { |
|
353 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
352 | + foreach ($states as $state_code => $state) { |
|
353 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
354 | 354 | } |
355 | 355 | ?> |
356 | 356 | </select> |
357 | 357 | <?php |
358 | 358 | } else { |
359 | 359 | ?> |
360 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province / County', 'give' ); ?>" /> |
|
360 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province / County', 'give'); ?>" /> |
|
361 | 361 | <?php |
362 | 362 | } |
363 | 363 | ?> |
364 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
364 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
365 | 365 | </span> |
366 | 366 | |
367 | 367 | </div> |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | |
378 | 378 | <span id="donor-edit-actions" class="edit-item"> |
379 | 379 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" /> |
380 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
380 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
381 | 381 | <input type="hidden" name="give_action" value="edit-donor" /> |
382 | - <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
383 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
382 | + <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
383 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
384 | 384 | </span> |
385 | 385 | |
386 | 386 | </form> |
@@ -395,24 +395,24 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @param object $donor The donor object being displayed. |
397 | 397 | */ |
398 | - do_action( 'give_donor_before_stats', $donor ); |
|
398 | + do_action('give_donor_before_stats', $donor); |
|
399 | 399 | ?> |
400 | 400 | |
401 | 401 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
402 | 402 | <ul> |
403 | 403 | <li> |
404 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
404 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
405 | 405 | <span class="dashicons dashicons-heart"></span> |
406 | 406 | <?php |
407 | 407 | // Completed Donations |
408 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
409 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
408 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
409 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
410 | 410 | ?> |
411 | 411 | </a> |
412 | 412 | </li> |
413 | 413 | <li> |
414 | 414 | <span class="dashicons dashicons-chart-area"></span> |
415 | - <?php echo give_currency_filter( give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
415 | + <?php echo give_currency_filter(give_format_amount($donor->purchase_value, array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
416 | 416 | </li> |
417 | 417 | <?php |
418 | 418 | /** |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @param object $donor The donor object being displayed. |
426 | 426 | */ |
427 | - do_action( 'give_donor_stats_list', $donor ); |
|
427 | + do_action('give_donor_stats_list', $donor); |
|
428 | 428 | ?> |
429 | 429 | </ul> |
430 | 430 | </div> |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param object $donor The donor object being displayed. |
439 | 439 | */ |
440 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
440 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
441 | 441 | ?> |
442 | 442 | |
443 | 443 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -450,46 +450,46 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @param object $donor The donor object being displayed. |
452 | 452 | */ |
453 | - do_action( 'give_donor_before_tables', $donor ); |
|
453 | + do_action('give_donor_before_tables', $donor); |
|
454 | 454 | ?> |
455 | 455 | |
456 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
456 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
457 | 457 | |
458 | 458 | <table class="wp-list-table widefat striped emails"> |
459 | 459 | <thead> |
460 | 460 | <tr> |
461 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
462 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
461 | + <th><?php _e('Email', 'give'); ?></th> |
|
462 | + <th><?php _e('Actions', 'give'); ?></th> |
|
463 | 463 | </tr> |
464 | 464 | </thead> |
465 | 465 | |
466 | 466 | <tbody> |
467 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
467 | + <?php if ( ! empty($donor->emails)) { ?> |
|
468 | 468 | |
469 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
469 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
470 | 470 | <tr data-key="<?php echo $key; ?>"> |
471 | 471 | <td> |
472 | 472 | <?php echo $email; ?> |
473 | - <?php if ( 'primary' === $key ) : ?> |
|
473 | + <?php if ('primary' === $key) : ?> |
|
474 | 474 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
475 | 475 | <?php endif; ?> |
476 | 476 | </td> |
477 | 477 | <td> |
478 | - <?php if ( 'primary' !== $key ) : ?> |
|
478 | + <?php if ('primary' !== $key) : ?> |
|
479 | 479 | <?php |
480 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
481 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
482 | - 'email' => rawurlencode( $email ), |
|
480 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
481 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
482 | + 'email' => rawurlencode($email), |
|
483 | 483 | 'give_action' => 'set_donor_primary_email', |
484 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
485 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
486 | - 'email' => rawurlencode( $email ), |
|
484 | + ), $base_url), 'give-set-donor-primary-email'); |
|
485 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
486 | + 'email' => rawurlencode($email), |
|
487 | 487 | 'give_action' => 'remove_donor_email', |
488 | - ), $base_url ), 'give-remove-donor-email' ); |
|
488 | + ), $base_url), 'give-remove-donor-email'); |
|
489 | 489 | ?> |
490 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
490 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
491 | 491 | | |
492 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
492 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
493 | 493 | <?php endif; ?> |
494 | 494 | </td> |
495 | 495 | </tr> |
@@ -499,59 +499,59 @@ discard block |
||
499 | 499 | <td colspan="2" class="add-donor-email-td"> |
500 | 500 | <div class="add-donor-email-wrapper"> |
501 | 501 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" /> |
502 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
503 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
504 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
505 | - <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
502 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
503 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
504 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
505 | + <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
506 | 506 | <span class="spinner"></span> |
507 | 507 | </div> |
508 | 508 | <div class="notice-wrap"></div> |
509 | 509 | </td> |
510 | 510 | </tr> |
511 | 511 | <?php } else { ?> |
512 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr> |
|
512 | + <tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr> |
|
513 | 513 | <?php }// End if(). |
514 | 514 | ?> |
515 | 515 | </tbody> |
516 | 516 | </table> |
517 | 517 | |
518 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
518 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
519 | 519 | <?php |
520 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
521 | - $payments = give_get_payments( array( |
|
520 | + $payment_ids = explode(',', $donor->payment_ids); |
|
521 | + $payments = give_get_payments(array( |
|
522 | 522 | 'post__in' => $payment_ids, |
523 | - ) ); |
|
524 | - $payments = array_slice( $payments, 0, 10 ); |
|
523 | + )); |
|
524 | + $payments = array_slice($payments, 0, 10); |
|
525 | 525 | ?> |
526 | 526 | <table class="wp-list-table widefat striped payments"> |
527 | 527 | <thead> |
528 | 528 | <tr> |
529 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
530 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
531 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
532 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
533 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
529 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
530 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
531 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
532 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
533 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
534 | 534 | </tr> |
535 | 535 | </thead> |
536 | 536 | <tbody> |
537 | - <?php if ( ! empty( $payments ) ) { ?> |
|
538 | - <?php foreach ( $payments as $payment ) : ?> |
|
537 | + <?php if ( ! empty($payments)) { ?> |
|
538 | + <?php foreach ($payments as $payment) : ?> |
|
539 | 539 | <tr> |
540 | 540 | <td><?php echo $payment->ID; ?></td> |
541 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
542 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
543 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
541 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
542 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
543 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
544 | 544 | <td> |
545 | 545 | <?php |
546 | 546 | printf( |
547 | 547 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
548 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
548 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
549 | 549 | sprintf( |
550 | 550 | /* translators: %s: Donation ID */ |
551 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
551 | + esc_attr__('View Donation %s.', 'give'), |
|
552 | 552 | $payment->ID |
553 | 553 | ), |
554 | - __( 'View Donation', 'give' ) |
|
554 | + __('View Donation', 'give') |
|
555 | 555 | ); |
556 | 556 | ?> |
557 | 557 | |
@@ -566,47 +566,47 @@ discard block |
||
566 | 566 | * @param object $donor The donor object being displayed. |
567 | 567 | * @param object $payment The payment object being displayed. |
568 | 568 | */ |
569 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
569 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
570 | 570 | ?> |
571 | 571 | </td> |
572 | 572 | </tr> |
573 | 573 | <?php endforeach; ?> |
574 | 574 | <?php } else { ?> |
575 | 575 | <tr> |
576 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
576 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
577 | 577 | </tr> |
578 | 578 | <?php }// End if(). |
579 | 579 | ?> |
580 | 580 | </tbody> |
581 | 581 | </table> |
582 | 582 | |
583 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
583 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
584 | 584 | <?php |
585 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
585 | + $donations = give_get_users_completed_donations($donor->email); |
|
586 | 586 | ?> |
587 | 587 | <table class="wp-list-table widefat striped donations"> |
588 | 588 | <thead> |
589 | 589 | <tr> |
590 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
591 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
590 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
591 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
592 | 592 | </tr> |
593 | 593 | </thead> |
594 | 594 | <tbody> |
595 | - <?php if ( ! empty( $donations ) ) { ?> |
|
596 | - <?php foreach ( $donations as $donation ) : ?> |
|
595 | + <?php if ( ! empty($donations)) { ?> |
|
596 | + <?php foreach ($donations as $donation) : ?> |
|
597 | 597 | <tr> |
598 | 598 | <td><?php echo $donation->post_title; ?></td> |
599 | 599 | <td> |
600 | 600 | <?php |
601 | 601 | printf( |
602 | 602 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
603 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
603 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
604 | 604 | sprintf( |
605 | 605 | /* translators: %s: form name */ |
606 | - esc_attr__( 'View Form %s.', 'give' ), |
|
606 | + esc_attr__('View Form %s.', 'give'), |
|
607 | 607 | $donation->post_title |
608 | 608 | ), |
609 | - __( 'View Form', 'give' ) |
|
609 | + __('View Form', 'give') |
|
610 | 610 | ); |
611 | 611 | ?> |
612 | 612 | </td> |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | <?php endforeach; ?> |
615 | 615 | <?php } else { ?> |
616 | 616 | <tr> |
617 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
617 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
618 | 618 | </tr> |
619 | 619 | <?php } ?> |
620 | 620 | </tbody> |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @param object $donor The donor object being displayed. |
630 | 630 | */ |
631 | - do_action( 'give_donor_after_tables', $donor ); |
|
631 | + do_action('give_donor_after_tables', $donor); |
|
632 | 632 | ?> |
633 | 633 | |
634 | 634 | </div> |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | * |
642 | 642 | * @param object $donor The donor object being displayed. |
643 | 643 | */ |
644 | - do_action( 'give_donor_card_bottom', $donor ); |
|
644 | + do_action('give_donor_card_bottom', $donor); |
|
645 | 645 | |
646 | 646 | } |
647 | 647 | |
@@ -654,30 +654,30 @@ discard block |
||
654 | 654 | * |
655 | 655 | * @return void |
656 | 656 | */ |
657 | -function give_donor_notes_view( $donor ) { |
|
657 | +function give_donor_notes_view($donor) { |
|
658 | 658 | |
659 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
660 | - $paged = absint( $paged ); |
|
659 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
660 | + $paged = absint($paged); |
|
661 | 661 | $note_count = $donor->get_notes_count(); |
662 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
663 | - $total_pages = ceil( $note_count / $per_page ); |
|
664 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
662 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
663 | + $total_pages = ceil($note_count / $per_page); |
|
664 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
665 | 665 | ?> |
666 | 666 | |
667 | 667 | <div id="donor-notes-wrapper"> |
668 | 668 | <div class="donor-notes-header"> |
669 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
669 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
670 | 670 | </div> |
671 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
671 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
672 | 672 | |
673 | - <?php if ( 1 == $paged ) : ?> |
|
673 | + <?php if (1 == $paged) : ?> |
|
674 | 674 | <div style="display: block; margin-bottom: 55px;"> |
675 | - <form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
675 | + <form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
676 | 676 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
677 | 677 | <br /> |
678 | 678 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" /> |
679 | 679 | <input type="hidden" name="give_action" value="add-donor-note" /> |
680 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
680 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
681 | 681 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" /> |
682 | 682 | </form> |
683 | 683 | </div> |
@@ -692,26 +692,26 @@ discard block |
||
692 | 692 | 'show_all' => true, |
693 | 693 | ); |
694 | 694 | |
695 | - echo paginate_links( $pagination_args ); |
|
695 | + echo paginate_links($pagination_args); |
|
696 | 696 | ?> |
697 | 697 | |
698 | 698 | <div id="give-donor-notes" class="postbox"> |
699 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
700 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
699 | + <?php if (count($donor_notes) > 0) { ?> |
|
700 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
701 | 701 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
702 | 702 | <span class="note-content-wrap"> |
703 | - <?php echo stripslashes( $note ); ?> |
|
703 | + <?php echo stripslashes($note); ?> |
|
704 | 704 | </span> |
705 | 705 | </div> |
706 | 706 | <?php endforeach; ?> |
707 | 707 | <?php } else { ?> |
708 | 708 | <div class="give-no-donor-notes"> |
709 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
709 | + <?php _e('No donor notes found.', 'give'); ?> |
|
710 | 710 | </div> |
711 | 711 | <?php } ?> |
712 | 712 | </div> |
713 | 713 | |
714 | - <?php echo paginate_links( $pagination_args ); ?> |
|
714 | + <?php echo paginate_links($pagination_args); ?> |
|
715 | 715 | |
716 | 716 | </div> |
717 | 717 | |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return void |
729 | 729 | */ |
730 | -function give_donor_delete_view( $donor ) { |
|
730 | +function give_donor_delete_view($donor) { |
|
731 | 731 | |
732 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
732 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
733 | 733 | |
734 | 734 | /** |
735 | 735 | * Fires in donor delete screen, above the content. |
@@ -738,15 +738,15 @@ discard block |
||
738 | 738 | * |
739 | 739 | * @param object $donor The donor object being displayed. |
740 | 740 | */ |
741 | - do_action( 'give_donor_delete_top', $donor ); |
|
741 | + do_action('give_donor_delete_top', $donor); |
|
742 | 742 | ?> |
743 | 743 | |
744 | 744 | <div class="info-wrapper donor-section"> |
745 | 745 | |
746 | - <form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
746 | + <form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
747 | 747 | |
748 | 748 | <div class="donor-notes-header"> |
749 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
749 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
750 | 750 | </div> |
751 | 751 | |
752 | 752 | |
@@ -754,20 +754,20 @@ discard block |
||
754 | 754 | |
755 | 755 | <span class="delete-donor-options"> |
756 | 756 | <p> |
757 | - <?php echo Give()->html->checkbox( array( |
|
757 | + <?php echo Give()->html->checkbox(array( |
|
758 | 758 | 'name' => 'give-donor-delete-confirm', |
759 | - ) ); ?> |
|
760 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
759 | + )); ?> |
|
760 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
761 | 761 | </p> |
762 | 762 | |
763 | 763 | <p> |
764 | - <?php echo Give()->html->checkbox( array( |
|
764 | + <?php echo Give()->html->checkbox(array( |
|
765 | 765 | 'name' => 'give-donor-delete-records', |
766 | 766 | 'options' => array( |
767 | 767 | 'disabled' => true, |
768 | 768 | ), |
769 | - ) ); ?> |
|
770 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
769 | + )); ?> |
|
770 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
771 | 771 | </p> |
772 | 772 | |
773 | 773 | <?php |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @param object $donor The donor object being displayed. |
782 | 782 | */ |
783 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
783 | + do_action('give_donor_delete_inputs', $donor); |
|
784 | 784 | ?> |
785 | 785 | </span> |
786 | 786 | |
787 | 787 | <span id="donor-edit-actions"> |
788 | 788 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" /> |
789 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
789 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
790 | 790 | <input type="hidden" name="give_action" value="delete-donor" /> |
791 | - <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
792 | - <a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
791 | + <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
792 | + <a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
793 | 793 | </span> |
794 | 794 | |
795 | 795 | </div> |
@@ -805,5 +805,5 @@ discard block |
||
805 | 805 | * |
806 | 806 | * @param object $donor The donor object being displayed. |
807 | 807 | */ |
808 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
808 | + do_action('give_donor_delete_bottom', $donor); |
|
809 | 809 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | global $status, $page; |
57 | 57 | |
58 | 58 | // Set parent defaults |
59 | - parent::__construct( array( |
|
60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
59 | + parent::__construct(array( |
|
60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
62 | 62 | 'ajax' => false // Does this table support ajax? |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
66 | 66 | $this->query(); |
67 | 67 | |
68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Column Name |
80 | 80 | */ |
81 | - public function column_default( $item, $column_name ) { |
|
82 | - switch ( $column_name ) { |
|
81 | + public function column_default($item, $column_name) { |
|
82 | + switch ($column_name) { |
|
83 | 83 | case 'title': |
84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
85 | 85 | |
86 | 86 | return sprintf( |
87 | 87 | '<a href="%s">%s</a>', |
88 | - get_edit_post_link( $item['ID'] ), |
|
88 | + get_edit_post_link($item['ID']), |
|
89 | 89 | $title |
90 | 90 | ); |
91 | 91 | case 'sales': |
92 | 92 | return sprintf( |
93 | 93 | '<a href="%s">%s</a>', |
94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
95 | 95 | $item['sales'] |
96 | 96 | ); |
97 | 97 | case 'earnings' : |
98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
99 | 99 | case 'average_sales' : |
100 | - return round( $item[ $column_name ] ); |
|
100 | + return round($item[$column_name]); |
|
101 | 101 | case 'average_earnings' : |
102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
103 | 103 | case 'details' : |
104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
105 | 105 | default: |
106 | - return $item[ $column_name ]; |
|
106 | + return $item[$column_name]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_columns() { |
119 | 119 | $columns = array( |
120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
120 | + 'title' => esc_html__('Form', 'give'), |
|
121 | + 'sales' => esc_html__('Donations', 'give'), |
|
122 | + 'earnings' => esc_html__('Income', 'give'), |
|
123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_sortable_columns() { |
140 | 140 | return array( |
141 | - 'title' => array( 'title', true ), |
|
142 | - 'sales' => array( 'sales', false ), |
|
143 | - 'earnings' => array( 'earnings', false ), |
|
141 | + 'title' => array('title', true), |
|
142 | + 'sales' => array('sales', false), |
|
143 | + 'earnings' => array('earnings', false), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int Current page number |
154 | 154 | */ |
155 | 155 | public function get_paged() { |
156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return int Category ID |
166 | 166 | */ |
167 | 167 | public function get_category() { |
168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function bulk_actions( $which = '' ) { |
|
179 | + public function bulk_actions($which = '') { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param string $which |
190 | 190 | */ |
191 | - protected function display_tablenav( $which ) { |
|
191 | + protected function display_tablenav($which) { |
|
192 | 192 | |
193 | - if ( 'top' === $which ) { |
|
194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
193 | + if ('top' === $which) { |
|
194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
198 | 198 | |
199 | - <?php if ( 'top' === $which ) { ?> |
|
199 | + <?php if ('top' === $which) { ?> |
|
200 | 200 | <h2 class="alignleft reports-earnings-title"> |
201 | - <?php esc_html_e( 'Donation Forms Report', 'give' ); ?> |
|
201 | + <?php esc_html_e('Donation Forms Report', 'give'); ?> |
|
202 | 202 | </h2> |
203 | 203 | <?php } ?> |
204 | 204 | |
205 | 205 | <div class="alignright tablenav-right"> |
206 | 206 | <div class="actions bulkactions"> |
207 | - <?php $this->bulk_actions( $which ); ?> |
|
207 | + <?php $this->bulk_actions($which); ?> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | - $this->extra_tablenav( $which ); |
|
211 | - $this->pagination( $which ); |
|
210 | + $this->extra_tablenav($which); |
|
211 | + $this->pagination($which); |
|
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function category_filter() { |
230 | 230 | |
231 | - $categories = get_terms( 'form_category' ); |
|
232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
231 | + $categories = get_terms('form_category'); |
|
232 | + if ($categories && ! is_wp_error($categories)) { |
|
233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function query() { |
246 | 246 | |
247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
249 | 249 | $category = $this->get_category(); |
250 | 250 | |
251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'suppress_filters' => true |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $category ) ) { |
|
261 | + if ( ! empty($category)) { |
|
262 | 262 | $args['tax_query'] = array( |
263 | 263 | array( |
264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - switch ( $orderby ) : |
|
270 | + switch ($orderby) : |
|
271 | 271 | case 'title' : |
272 | 272 | $args['orderby'] = 'title'; |
273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
287 | 287 | |
288 | - $this->donation_forms = new WP_Query( $args ); |
|
288 | + $this->donation_forms = new WP_Query($args); |
|
289 | 289 | |
290 | 290 | // Store total number of donation forms count. |
291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | $give_forms = $this->donation_forms->posts; |
307 | 307 | |
308 | - if ( $give_forms ) { |
|
309 | - foreach ( $give_forms as $form ) { |
|
308 | + if ($give_forms) { |
|
309 | + foreach ($give_forms as $form) { |
|
310 | 310 | $reports_data[] = array( |
311 | 311 | 'ID' => $form, |
312 | - 'title' => get_the_title( $form ), |
|
313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
312 | + 'title' => get_the_title($form), |
|
313 | + 'sales' => give_get_form_sales_stats($form), |
|
314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $columns = $this->get_columns(); |
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = $this->get_sortable_columns(); |
341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
342 | 342 | $this->items = $this->reports_data(); |
343 | 343 | $total_items = $this->count; |
344 | 344 | |
345 | - $this->set_pagination_args( array( |
|
345 | + $this->set_pagination_args(array( |
|
346 | 346 | 'total_items' => $total_items, |
347 | 347 | 'per_page' => $this->per_page, |
348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function get_sortable_columns() { |
101 | 101 | return array( |
102 | - 'total_donations' => array( 'total_donations', false ) |
|
102 | + 'total_donations' => array('total_donations', false) |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return int Current page number |
113 | 113 | */ |
114 | 114 | public function get_paged() { |
115 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
115 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @since 1.0 |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - public function bulk_actions( $which = '' ) { |
|
126 | + public function bulk_actions($which = '') { |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
@@ -135,27 +135,27 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param string $which |
137 | 137 | */ |
138 | - protected function display_tablenav( $which ) { |
|
138 | + protected function display_tablenav($which) { |
|
139 | 139 | |
140 | - if ( 'top' === $which ) { |
|
141 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
140 | + if ('top' === $which) { |
|
141 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
142 | 142 | } |
143 | 143 | ?> |
144 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
144 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
145 | 145 | |
146 | - <?php if ( 'top' === $which ) { ?> |
|
146 | + <?php if ('top' === $which) { ?> |
|
147 | 147 | <h2 class="alignleft reports-earnings-title"> |
148 | - <?php esc_html_e( 'Donation Methods Report', 'give' ); ?> |
|
148 | + <?php esc_html_e('Donation Methods Report', 'give'); ?> |
|
149 | 149 | </h2> |
150 | 150 | <?php } ?> |
151 | 151 | |
152 | 152 | <div class="alignright tablenav-right"> |
153 | 153 | <div class="actions bulkactions"> |
154 | - <?php $this->bulk_actions( $which ); ?> |
|
154 | + <?php $this->bulk_actions($which); ?> |
|
155 | 155 | </div> |
156 | 156 | <?php |
157 | - $this->extra_tablenav( $which ); |
|
158 | - $this->pagination( $which ); |
|
157 | + $this->extra_tablenav($which); |
|
158 | + $this->pagination($which); |
|
159 | 159 | ?> |
160 | 160 | </div> |
161 | 161 | |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return int |
179 | 179 | */ |
180 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
180 | + public function give_sort_total_donations($old_value, $new_value) { |
|
181 | 181 | // If no sort, default to label. |
182 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
182 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
183 | 183 | |
184 | 184 | //If no order, default to asc. |
185 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
185 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
186 | 186 | |
187 | 187 | //Determine sort order. |
188 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
188 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
189 | 189 | |
190 | - return ( $order === 'asc' ) ? $result : -$result; |
|
190 | + return ($order === 'asc') ? $result : -$result; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $gateways = give_get_payment_gateways(); |
205 | 205 | $stats = new Give_Payment_Stats(); |
206 | 206 | |
207 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
207 | + foreach ($gateways as $gateway_id => $gateway) { |
|
208 | 208 | |
209 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
210 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
209 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
210 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
211 | 211 | |
212 | 212 | $reports_data[] = array( |
213 | 213 | 'ID' => $gateway_id, |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'complete_sales' => $complete_count, |
216 | 216 | 'pending_sales' => $pending_count, |
217 | 217 | 'total_sales' => $complete_count + $pending_count, |
218 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
218 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | $columns = $this->get_columns(); |
237 | 237 | $hidden = array(); // No hidden columns |
238 | 238 | $sortable = $this->get_sortable_columns(); |
239 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
239 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
240 | 240 | $this->items = $this->reports_data(); |
241 | 241 | |
242 | 242 | // Sort Array when we are sorting data in array. |
243 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
243 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
244 | 244 | |
245 | 245 | } |
246 | 246 | } |
@@ -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,8 +29,8 @@ 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'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'donors' => esc_html__('Donors', 'give'), |
|
106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - $views = apply_filters( 'give_report_views', $views ); |
|
109 | + $views = apply_filters('give_report_views', $views); |
|
110 | 110 | |
111 | 111 | return $views; |
112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @since 1.0 |
122 | 122 | * @return string $view Report View |
123 | 123 | */ |
124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
124 | +function give_get_reporting_view($default = 'earnings') { |
|
125 | 125 | |
126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
127 | 127 | $view = $default; |
128 | 128 | } else { |
129 | 129 | $view = $_GET['view']; |
130 | 130 | } |
131 | 131 | |
132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
132 | + return apply_filters('give_get_reporting_view', $view); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $current_view = 'earnings'; |
143 | 143 | $views = give_reports_default_views(); |
144 | 144 | |
145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
146 | 146 | $current_view = $_GET['tab']; |
147 | 147 | } |
148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( "give_reports_view_{$current_view}" ); |
|
154 | + do_action("give_reports_view_{$current_view}"); |
|
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function give_report_views() { |
166 | 166 | $views = give_reports_default_views(); |
167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
168 | 168 | /** |
169 | 169 | * Fires before the report page actions form. |
170 | 170 | * |
171 | 171 | * @since 1.0 |
172 | 172 | */ |
173 | - do_action( 'give_report_view_actions_before' ); |
|
173 | + do_action('give_report_view_actions_before'); |
|
174 | 174 | ?> |
175 | 175 | <form id="give-reports-filter" method="get"> |
176 | 176 | <select id="give-reports-view" name="view"> |
177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
180 | 180 | <?php endforeach; ?> |
181 | 181 | </select> |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_report_view_actions' ); |
|
191 | + do_action('give_report_view_actions'); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
197 | 197 | </form> |
198 | 198 | <?php |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @since 1.0 |
203 | 203 | */ |
204 | - do_action( 'give_report_view_actions_after' ); |
|
204 | + do_action('give_report_view_actions_after'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function give_reports_forms_table() { |
216 | 216 | |
217 | - if ( isset( $_GET['form-id'] ) ) { |
|
217 | + if (isset($_GET['form-id'])) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
222 | 222 | |
223 | 223 | $give_table = new Give_Form_Reports_Table(); |
224 | 224 | $give_table->prepare_items(); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
233 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Renders the detailed report for a specific give form. |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | * @return void |
240 | 240 | */ |
241 | 241 | function give_reports_form_details() { |
242 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
242 | + if ( ! isset($_GET['form-id'])) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | ?> |
246 | 246 | <div class="tablenav top reports-forms-details-wrap"> |
247 | 247 | <div class="actions bulkactions"> |
248 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
248 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
249 | 249 | </div> |
250 | 250 | </div> |
251 | 251 | <?php |
252 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
252 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
255 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Renders the Reports Donors Table |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return void |
264 | 264 | */ |
265 | 265 | function give_reports_donors_table() { |
266 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
266 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
267 | 267 | |
268 | 268 | $give_table = new Give_Donor_Reports_Table(); |
269 | 269 | $give_table->prepare_items(); |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @since 1.0 |
277 | 277 | */ |
278 | - do_action( 'give_logs_donors_table_top' ); |
|
278 | + do_action('give_logs_donors_table_top'); |
|
279 | 279 | |
280 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
280 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
281 | 281 | $give_table->display(); |
282 | 282 | ?> |
283 | 283 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @since 1.0 |
292 | 292 | */ |
293 | - do_action( 'give_logs_donors_table_bottom' ); |
|
293 | + do_action('give_logs_donors_table_bottom'); |
|
294 | 294 | ?> |
295 | 295 | </div> |
296 | 296 | <?php |
297 | 297 | } |
298 | 298 | |
299 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
299 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Renders the Gateways Table |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | * @return void |
308 | 308 | */ |
309 | 309 | function give_reports_gateways_table() { |
310 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
310 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
311 | 311 | |
312 | 312 | $give_table = new Give_Gateway_Reports_Table(); |
313 | 313 | $give_table->prepare_items(); |
314 | 314 | $give_table->display(); |
315 | 315 | } |
316 | 316 | |
317 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
317 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Renders the Reports Earnings Graphs |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | function give_reports_earnings() { |
326 | 326 | ?> |
327 | 327 | <div class="tablenav top reports-table-nav"> |
328 | - <h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2> |
|
328 | + <h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2> |
|
329 | 329 | </div> |
330 | 330 | <?php |
331 | 331 | give_reports_graph(); |
332 | 332 | } |
333 | 333 | |
334 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
334 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
335 | 335 | |
336 | 336 | |
337 | 337 | /** |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_estimated_monthly_stats() { |
344 | 344 | |
345 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
345 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
346 | 346 | |
347 | - if ( false === $estimated ) { |
|
347 | + if (false === $estimated) { |
|
348 | 348 | |
349 | 349 | $estimated = array( |
350 | 350 | 'earnings' => 0, |
@@ -353,22 +353,22 @@ discard block |
||
353 | 353 | |
354 | 354 | $stats = new Give_Payment_Stats; |
355 | 355 | |
356 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
357 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
356 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
357 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
358 | 358 | |
359 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
360 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
361 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
362 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
359 | + $current_day = date('d', current_time('timestamp')); |
|
360 | + $current_month = date('n', current_time('timestamp')); |
|
361 | + $current_year = date('Y', current_time('timestamp')); |
|
362 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
363 | 363 | |
364 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
365 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
364 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
365 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
366 | 366 | |
367 | 367 | // Cache for one day |
368 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
368 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
369 | 369 | } |
370 | 370 | |
371 | - return maybe_unserialize( $estimated ); |
|
371 | + return maybe_unserialize($estimated); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | function give_reports_set_form_method() { |
382 | 382 | return 'get'; |
383 | 383 | } |
384 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
385 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
384 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
385 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
386 | 386 | |
387 | 387 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | * @param array $_data |
82 | 82 | * @param array $options |
83 | 83 | */ |
84 | - public function __construct( $_data, $options = array() ) { |
|
84 | + public function __construct($_data, $options = array()) { |
|
85 | 85 | |
86 | - $this->data = $_data; |
|
86 | + $this->data = $_data; |
|
87 | 87 | |
88 | 88 | // Generate unique ID |
89 | - $this->id = md5( rand() ); |
|
89 | + $this->id = md5(rand()); |
|
90 | 90 | |
91 | 91 | // Setup default options; |
92 | - $this->options = apply_filters( 'give_graph_args', array( |
|
92 | + $this->options = apply_filters('give_graph_args', array( |
|
93 | 93 | 'y_mode' => null, |
94 | 94 | 'x_mode' => null, |
95 | 95 | 'y_decimals' => 0, |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | 'lines' => false, |
108 | 108 | 'points' => true, |
109 | 109 | 'dataType' => array() |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | |
112 | - $this->options = wp_parse_args( $options, $this->options ); |
|
112 | + $this->options = wp_parse_args($options, $this->options); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.0 |
122 | 122 | */ |
123 | - public function set( $key, $value ) { |
|
124 | - $this->options[ $key ] = $value; |
|
123 | + public function set($key, $value) { |
|
124 | + $this->options[$key] = $value; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @since 1.0 |
133 | 133 | */ |
134 | - public function get( $key ) { |
|
135 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
134 | + public function get($key) { |
|
135 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 1.0 |
142 | 142 | */ |
143 | 143 | public function get_data() { |
144 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
144 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function load_scripts() { |
153 | 153 | // Use minified libraries if SCRIPT_DEBUG is turned off |
154 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
154 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
155 | 155 | |
156 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
157 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
156 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
157 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
158 | 158 | |
159 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
160 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
159 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
160 | + wp_enqueue_script('jquery-flot-time'); |
|
161 | 161 | |
162 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
163 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
162 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
163 | + wp_enqueue_script('jquery-flot-resize'); |
|
164 | 164 | |
165 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
166 | - wp_enqueue_script( 'jquery-flot' ); |
|
165 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
166 | + wp_enqueue_script('jquery-flot'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | [ |
191 | 191 | <?php |
192 | 192 | $order = 0; |
193 | - foreach( $this->get_data() as $label => $data ) : |
|
193 | + foreach ($this->get_data() as $label => $data) : |
|
194 | 194 | ?> |
195 | 195 | { |
196 | - label : "<?php echo esc_attr( $label ); ?>", |
|
197 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
198 | - dataType : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>', |
|
196 | + label : "<?php echo esc_attr($label); ?>", |
|
197 | + id : "<?php echo sanitize_key($label); ?>", |
|
198 | + dataType : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>', |
|
199 | 199 | // data format is: [ point on x, value on y ] |
200 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
200 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
201 | 201 | points: { |
202 | 202 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
203 | 203 | }, |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | fill : true, |
213 | 213 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
214 | 214 | }, |
215 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
215 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
216 | 216 | yaxis : <?php echo $yaxis_count; ?> |
217 | 217 | <?php endif; ?> |
218 | 218 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | grid: { |
227 | 227 | show : true, |
228 | 228 | aboveData : false, |
229 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
230 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
231 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
232 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
229 | + color : "<?php echo $this->options['color']; ?>", |
|
230 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
231 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
232 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
233 | 233 | clickable : false, |
234 | 234 | hoverable : true |
235 | 235 | }, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | mode : "<?php echo $this->options['x_mode']; ?>", |
241 | 241 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
242 | 242 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
243 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
243 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
244 | 244 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
245 | 245 | <?php endif; ?> |
246 | 246 | }, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | min : 0, |
250 | 250 | mode : "<?php echo $this->options['y_mode']; ?>", |
251 | 251 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
252 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
252 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
253 | 253 | tickDecimals: <?php echo $this->options['y_decimals']; ?>, |
254 | 254 | <?php endif; ?> |
255 | 255 | tickFormatter: function(val) { |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Graph $this Graph object. |
325 | 325 | */ |
326 | - do_action( 'give_before_graph', $this ); |
|
326 | + do_action('give_before_graph', $this); |
|
327 | 327 | |
328 | 328 | // Build the graph. |
329 | 329 | echo $this->build_graph(); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param Give_Graph $this Graph object. |
337 | 337 | */ |
338 | - do_action( 'give_after_graph', $this ); |
|
338 | + do_action('give_after_graph', $this); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | } |
@@ -363,8 +363,8 @@ |
||
363 | 363 | 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
364 | 364 | ), |
365 | 365 | 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
366 | - 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
367 | - 'give_donation_import' => 'give_donation_import', |
|
366 | + 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
367 | + 'give_donation_import' => 'give_donation_import', |
|
368 | 368 | 'setting_not_save_message' => __( 'Changes you made may not be saved.','give' ), |
369 | 369 | ) ); |
370 | 370 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | 39 | 'currency' => give_get_currency(), |
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => __('Loading...', 'give'), |
|
47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION, |
50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,81 +58,81 @@ discard block |
||
58 | 58 | 'give_form_translation_js', |
59 | 59 | array( |
60 | 60 | // Field name Validation message. |
61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
68 | 68 | ) |
69 | 69 | ), |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | |
72 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
72 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
73 | 73 | 'ajaxurl' => give_get_ajax_url(), |
74 | - 'loading' => __( 'Loading', 'give' ), |
|
74 | + 'loading' => __('Loading', 'give'), |
|
75 | 75 | // General loading message. |
76 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
76 | + 'select_option' => __('Please select an option', 'give'), |
|
77 | 77 | // Variable pricing error with multi-donation option enabled. |
78 | - 'default_gateway' => give_get_default_gateway( null ), |
|
79 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
78 | + 'default_gateway' => give_get_default_gateway(null), |
|
79 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
80 | 80 | 'number_decimals' => give_get_price_decimals(), |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | 83 | // DEBUG is On. |
84 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
84 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
85 | 85 | |
86 | - if ( give_is_cc_verify_enabled() ) { |
|
87 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-cc-validator' ); |
|
86 | + if (give_is_cc_verify_enabled()) { |
|
87 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-cc-validator'); |
|
89 | 89 | } |
90 | 90 | |
91 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-float-labels' ); |
|
91 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-float-labels'); |
|
93 | 93 | |
94 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
95 | - wp_enqueue_script( 'give-blockui' ); |
|
94 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
95 | + wp_enqueue_script('give-blockui'); |
|
96 | 96 | |
97 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
98 | - wp_enqueue_script( 'give-qtip' ); |
|
97 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
98 | + wp_enqueue_script('give-qtip'); |
|
99 | 99 | |
100 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
101 | - wp_enqueue_script( 'give-accounting' ); |
|
100 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
101 | + wp_enqueue_script('give-accounting'); |
|
102 | 102 | |
103 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
104 | - wp_enqueue_script( 'give-magnific' ); |
|
103 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
104 | + wp_enqueue_script('give-magnific'); |
|
105 | 105 | |
106 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give-checkout-global' ); |
|
106 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give-checkout-global'); |
|
108 | 108 | |
109 | 109 | // General scripts. |
110 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
111 | - wp_enqueue_script( 'give-scripts' ); |
|
110 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
111 | + wp_enqueue_script('give-scripts'); |
|
112 | 112 | |
113 | 113 | // Load AJAX scripts, if enabled. |
114 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
115 | - wp_enqueue_script( 'give-ajax' ); |
|
114 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
115 | + wp_enqueue_script('give-ajax'); |
|
116 | 116 | |
117 | 117 | // Localize / Pass AJAX vars from PHP, |
118 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
119 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
118 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
119 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
123 | 123 | // DEBUG is OFF (one JS file to rule them all!). |
124 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
125 | - wp_enqueue_script( 'give' ); |
|
124 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
125 | + wp_enqueue_script('give'); |
|
126 | 126 | |
127 | 127 | // Localize / Pass AJAX vars from PHP. |
128 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
129 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
128 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
129 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
135 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Register styles. |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function give_register_styles() { |
147 | 147 | |
148 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
148 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
153 | - wp_enqueue_style( 'give-styles' ); |
|
152 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
153 | + wp_enqueue_style('give-styles'); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
157 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | /** |
@@ -167,19 +167,19 @@ discard block |
||
167 | 167 | function give_get_stylesheet_uri() { |
168 | 168 | |
169 | 169 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
170 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
170 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
171 | 171 | |
172 | 172 | // LTR or RTL files. |
173 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
173 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
174 | 174 | |
175 | - $file = 'give' . $direction . $suffix . '.css'; |
|
175 | + $file = 'give'.$direction.$suffix.'.css'; |
|
176 | 176 | $templates_dir = give_get_theme_template_dir_name(); |
177 | 177 | |
178 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
179 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
180 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
181 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
178 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
179 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
180 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
181 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
182 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
183 | 183 | |
184 | 184 | $uri = false; |
185 | 185 | |
@@ -189,23 +189,23 @@ discard block |
||
189 | 189 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
190 | 190 | * This allows users to copy just give.css to their theme. |
191 | 191 | */ |
192 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
193 | - if ( ! empty( $nonmin ) ) { |
|
194 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
192 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
193 | + if ( ! empty($nonmin)) { |
|
194 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
195 | 195 | } else { |
196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
197 | 197 | } |
198 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
199 | - if ( ! empty( $nonmin ) ) { |
|
200 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
198 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
199 | + if ( ! empty($nonmin)) { |
|
200 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
201 | 201 | } else { |
202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
203 | 203 | } |
204 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
205 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
204 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
205 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
208 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -222,79 +222,79 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return void |
224 | 224 | */ |
225 | -function give_load_admin_scripts( $hook ) { |
|
225 | +function give_load_admin_scripts($hook) { |
|
226 | 226 | |
227 | 227 | global $post, $post_type; |
228 | 228 | |
229 | 229 | $give_options = give_get_settings(); |
230 | 230 | |
231 | 231 | // Directories of assets. |
232 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
233 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
234 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
232 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
233 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
234 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
235 | 235 | |
236 | 236 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
237 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
237 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
238 | 238 | |
239 | 239 | // LTR or RTL files. |
240 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
240 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
241 | 241 | |
242 | 242 | // Global Admin. |
243 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
244 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
243 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
244 | + wp_enqueue_style('give-admin-bar-notification'); |
|
245 | 245 | |
246 | 246 | // Give Admin Only. |
247 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
247 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | 251 | // CSS. |
252 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
253 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
254 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
255 | - wp_enqueue_style( 'give-admin' ); |
|
256 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
257 | - wp_enqueue_style( 'jquery-chosen' ); |
|
258 | - wp_enqueue_style( 'thickbox' ); |
|
259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
252 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
253 | + wp_enqueue_style('jquery-ui-css'); |
|
254 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
255 | + wp_enqueue_style('give-admin'); |
|
256 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
257 | + wp_enqueue_style('jquery-chosen'); |
|
258 | + wp_enqueue_style('thickbox'); |
|
259 | + wp_enqueue_style('wp-color-picker'); |
|
260 | 260 | |
261 | 261 | |
262 | 262 | // JS. |
263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-selector-cache'); |
|
265 | 265 | |
266 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
267 | - wp_enqueue_script( 'jquery-chosen' ); |
|
266 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
267 | + wp_enqueue_script('jquery-chosen'); |
|
268 | 268 | |
269 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
270 | - wp_enqueue_script( 'give-accounting' ); |
|
269 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
270 | + wp_enqueue_script('give-accounting'); |
|
271 | 271 | |
272 | - wp_enqueue_script( 'wp-color-picker' ); |
|
273 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
274 | - wp_enqueue_script( 'thickbox' ); |
|
272 | + wp_enqueue_script('wp-color-picker'); |
|
273 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
274 | + wp_enqueue_script('thickbox'); |
|
275 | 275 | |
276 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
277 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
276 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
277 | + wp_enqueue_script('give-admin-scripts'); |
|
278 | 278 | |
279 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
280 | - wp_enqueue_script( 'jquery-flot' ); |
|
279 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
280 | + wp_enqueue_script('jquery-flot'); |
|
281 | 281 | |
282 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
283 | - wp_enqueue_script( 'give-qtip' ); |
|
282 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
283 | + wp_enqueue_script('give-qtip'); |
|
284 | 284 | |
285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
286 | + wp_enqueue_script('give-repeatable-fields'); |
|
287 | 287 | |
288 | 288 | // Forms CPT Script. |
289 | - if ( $post_type === 'give_forms' ) { |
|
290 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
291 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
289 | + if ($post_type === 'give_forms') { |
|
290 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
291 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Settings Scripts. |
295 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
296 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
297 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
295 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
296 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
297 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // Price Separators. |
@@ -302,80 +302,80 @@ discard block |
||
302 | 302 | $decimal_separator = give_get_price_decimal_separator(); |
303 | 303 | |
304 | 304 | // Localize strings & variables for JS. |
305 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
306 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
305 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
306 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
307 | 307 | 'give_version' => GIVE_VERSION, |
308 | 308 | 'thousands_separator' => $thousand_separator, |
309 | 309 | 'decimal_separator' => $decimal_separator, |
310 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
311 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
312 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
313 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
314 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
315 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
316 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
317 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
318 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
319 | - 'currency_sign' => give_currency_filter( '' ), |
|
320 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
321 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
322 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
323 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
324 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
325 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
326 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
327 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
310 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
311 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
312 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
313 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
314 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
315 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
316 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
317 | + 'one_option' => __('Choose a form', 'give'), |
|
318 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
319 | + 'currency_sign' => give_currency_filter(''), |
|
320 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
321 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
322 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
323 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
324 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
325 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
326 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
327 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
328 | 328 | /* translators : %s: Donation form options metabox */ |
329 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
330 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
331 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
332 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
333 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
334 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
335 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
329 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
330 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
331 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
332 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
333 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
334 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
335 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
336 | 336 | 'bulk_action' => array( |
337 | 337 | 'delete' => array( |
338 | - 'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
339 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
340 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
338 | + 'zero' => __('You must choose at least one or more payments to delete.', 'give'), |
|
339 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
340 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
341 | 341 | ), |
342 | 342 | 'resend-receipt' => array( |
343 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
344 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
345 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
343 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
344 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
345 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
346 | 346 | ), |
347 | 347 | 'set-to-status' => array( |
348 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
349 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
350 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
348 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
349 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
350 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
351 | 351 | ), |
352 | 352 | ), |
353 | 353 | 'metabox_fields' => array( |
354 | 354 | 'media' => array( |
355 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
355 | + 'button_title' => __('Choose Image', 'give'), |
|
356 | 356 | ), |
357 | 357 | 'file' => array( |
358 | - 'button_title' => __( 'Choose File', 'give' ), |
|
358 | + 'button_title' => __('Choose File', 'give'), |
|
359 | 359 | ) |
360 | 360 | ), |
361 | 361 | 'chosen' => array( |
362 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
363 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
362 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
363 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
364 | 364 | ), |
365 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
366 | - 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
365 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
366 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
367 | 367 | 'give_donation_import' => 'give_donation_import', |
368 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.','give' ), |
|
369 | - ) ); |
|
368 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
369 | + )); |
|
370 | 370 | |
371 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
371 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
372 | 372 | // call for new media manager. |
373 | 373 | wp_enqueue_media(); |
374 | 374 | } |
375 | 375 | |
376 | 376 | } |
377 | 377 | |
378 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
378 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * Admin Give Icon |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | ?> |
391 | 391 | <style type="text/css" media="screen"> |
392 | 392 | |
393 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
393 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
394 | 394 | @font-face { |
395 | 395 | font-family: 'give-icomoon'; |
396 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
397 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
398 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
399 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
396 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
397 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
398 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
399 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
400 | 400 | font-weight: normal; |
401 | 401 | font-style: normal; |
402 | 402 | } |
@@ -415,4 +415,4 @@ discard block |
||
415 | 415 | <?php |
416 | 416 | } |
417 | 417 | |
418 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
418 | +add_action('admin_head', 'give_admin_icon'); |