@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
75 | + 'earnings' => esc_html__('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
78 | - 'gateways' => esc_html__( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => esc_html__('Donors', 'give'), |
|
78 | + 'gateways' => esc_html__('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,53 +284,53 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php esc_html_e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | 316 | <?php |
317 | 317 | printf( |
318 | 318 | /* translators: 1: start date dropdown 2: end date dropdown */ |
319 | - __( '%1$s to %2$s', 'give' ), |
|
320 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
321 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
319 | + __('%1$s to %2$s', 'give'), |
|
320 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
321 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
322 | 322 | ); |
323 | 323 | ?> |
324 | 324 | <input type="hidden" name="give-action" value="earnings_export"/> |
325 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
325 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
326 | 326 | </form> |
327 | 327 | </td> |
328 | 328 | </tr> |
329 | 329 | <tr class="give-export-payment-history"> |
330 | 330 | <td class="row-title"> |
331 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
331 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
332 | 332 | |
333 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
333 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
334 | 334 | </td> |
335 | 335 | <td> |
336 | 336 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -338,29 +338,29 @@ discard block |
||
338 | 338 | $args = array( |
339 | 339 | 'id' => 'give-payment-export-start', |
340 | 340 | 'name' => 'start', |
341 | - 'placeholder' => esc_attr__( 'Start date', 'give' ) |
|
341 | + 'placeholder' => esc_attr__('Start date', 'give') |
|
342 | 342 | ); |
343 | - echo Give()->html->date_field( $args ); ?> |
|
343 | + echo Give()->html->date_field($args); ?> |
|
344 | 344 | <?php |
345 | 345 | $args = array( |
346 | 346 | 'id' => 'give-payment-export-end', |
347 | 347 | 'name' => 'end', |
348 | - 'placeholder' => esc_attr__( 'End date', 'give' ) |
|
348 | + 'placeholder' => esc_attr__('End date', 'give') |
|
349 | 349 | ); |
350 | - echo Give()->html->date_field( $args ); ?> |
|
350 | + echo Give()->html->date_field($args); ?> |
|
351 | 351 | <select name="status"> |
352 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
352 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
353 | 353 | <?php |
354 | 354 | $statuses = give_get_payment_statuses(); |
355 | - foreach ( $statuses as $status => $label ) { |
|
356 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
355 | + foreach ($statuses as $status => $label) { |
|
356 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
357 | 357 | } |
358 | 358 | ?> |
359 | 359 | </select> |
360 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
360 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
361 | 361 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
362 | 362 | <span> |
363 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
363 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
364 | 364 | <span class="spinner"></span> |
365 | 365 | </span> |
366 | 366 | </form> |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | </tr> |
370 | 370 | <tr class="alternate give-export-donors"> |
371 | 371 | <td class="row-title"> |
372 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
372 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
373 | 373 | |
374 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
374 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
375 | 375 | </td> |
376 | 376 | <td> |
377 | 377 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -382,54 +382,54 @@ discard block |
||
382 | 382 | 'id' => 'give_customer_export_form', |
383 | 383 | 'chosen' => true |
384 | 384 | ); |
385 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
385 | + echo Give()->html->forms_dropdown($args); ?> |
|
386 | 386 | |
387 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
387 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
388 | 388 | |
389 | 389 | <div id="export-donor-options-wrap" class="give-clearfix"> |
390 | - <p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p> |
|
390 | + <p><?php esc_html_e('Export Columns', 'give'); ?>:</p> |
|
391 | 391 | <ul id="give-export-option-ul"> |
392 | 392 | <li> |
393 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
393 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
394 | 394 | </label> |
395 | 395 | </li> |
396 | 396 | <li> |
397 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
397 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
398 | 398 | </label> |
399 | 399 | </li> |
400 | 400 | <li> |
401 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
401 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
402 | 402 | </label> |
403 | 403 | </li> |
404 | 404 | <li> |
405 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
405 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
406 | 406 | </label> |
407 | 407 | </li> |
408 | 408 | <li> |
409 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
409 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
410 | 410 | </label> |
411 | 411 | </li> |
412 | 412 | <li> |
413 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
413 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
414 | 414 | </label> |
415 | 415 | </li> |
416 | 416 | <li> |
417 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
417 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
418 | 418 | </label> |
419 | 419 | </li> |
420 | 420 | </ul> |
421 | 421 | </div> |
422 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
422 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
423 | 423 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
424 | 424 | <input type="hidden" name="give-action" value="email_export"/> |
425 | 425 | </form> |
426 | 426 | </td> |
427 | 427 | </tr> |
428 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
428 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
429 | 429 | </tbody> |
430 | 430 | </table> |
431 | 431 | |
432 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
432 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
433 | 433 | |
434 | 434 | </div> |
435 | 435 | <!-- .post-body-content --> |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | <?php |
440 | 440 | } |
441 | 441 | |
442 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
442 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Renders the Reports page |
@@ -449,19 +449,19 @@ discard block |
||
449 | 449 | */ |
450 | 450 | function give_reports_tab_logs() { |
451 | 451 | |
452 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
452 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
453 | 453 | |
454 | 454 | $current_view = 'sales'; |
455 | 455 | $log_views = give_log_default_views(); |
456 | 456 | |
457 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
457 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
458 | 458 | $current_view = $_GET['view']; |
459 | 459 | } |
460 | 460 | |
461 | - do_action( 'give_logs_view_' . $current_view ); |
|
461 | + do_action('give_logs_view_'.$current_view); |
|
462 | 462 | } |
463 | 463 | |
464 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
464 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
465 | 465 | |
466 | 466 | /** |
467 | 467 | * Retrieves estimated monthly earnings and sales |
@@ -471,9 +471,9 @@ discard block |
||
471 | 471 | */ |
472 | 472 | function give_estimated_monthly_stats() { |
473 | 473 | |
474 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
474 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
475 | 475 | |
476 | - if ( false === $estimated ) { |
|
476 | + if (false === $estimated) { |
|
477 | 477 | |
478 | 478 | $estimated = array( |
479 | 479 | 'earnings' => 0, |
@@ -482,20 +482,20 @@ discard block |
||
482 | 482 | |
483 | 483 | $stats = new Give_Payment_Stats; |
484 | 484 | |
485 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
486 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
485 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
486 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
487 | 487 | |
488 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
489 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
490 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
491 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
488 | + $current_day = date('d', current_time('timestamp')); |
|
489 | + $current_month = date('n', current_time('timestamp')); |
|
490 | + $current_year = date('Y', current_time('timestamp')); |
|
491 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
492 | 492 | |
493 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
494 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
493 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
494 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
495 | 495 | |
496 | 496 | // Cache for one day |
497 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
497 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
498 | 498 | } |
499 | 499 | |
500 | - return maybe_unserialize( $estimated ); |
|
500 | + return maybe_unserialize($estimated); |
|
501 | 501 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views |
25 | 25 | */ |
26 | -function give_register_default_customer_views( $views ) { |
|
26 | +function give_register_default_customer_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_customer_notes_view' |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_customer_tabs( $tabs ) { |
|
49 | +function give_register_default_customer_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ), |
|
53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) ) |
|
52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')), |
|
53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give')) |
|
54 | 54 | ); |
55 | 55 | |
56 | - return array_merge( $tabs, $default_tabs ); |
|
56 | + return array_merge($tabs, $default_tabs); |
|
57 | 57 | } |
58 | 58 | |
59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
69 | 69 | */ |
70 | -function give_register_delete_customer_tab( $tabs ) { |
|
70 | +function give_register_delete_customer_tab($tabs) { |
|
71 | 71 | |
72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) ); |
|
72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give')); |
|
73 | 73 | |
74 | 74 | return $tabs; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,50 +107,50 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | 128 | /* translators: %s: payment id */ |
129 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
130 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
131 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
129 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
130 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
131 | + $subject = give_do_email_tags($subject, $payment_id); |
|
132 | 132 | |
133 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
134 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
133 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
134 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
135 | 135 | //$headers .= "MIME-Version: 1.0\r\n"; |
136 | 136 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
137 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
137 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
138 | 138 | |
139 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
139 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
140 | 140 | |
141 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
141 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
142 | 142 | |
143 | 143 | $emails = Give()->emails; |
144 | - $emails->__set( 'from_name', $from_name ); |
|
145 | - $emails->__set( 'from_email', $from_email ); |
|
146 | - $emails->__set( 'headers', $headers ); |
|
147 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
144 | + $emails->__set('from_name', $from_name); |
|
145 | + $emails->__set('from_email', $from_email); |
|
146 | + $emails->__set('headers', $headers); |
|
147 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
148 | 148 | |
149 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
149 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
153 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | function give_get_admin_notice_emails() { |
164 | 164 | global $give_options; |
165 | 165 | |
166 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
167 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
166 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
167 | + $emails = array_map('trim', explode("\n", $emails)); |
|
168 | 168 | |
169 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
169 | + return apply_filters('give_admin_notice_emails', $emails); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return mixed |
180 | 180 | */ |
181 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
181 | +function give_admin_notices_disabled($payment_id = 0) { |
|
182 | 182 | |
183 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
183 | + $retval = give_get_option('disable_admin_notices'); |
|
184 | 184 | |
185 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
185 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function give_get_default_donation_notification_email() { |
197 | 197 | |
198 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
199 | - $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"; |
|
200 | - $default_email_body .= '<strong>' . esc_html__( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . esc_html__( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
202 | - $default_email_body .= '<strong>' . esc_html__( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
203 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
204 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
198 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
199 | + $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"; |
|
200 | + $default_email_body .= '<strong>'.esc_html__('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.esc_html__('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
202 | + $default_email_body .= '<strong>'.esc_html__('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
203 | + $default_email_body .= '<strong>'.esc_html__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
204 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n".'{sitename}'; |
|
205 | 205 | |
206 | - $custom_message = give_get_option( 'donation_notification' ); |
|
207 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
206 | + $custom_message = give_get_option('donation_notification'); |
|
207 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
208 | 208 | |
209 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
209 | + return apply_filters('give_default_donation_notification_email', $message); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -220,26 +220,26 @@ discard block |
||
220 | 220 | */ |
221 | 221 | function give_get_default_donation_receipt_email() { |
222 | 222 | |
223 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
224 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
225 | - $default_email_body .= '<strong>' . esc_html__( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . esc_html__( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . esc_html__( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
231 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
232 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
223 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
224 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
225 | + $default_email_body .= '<strong>'.esc_html__('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.esc_html__('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.esc_html__('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.esc_html__('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.esc_html__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.esc_html__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
231 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
232 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
233 | 233 | |
234 | 234 | $default_email_body .= "\n\n"; |
235 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ); |
|
236 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
235 | + $default_email_body .= esc_html__('Sincerely,', 'give'); |
|
236 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
237 | 237 | |
238 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
238 | + $custom_message = give_get_option('donation_receipt'); |
|
239 | 239 | |
240 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
240 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
241 | 241 | |
242 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
242 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return array $email_names |
253 | 253 | */ |
254 | -function give_get_email_names( $user_info ) { |
|
254 | +function give_get_email_names($user_info) { |
|
255 | 255 | $email_names = array(); |
256 | - $user_info = maybe_unserialize( $user_info ); |
|
256 | + $user_info = maybe_unserialize($user_info); |
|
257 | 257 | |
258 | 258 | $email_names['fullname'] = ''; |
259 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
260 | - $user_data = get_userdata( $user_info['id'] ); |
|
259 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
260 | + $user_data = get_userdata($user_info['id']); |
|
261 | 261 | $email_names['name'] = $user_info['first_name']; |
262 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
262 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
263 | 263 | $email_names['username'] = $user_data->user_login; |
264 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
264 | + } elseif (isset($user_info['first_name'])) { |
|
265 | 265 | $email_names['name'] = $user_info['first_name']; |
266 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
266 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
267 | 267 | $email_names['username'] = $user_info['first_name']; |
268 | 268 | } else { |
269 | 269 | $email_names['name'] = $user_info['email']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string $message Fully formatted message |
56 | 56 | */ |
57 | -function give_email_preview_template_tags( $message ) { |
|
57 | +function give_email_preview_template_tags($message) { |
|
58 | 58 | |
59 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
59 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
60 | 60 | |
61 | 61 | $gateway = 'PayPal'; |
62 | 62 | |
63 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
63 | + $receipt_id = strtolower(md5(uniqid())); |
|
64 | 64 | |
65 | - $notes = esc_html__( 'These are some sample notes added to a donation.', 'give' ); |
|
65 | + $notes = esc_html__('These are some sample notes added to a donation.', 'give'); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - esc_html__( 'View the receipt in your browser', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + esc_html__('View the receipt in your browser', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{price}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', 'Sample Donation Form Title', $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{product_notes}', $notes, $message ); |
|
87 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
88 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{price}', $price, $message); |
|
82 | + $message = str_replace('{donation}', 'Sample Donation Form Title', $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{product_notes}', $notes, $message); |
|
87 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
88 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | * @since 1.0 |
101 | 101 | * @return array|bool |
102 | 102 | */ |
103 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
103 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
104 | 104 | |
105 | -function give_email_template_preview( $array ) { |
|
105 | +function give_email_template_preview($array) { |
|
106 | 106 | |
107 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
107 | + if ( ! current_user_can('manage_give_settings')) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | $custom_field = array( |
111 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
112 | - 'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ), |
|
111 | + 'name' => esc_html__('Preview Email', 'give'), |
|
112 | + 'desc' => esc_html__('Click the buttons to preview emails.', 'give'), |
|
113 | 113 | 'id' => 'give_email_preview_buttons', |
114 | 114 | 'type' => 'email_preview_buttons' |
115 | 115 | ); |
116 | - array_splice( $array, 5, 0, array( $custom_field ) ); |
|
116 | + array_splice($array, 5, 0, array($custom_field)); |
|
117 | 117 | |
118 | 118 | return $array; // splice in at position 3; |
119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | function give_email_preview_buttons_callback() { |
130 | 130 | ob_start(); |
131 | 131 | ?> |
132 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
133 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
132 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
133 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_test_email', |
135 | 135 | 'give-message' => 'sent-test-email' |
136 | - ) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
136 | + )), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
137 | 137 | <?php |
138 | 138 | echo ob_get_clean(); |
139 | 139 | } |
@@ -146,27 +146,27 @@ discard block |
||
146 | 146 | */ |
147 | 147 | function give_display_email_template_preview() { |
148 | 148 | |
149 | - if ( empty( $_GET['give_action'] ) ) { |
|
149 | + if (empty($_GET['give_action'])) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
153 | + if ('preview_email' !== $_GET['give_action']) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
157 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
157 | + if ( ! current_user_can('manage_give_settings')) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) ); |
|
163 | + echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array()))); |
|
164 | 164 | |
165 | 165 | exit; |
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'template_redirect', 'give_display_email_template_preview' ); |
|
169 | +add_action('template_redirect', 'give_display_email_template_preview'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Email Template Body |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string $email_body Body of the email |
180 | 180 | */ |
181 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
181 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
182 | 182 | |
183 | 183 | global $give_options; |
184 | 184 | |
185 | 185 | $default_email_body = give_get_default_donation_receipt_email(); |
186 | 186 | |
187 | - $email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body; |
|
187 | + $email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body; |
|
188 | 188 | |
189 | - $email_body = wpautop( $email ); |
|
189 | + $email_body = wpautop($email); |
|
190 | 190 | |
191 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
191 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
192 | 192 | |
193 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
193 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -206,42 +206,42 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return string $email_body Body of the email |
208 | 208 | */ |
209 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
209 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
210 | 210 | global $give_options; |
211 | 211 | |
212 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
213 | - $email = give_get_payment_user_email( $payment_id ); |
|
212 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
213 | + $email = give_get_payment_user_email($payment_id); |
|
214 | 214 | |
215 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
216 | - $user_data = get_userdata( $user_info['id'] ); |
|
215 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
216 | + $user_data = get_userdata($user_info['id']); |
|
217 | 217 | $name = $user_data->display_name; |
218 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
219 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
218 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
219 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
220 | 220 | } else { |
221 | 221 | $name = $email; |
222 | 222 | } |
223 | 223 | |
224 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
224 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
225 | 225 | |
226 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
227 | - $default_email_body .= esc_html__( 'A donation has been made', 'give' ) . ".\n\n"; |
|
226 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
227 | + $default_email_body .= esc_html__('A donation has been made', 'give').".\n\n"; |
|
228 | 228 | $default_email_body .= sprintf( |
229 | 229 | /* translators: %s: form plural label */ |
230 | - esc_html__( '%s sold:', 'give' ), |
|
230 | + esc_html__('%s sold:', 'give'), |
|
231 | 231 | give_get_forms_label_plural() |
232 | - ) . "\n\n"; |
|
232 | + )."\n\n"; |
|
233 | 233 | |
234 | - $default_email_body .= esc_html__( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
235 | - $default_email_body .= esc_html__( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
236 | - $default_email_body .= esc_html__( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n"; |
|
234 | + $default_email_body .= esc_html__('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
235 | + $default_email_body .= esc_html__('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
236 | + $default_email_body .= esc_html__('Payment Method: ', 'give')." ".$gateway."\n\n"; |
|
237 | 237 | |
238 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
238 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
239 | 239 | |
240 | - $email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body; |
|
240 | + $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body; |
|
241 | 241 | |
242 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
242 | + $email_body = give_do_email_tags($email, $payment_id); |
|
243 | 243 | |
244 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
244 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * @since 1.0 |
255 | 255 | */ |
256 | 256 | function give_render_receipt_in_browser() { |
257 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
258 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ) ); |
|
257 | + if ( ! isset($_GET['payment_key'])) { |
|
258 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give')); |
|
259 | 259 | } |
260 | 260 | |
261 | - $key = urlencode( $_GET['payment_key'] ); |
|
261 | + $key = urlencode($_GET['payment_key']); |
|
262 | 262 | |
263 | 263 | ob_start(); |
264 | 264 | //Disallows caching of the page |
265 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
265 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
266 | 266 | header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
267 | 267 | header("Cache-Control: post-check=0, pre-check=0", false); |
268 | 268 | header("Pragma: no-cache"); // HTTP/1.0 |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | <!DOCTYPE html> |
272 | 272 | <html lang="en"> |
273 | 273 | <head> |
274 | - <title><?php esc_html_e( 'Donation Receipt', 'give' ); ?></title> |
|
274 | + <title><?php esc_html_e('Donation Receipt', 'give'); ?></title> |
|
275 | 275 | <meta charset="utf-8" /> |
276 | 276 | |
277 | 277 | <!-- Further disallowing of caching of this page --> |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | |
286 | 286 | <?php wp_head(); ?> |
287 | 287 | </head> |
288 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
288 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
289 | 289 | |
290 | 290 | <div id="give_receipt_wrapper"> |
291 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
292 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
293 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
291 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
292 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
293 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
294 | 294 | </div> |
295 | 295 | |
296 | 296 | <?php wp_footer(); ?> |
@@ -301,4 +301,4 @@ discard block |
||
301 | 301 | die(); |
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
304 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @see Give_Cron::weekly_events() |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
33 | + add_action('wp', array($this, 'schedule_Events')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function add_schedules( $schedules = array() ) { |
|
45 | + public function add_schedules($schedules = array()) { |
|
46 | 46 | // Adds once weekly to the existing schedules. |
47 | 47 | $schedules['weekly'] = array( |
48 | 48 | 'interval' => 604800, |
49 | - 'display' => esc_html__( 'Once Weekly', 'give' ) |
|
49 | + 'display' => esc_html__('Once Weekly', 'give') |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | private function weekly_events() { |
75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | private function daily_events() { |
88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |