@@ -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 esc_attr_e( $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 esc_attr_e($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 | - esc_html__( '%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 | + esc_html__('%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 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) : |
|
117 | + if ($day_by_day) : |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | else : |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | endif; |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html__('Income', 'give') => $earnings_data, |
|
181 | + esc_html__('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | <div class="postbox"> |
191 | 191 | <div class="inside"> |
192 | 192 | <?php |
193 | - $graph = new Give_Graph( $data ); |
|
194 | - $graph->set( 'x_mode', 'time' ); |
|
195 | - $graph->set( 'multiple_y_axes', true ); |
|
193 | + $graph = new Give_Graph($data); |
|
194 | + $graph->set('x_mode', 'time'); |
|
195 | + $graph->set('multiple_y_axes', true); |
|
196 | 196 | $graph->display(); |
197 | 197 | |
198 | - if ( 'this_month' == $dates['range'] ) { |
|
198 | + if ('this_month' == $dates['range']) { |
|
199 | 199 | $estimated = give_estimated_monthly_stats(); |
200 | 200 | } |
201 | 201 | ?> |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | 208 | <td class="row-title"> |
209 | - <label for="tablecell"><?php esc_html_e( 'Total income for period: ', 'give' ); ?></label></td> |
|
210 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
209 | + <label for="tablecell"><?php esc_html_e('Total income for period: ', 'give'); ?></label></td> |
|
210 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
211 | 211 | </tr> |
212 | 212 | <tr class="alternate"> |
213 | 213 | <td class="row-title"> |
214 | - <label for="tablecell"><?php esc_html_e( 'Total donations for period shown: ', 'give' ); ?></label> |
|
214 | + <label for="tablecell"><?php esc_html_e('Total donations for period shown: ', 'give'); ?></label> |
|
215 | 215 | </td> |
216 | - <td><?php echo give_format_amount( $sales_totals, false ); ?></td> |
|
216 | + <td><?php echo give_format_amount($sales_totals, false); ?></td> |
|
217 | 217 | </tr> |
218 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
218 | + <?php if ('this_month' == $dates['range']) : ?> |
|
219 | 219 | <tr> |
220 | 220 | <td class="row-title"> |
221 | - <label for="tablecell"><?php esc_html_e( 'Estimated monthly income: ', 'give' ); ?></label> |
|
221 | + <label for="tablecell"><?php esc_html_e('Estimated monthly income: ', 'give'); ?></label> |
|
222 | 222 | </td> |
223 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
223 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
224 | 224 | </tr> |
225 | 225 | <tr class="alternate"> |
226 | 226 | <td class="row-title"> |
227 | - <label for="tablecell"><?php esc_html_e( 'Estimated monthly donations: ', 'give' ); ?></label> |
|
227 | + <label for="tablecell"><?php esc_html_e('Estimated monthly donations: ', 'give'); ?></label> |
|
228 | 228 | </td> |
229 | - <td><?php echo give_format_amount( $estimated['sales'], false ); ?></td> |
|
229 | + <td><?php echo give_format_amount($estimated['sales'], false); ?></td> |
|
230 | 230 | </tr> |
231 | 231 | <?php endif; ?> |
232 | 232 | </table> |
233 | 233 | |
234 | - <?php do_action( 'give_reports_graph_additional_stats' ); ?> |
|
234 | + <?php do_action('give_reports_graph_additional_stats'); ?> |
|
235 | 235 | |
236 | 236 | </div> |
237 | 237 | </div> |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | * @since 1.0 |
250 | 250 | * @return void |
251 | 251 | */ |
252 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
252 | +function give_reports_graph_of_form($form_id = 0) { |
|
253 | 253 | // Retrieve the queried dates |
254 | 254 | $dates = give_get_report_dates(); |
255 | 255 | |
256 | 256 | // Determine graph options |
257 | - switch ( $dates['range'] ) : |
|
257 | + switch ($dates['range']) : |
|
258 | 258 | case 'today' : |
259 | 259 | case 'yesterday' : |
260 | 260 | $day_by_day = true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $day_by_day = false; |
273 | 273 | break; |
274 | 274 | case 'other' : |
275 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
275 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
276 | 276 | $day_by_day = false; |
277 | 277 | } else { |
278 | 278 | $day_by_day = true; |
@@ -284,75 +284,75 @@ discard block |
||
284 | 284 | endswitch; |
285 | 285 | |
286 | 286 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
287 | - $sales_totals = 0; // Total sales for time period shown |
|
287 | + $sales_totals = 0; // Total sales for time period shown |
|
288 | 288 | |
289 | 289 | $earnings_data = array(); |
290 | 290 | $sales_data = array(); |
291 | 291 | $stats = new Give_Payment_Stats; |
292 | 292 | |
293 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
293 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
294 | 294 | |
295 | 295 | // Hour by hour |
296 | 296 | $month = $dates['m_start']; |
297 | 297 | $hour = 1; |
298 | 298 | $minute = 0; |
299 | 299 | $second = 0; |
300 | - while ( $hour <= 23 ) : |
|
300 | + while ($hour <= 23) : |
|
301 | 301 | |
302 | - if ( $hour == 23 ) { |
|
302 | + if ($hour == 23) { |
|
303 | 303 | $minute = $second = 59; |
304 | 304 | } |
305 | 305 | |
306 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
307 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
306 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
307 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
308 | 308 | |
309 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
309 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
310 | 310 | $sales_totals += $sales; |
311 | 311 | |
312 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
312 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
313 | 313 | $earnings_totals += $earnings; |
314 | 314 | |
315 | - $sales_data[] = array( $date * 1000, $sales ); |
|
316 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
315 | + $sales_data[] = array($date * 1000, $sales); |
|
316 | + $earnings_data[] = array($date * 1000, $earnings); |
|
317 | 317 | |
318 | - $hour ++; |
|
318 | + $hour++; |
|
319 | 319 | endwhile; |
320 | 320 | |
321 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
321 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
322 | 322 | |
323 | 323 | //Day by day |
324 | 324 | $day = $dates['day']; |
325 | 325 | $day_end = $dates['day_end']; |
326 | 326 | $month = $dates['m_start']; |
327 | - while ( $day <= $day_end ) : |
|
327 | + while ($day <= $day_end) : |
|
328 | 328 | |
329 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
330 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
331 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
329 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
330 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
331 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
332 | 332 | $sales_totals += $sales; |
333 | 333 | |
334 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
334 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
335 | 335 | $earnings_totals += $earnings; |
336 | 336 | |
337 | - $sales_data[] = array( $date * 1000, $sales ); |
|
338 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
337 | + $sales_data[] = array($date * 1000, $sales); |
|
338 | + $earnings_data[] = array($date * 1000, $earnings); |
|
339 | 339 | |
340 | - $day ++; |
|
340 | + $day++; |
|
341 | 341 | endwhile; |
342 | 342 | |
343 | 343 | } else { |
344 | 344 | |
345 | 345 | $y = $dates['year']; |
346 | 346 | |
347 | - while ( $y <= $dates['year_end'] ) : |
|
347 | + while ($y <= $dates['year_end']) : |
|
348 | 348 | |
349 | 349 | $last_year = false; |
350 | 350 | |
351 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
351 | + if ($dates['year'] == $dates['year_end']) { |
|
352 | 352 | $month_start = $dates['m_start']; |
353 | 353 | $month_end = $dates['m_end']; |
354 | 354 | $last_year = true; |
355 | - } elseif ( $y == $dates['year'] ) { |
|
355 | + } elseif ($y == $dates['year']) { |
|
356 | 356 | $month_start = $dates['m_start']; |
357 | 357 | $month_end = 12; |
358 | 358 | } else { |
@@ -361,75 +361,75 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | $i = $month_start; |
364 | - while ( $i <= $month_end ) : |
|
364 | + while ($i <= $month_end) : |
|
365 | 365 | |
366 | - if ( $day_by_day ) : |
|
366 | + if ($day_by_day) : |
|
367 | 367 | |
368 | - if ( $i == $month_end && $last_year ) { |
|
368 | + if ($i == $month_end && $last_year) { |
|
369 | 369 | |
370 | 370 | $num_of_days = $dates['day_end']; |
371 | 371 | |
372 | 372 | } else { |
373 | 373 | |
374 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
374 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
378 | 378 | $d = $dates['day']; |
379 | - while ( $d <= $num_of_days ) : |
|
379 | + while ($d <= $num_of_days) : |
|
380 | 380 | |
381 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
382 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
381 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
382 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
383 | 383 | |
384 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
384 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
385 | 385 | $sales_totals += $sales; |
386 | 386 | |
387 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
387 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
388 | 388 | $earnings_totals += $earnings; |
389 | 389 | |
390 | - $sales_data[] = array( $date * 1000, $sales ); |
|
391 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
392 | - $d ++; |
|
390 | + $sales_data[] = array($date * 1000, $sales); |
|
391 | + $earnings_data[] = array($date * 1000, $earnings); |
|
392 | + $d++; |
|
393 | 393 | |
394 | 394 | endwhile; |
395 | 395 | |
396 | 396 | else : |
397 | 397 | |
398 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
398 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
399 | 399 | |
400 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
401 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
400 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
401 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
402 | 402 | |
403 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
403 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
404 | 404 | $sales_totals += $sales; |
405 | 405 | |
406 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
406 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
407 | 407 | $earnings_totals += $earnings; |
408 | 408 | |
409 | - $sales_data[] = array( $date * 1000, $sales ); |
|
410 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
409 | + $sales_data[] = array($date * 1000, $sales); |
|
410 | + $earnings_data[] = array($date * 1000, $earnings); |
|
411 | 411 | endif; |
412 | 412 | |
413 | - $i ++; |
|
413 | + $i++; |
|
414 | 414 | |
415 | 415 | endwhile; |
416 | 416 | |
417 | - $y ++; |
|
417 | + $y++; |
|
418 | 418 | endwhile; |
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | 422 | $data = array( |
423 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
424 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
423 | + esc_html__('Income', 'give') => $earnings_data, |
|
424 | + esc_html__('Donations', 'give') => $sales_data |
|
425 | 425 | ); |
426 | 426 | |
427 | 427 | ?> |
428 | 428 | <h3><span><?php |
429 | 429 | printf( |
430 | 430 | /* translators: %s: form title */ |
431 | - esc_html__( 'Income Over Time for %s', 'give' ), |
|
432 | - get_the_title( $form_id ) |
|
431 | + esc_html__('Income Over Time for %s', 'give'), |
|
432 | + get_the_title($form_id) |
|
433 | 433 | ); |
434 | 434 | ?></span></h3> |
435 | 435 | |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | <div class="postbox"> |
438 | 438 | <div class="inside"> |
439 | 439 | <?php |
440 | - $graph = new Give_Graph( $data ); |
|
441 | - $graph->set( 'x_mode', 'time' ); |
|
442 | - $graph->set( 'multiple_y_axes', true ); |
|
440 | + $graph = new Give_Graph($data); |
|
441 | + $graph->set('x_mode', 'time'); |
|
442 | + $graph->set('multiple_y_axes', true); |
|
443 | 443 | $graph->display(); |
444 | 444 | ?> |
445 | 445 | </div> |
@@ -449,26 +449,26 @@ discard block |
||
449 | 449 | <tbody> |
450 | 450 | <tr> |
451 | 451 | <td class="row-title"> |
452 | - <label for="tablecell"><?php esc_html_e( 'Total income for period: ', 'give' ); ?></label></td> |
|
453 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
452 | + <label for="tablecell"><?php esc_html_e('Total income for period: ', 'give'); ?></label></td> |
|
453 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
454 | 454 | </tr> |
455 | 455 | <tr class="alternate"> |
456 | 456 | <td class="row-title"> |
457 | - <label for="tablecell"><?php esc_html_e( 'Total donations for period: ', 'give' ); ?></label> |
|
457 | + <label for="tablecell"><?php esc_html_e('Total donations for period: ', 'give'); ?></label> |
|
458 | 458 | </td> |
459 | 459 | <td><?php echo $sales_totals; ?></td> |
460 | 460 | </tr> |
461 | 461 | <tr> |
462 | 462 | <td class="row-title"> |
463 | - <label for="tablecell"><?php esc_html_e( 'Average monthly income: %s', 'give' ); ?></label> |
|
463 | + <label for="tablecell"><?php esc_html_e('Average monthly income: %s', 'give'); ?></label> |
|
464 | 464 | </td> |
465 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
465 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
466 | 466 | </tr> |
467 | 467 | <tr class="alternate"> |
468 | 468 | <td class="row-title"> |
469 | - <label for="tablecell"><?php esc_html_e( 'Average monthly donations: %s', 'give' ); ?></label> |
|
469 | + <label for="tablecell"><?php esc_html_e('Average monthly donations: %s', 'give'); ?></label> |
|
470 | 470 | </td> |
471 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
471 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
472 | 472 | </tr> |
473 | 473 | </tbody> |
474 | 474 | </table> |
@@ -485,29 +485,29 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | function give_reports_graph_controls() { |
488 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
489 | - 'today' => esc_html__( 'Today', 'give' ), |
|
490 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
491 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
492 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
493 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
494 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
495 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
496 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
497 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
498 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
499 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
500 | - ) ); |
|
488 | + $date_options = apply_filters('give_report_date_options', array( |
|
489 | + 'today' => esc_html__('Today', 'give'), |
|
490 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
491 | + 'this_week' => esc_html__('This Week', 'give'), |
|
492 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
493 | + 'this_month' => esc_html__('This Month', 'give'), |
|
494 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
495 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
496 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
497 | + 'this_year' => esc_html__('This Year', 'give'), |
|
498 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
499 | + 'other' => esc_html__('Custom', 'give') |
|
500 | + )); |
|
501 | 501 | |
502 | 502 | $dates = give_get_report_dates(); |
503 | 503 | $display = $dates['range'] == 'other' ? '' : 'style="display:none;"'; |
504 | 504 | $view = give_get_reporting_view(); |
505 | 505 | |
506 | - if ( empty( $dates['day_end'] ) ) { |
|
507 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
506 | + if (empty($dates['day_end'])) { |
|
507 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
508 | 508 | } |
509 | 509 | |
510 | - do_action( 'give_report_graph_controls_before' ); |
|
510 | + do_action('give_report_graph_controls_before'); |
|
511 | 511 | ?> |
512 | 512 | <form id="give-graphs-filter" method="get" class="alignright"> |
513 | 513 | <div class="tablenav top alignright"> |
@@ -515,53 +515,53 @@ discard block |
||
515 | 515 | |
516 | 516 | <input type="hidden" name="post_type" value="give_forms" /> |
517 | 517 | <input type="hidden" name="page" value="give-reports" /> |
518 | - <input type="hidden" name="view" value="<?php esc_attr_e( $view ); ?>" /> |
|
518 | + <input type="hidden" name="view" value="<?php esc_attr_e($view); ?>" /> |
|
519 | 519 | |
520 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
521 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
520 | + <?php if (isset($_GET['form-id'])) : ?> |
|
521 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
522 | 522 | <?php endif; ?> |
523 | 523 | |
524 | 524 | <div id="give-graphs-date-options-wrap" class="alignright"> |
525 | 525 | <select id="give-graphs-date-options" name="range"> |
526 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
527 | - <option value="<?php esc_attr_e( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php esc_html_e( $option ); ?></option> |
|
526 | + <?php foreach ($date_options as $key => $option) : ?> |
|
527 | + <option value="<?php esc_attr_e($key); ?>"<?php selected($key, $dates['range']); ?>><?php esc_html_e($option); ?></option> |
|
528 | 528 | <?php endforeach; ?> |
529 | 529 | </select> |
530 | 530 | |
531 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
531 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
532 | 532 | </div> |
533 | 533 | |
534 | 534 | <div id="give-date-range-options" <?php echo $display; ?>> |
535 | - <span><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <span><?php esc_html_e('From', 'give'); ?> </span> |
|
536 | 536 | <select id="give-graphs-month-start" name="m_start"> |
537 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
538 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
537 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
538 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
539 | 539 | <?php endfor; ?> |
540 | 540 | </select> |
541 | 541 | <select id="give-graphs-day-start" name="day"> |
542 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
543 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option> |
|
542 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
543 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option> |
|
544 | 544 | <?php endfor; ?> |
545 | 545 | </select> |
546 | 546 | <select id="give-graphs-year-start" name="year"> |
547 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
548 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option> |
|
547 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
548 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option> |
|
549 | 549 | <?php endfor; ?> |
550 | 550 | </select> |
551 | - <span><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
551 | + <span><?php esc_html_e('To', 'give'); ?> </span> |
|
552 | 552 | <select id="give-graphs-month-end" name="m_end"> |
553 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
554 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
553 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
554 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
555 | 555 | <?php endfor; ?> |
556 | 556 | </select> |
557 | 557 | <select id="give-graphs-day-end" name="day_end"> |
558 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
559 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option> |
|
558 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
559 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option> |
|
560 | 560 | <?php endfor; ?> |
561 | 561 | </select> |
562 | 562 | <select id="give-graphs-year-end" name="year_end"> |
563 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
564 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option> |
|
563 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
564 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option> |
|
565 | 565 | <?php endfor; ?> |
566 | 566 | </select> |
567 | 567 | </div> |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | </div> |
572 | 572 | </form> |
573 | 573 | <?php |
574 | - do_action( 'give_report_graph_controls_after' ); |
|
574 | + do_action('give_report_graph_controls_after'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -586,65 +586,65 @@ discard block |
||
586 | 586 | function give_get_report_dates() { |
587 | 587 | $dates = array(); |
588 | 588 | |
589 | - $current_time = current_time( 'timestamp' ); |
|
589 | + $current_time = current_time('timestamp'); |
|
590 | 590 | |
591 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
592 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
593 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
594 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
595 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
596 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
597 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
591 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
592 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
593 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
594 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
595 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
596 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
597 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
598 | 598 | |
599 | 599 | // Modify dates based on predefined ranges |
600 | - switch ( $dates['range'] ) : |
|
600 | + switch ($dates['range']) : |
|
601 | 601 | |
602 | 602 | case 'this_month' : |
603 | - $dates['m_start'] = date( 'n', $current_time ); |
|
604 | - $dates['m_end'] = date( 'n', $current_time ); |
|
603 | + $dates['m_start'] = date('n', $current_time); |
|
604 | + $dates['m_end'] = date('n', $current_time); |
|
605 | 605 | $dates['day'] = 1; |
606 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
607 | - $dates['year'] = date( 'Y' ); |
|
608 | - $dates['year_end'] = date( 'Y' ); |
|
606 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
607 | + $dates['year'] = date('Y'); |
|
608 | + $dates['year_end'] = date('Y'); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | case 'last_month' : |
612 | - if ( date( 'n' ) == 1 ) { |
|
612 | + if (date('n') == 1) { |
|
613 | 613 | $dates['m_start'] = 12; |
614 | 614 | $dates['m_end'] = 12; |
615 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
616 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
615 | + $dates['year'] = date('Y', $current_time) - 1; |
|
616 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
617 | 617 | } else { |
618 | - $dates['m_start'] = date( 'n' ) - 1; |
|
619 | - $dates['m_end'] = date( 'n' ) - 1; |
|
618 | + $dates['m_start'] = date('n') - 1; |
|
619 | + $dates['m_end'] = date('n') - 1; |
|
620 | 620 | $dates['year_end'] = $dates['year']; |
621 | 621 | } |
622 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
622 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
623 | 623 | break; |
624 | 624 | |
625 | 625 | case 'today' : |
626 | - $dates['day'] = date( 'd', $current_time ); |
|
627 | - $dates['m_start'] = date( 'n', $current_time ); |
|
628 | - $dates['m_end'] = date( 'n', $current_time ); |
|
629 | - $dates['year'] = date( 'Y', $current_time ); |
|
626 | + $dates['day'] = date('d', $current_time); |
|
627 | + $dates['m_start'] = date('n', $current_time); |
|
628 | + $dates['m_end'] = date('n', $current_time); |
|
629 | + $dates['year'] = date('Y', $current_time); |
|
630 | 630 | break; |
631 | 631 | |
632 | 632 | case 'yesterday' : |
633 | 633 | |
634 | - $year = date( 'Y', $current_time ); |
|
635 | - $month = date( 'n', $current_time ); |
|
636 | - $day = date( 'd', $current_time ); |
|
634 | + $year = date('Y', $current_time); |
|
635 | + $month = date('n', $current_time); |
|
636 | + $day = date('d', $current_time); |
|
637 | 637 | |
638 | - if ( $month == 1 && $day == 1 ) { |
|
638 | + if ($month == 1 && $day == 1) { |
|
639 | 639 | |
640 | 640 | $year -= 1; |
641 | 641 | $month = 12; |
642 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
642 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
643 | 643 | |
644 | - } elseif ( $month > 1 && $day == 1 ) { |
|
644 | + } elseif ($month > 1 && $day == 1) { |
|
645 | 645 | |
646 | 646 | $month -= 1; |
647 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
647 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
648 | 648 | |
649 | 649 | } else { |
650 | 650 | |
@@ -660,91 +660,91 @@ discard block |
||
660 | 660 | break; |
661 | 661 | |
662 | 662 | case 'this_week' : |
663 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
664 | - $dates['day'] += get_option( 'start_of_week' ); |
|
663 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
664 | + $dates['day'] += get_option('start_of_week'); |
|
665 | 665 | $dates['day_end'] = $dates['day'] + 6; |
666 | - $dates['m_start'] = date( 'n', $current_time ); |
|
667 | - $dates['m_end'] = date( 'n', $current_time ); |
|
668 | - $dates['year'] = date( 'Y', $current_time ); |
|
666 | + $dates['m_start'] = date('n', $current_time); |
|
667 | + $dates['m_end'] = date('n', $current_time); |
|
668 | + $dates['year'] = date('Y', $current_time); |
|
669 | 669 | break; |
670 | 670 | |
671 | 671 | case 'last_week' : |
672 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
673 | - $dates['day'] += get_option( 'start_of_week' ); |
|
672 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
673 | + $dates['day'] += get_option('start_of_week'); |
|
674 | 674 | $dates['day_end'] = $dates['day'] + 6; |
675 | - $dates['year'] = date( 'Y' ); |
|
676 | - |
|
677 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
678 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
679 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
680 | - if ( $dates['m_start'] <= 1 ) { |
|
681 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
682 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
675 | + $dates['year'] = date('Y'); |
|
676 | + |
|
677 | + if (date('j', $current_time) <= 7) { |
|
678 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
679 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
680 | + if ($dates['m_start'] <= 1) { |
|
681 | + $dates['year'] = date('Y', $current_time) - 1; |
|
682 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
683 | 683 | } |
684 | 684 | } else { |
685 | - $dates['m_start'] = date( 'n', $current_time ); |
|
686 | - $dates['m_end'] = date( 'n', $current_time ); |
|
685 | + $dates['m_start'] = date('n', $current_time); |
|
686 | + $dates['m_end'] = date('n', $current_time); |
|
687 | 687 | } |
688 | 688 | break; |
689 | 689 | |
690 | 690 | case 'this_quarter' : |
691 | - $month_now = date( 'n', $current_time ); |
|
691 | + $month_now = date('n', $current_time); |
|
692 | 692 | |
693 | - if ( $month_now <= 3 ) { |
|
693 | + if ($month_now <= 3) { |
|
694 | 694 | |
695 | 695 | $dates['m_start'] = 1; |
696 | 696 | $dates['m_end'] = 4; |
697 | - $dates['year'] = date( 'Y', $current_time ); |
|
697 | + $dates['year'] = date('Y', $current_time); |
|
698 | 698 | |
699 | - } else if ( $month_now <= 6 ) { |
|
699 | + } else if ($month_now <= 6) { |
|
700 | 700 | |
701 | 701 | $dates['m_start'] = 4; |
702 | 702 | $dates['m_end'] = 7; |
703 | - $dates['year'] = date( 'Y', $current_time ); |
|
703 | + $dates['year'] = date('Y', $current_time); |
|
704 | 704 | |
705 | - } else if ( $month_now <= 9 ) { |
|
705 | + } else if ($month_now <= 9) { |
|
706 | 706 | |
707 | 707 | $dates['m_start'] = 7; |
708 | 708 | $dates['m_end'] = 10; |
709 | - $dates['year'] = date( 'Y', $current_time ); |
|
709 | + $dates['year'] = date('Y', $current_time); |
|
710 | 710 | |
711 | 711 | } else { |
712 | 712 | |
713 | 713 | $dates['m_start'] = 10; |
714 | 714 | $dates['m_end'] = 1; |
715 | - $dates['year'] = date( 'Y', $current_time ); |
|
716 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
715 | + $dates['year'] = date('Y', $current_time); |
|
716 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | break; |
720 | 720 | |
721 | 721 | case 'last_quarter' : |
722 | - $month_now = date( 'n' ); |
|
722 | + $month_now = date('n'); |
|
723 | 723 | |
724 | - if ( $month_now <= 3 ) { |
|
724 | + if ($month_now <= 3) { |
|
725 | 725 | |
726 | 726 | $dates['m_start'] = 10; |
727 | 727 | $dates['m_end'] = 12; |
728 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
729 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
728 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
729 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
730 | 730 | |
731 | - } else if ( $month_now <= 6 ) { |
|
731 | + } else if ($month_now <= 6) { |
|
732 | 732 | |
733 | 733 | $dates['m_start'] = 1; |
734 | 734 | $dates['m_end'] = 3; |
735 | - $dates['year'] = date( 'Y', $current_time ); |
|
735 | + $dates['year'] = date('Y', $current_time); |
|
736 | 736 | |
737 | - } else if ( $month_now <= 9 ) { |
|
737 | + } else if ($month_now <= 9) { |
|
738 | 738 | |
739 | 739 | $dates['m_start'] = 4; |
740 | 740 | $dates['m_end'] = 6; |
741 | - $dates['year'] = date( 'Y', $current_time ); |
|
741 | + $dates['year'] = date('Y', $current_time); |
|
742 | 742 | |
743 | 743 | } else { |
744 | 744 | |
745 | 745 | $dates['m_start'] = 7; |
746 | 746 | $dates['m_end'] = 9; |
747 | - $dates['year'] = date( 'Y', $current_time ); |
|
747 | + $dates['year'] = date('Y', $current_time); |
|
748 | 748 | |
749 | 749 | } |
750 | 750 | break; |
@@ -752,19 +752,19 @@ discard block |
||
752 | 752 | case 'this_year' : |
753 | 753 | $dates['m_start'] = 1; |
754 | 754 | $dates['m_end'] = 12; |
755 | - $dates['year'] = date( 'Y', $current_time ); |
|
755 | + $dates['year'] = date('Y', $current_time); |
|
756 | 756 | break; |
757 | 757 | |
758 | 758 | case 'last_year' : |
759 | 759 | $dates['m_start'] = 1; |
760 | 760 | $dates['m_end'] = 12; |
761 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
762 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
761 | + $dates['year'] = date('Y', $current_time) - 1; |
|
762 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
763 | 763 | break; |
764 | 764 | |
765 | 765 | endswitch; |
766 | 766 | |
767 | - return apply_filters( 'give_report_dates', $dates ); |
|
767 | + return apply_filters('give_report_dates', $dates); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | /** |
@@ -774,17 +774,17 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @param $data |
776 | 776 | */ |
777 | -function give_parse_report_dates( $data ) { |
|
777 | +function give_parse_report_dates($data) { |
|
778 | 778 | $dates = give_get_report_dates(); |
779 | 779 | |
780 | 780 | $view = give_get_reporting_view(); |
781 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
781 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
782 | 782 | |
783 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr__( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
783 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr__($view).'&form-id='.absint($id)))); |
|
784 | 784 | give_die(); |
785 | 785 | } |
786 | 786 | |
787 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
787 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
@@ -794,16 +794,16 @@ discard block |
||
794 | 794 | */ |
795 | 795 | function give_reports_refresh_button() { |
796 | 796 | |
797 | - $url = wp_nonce_url( add_query_arg( array( |
|
797 | + $url = wp_nonce_url(add_query_arg(array( |
|
798 | 798 | 'give_action' => 'refresh_reports_transients', |
799 | 799 | 'give-message' => 'refreshed-reports' |
800 | - ) ), 'give-refresh-reports' ); |
|
800 | + )), 'give-refresh-reports'); |
|
801 | 801 | |
802 | - echo '<a href="' . $url . '" data-tooltip="' . esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . esc_html__( 'Refresh Reports', 'give' ) . '</a>'; |
|
802 | + echo '<a href="'.$url.'" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.esc_html__('Refresh Reports', 'give').'</a>'; |
|
803 | 803 | |
804 | 804 | } |
805 | 805 | |
806 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
806 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * Trigger the refresh of reports transients |
@@ -814,18 +814,18 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return void |
816 | 816 | */ |
817 | -function give_run_refresh_reports_transients( $data ) { |
|
817 | +function give_run_refresh_reports_transients($data) { |
|
818 | 818 | |
819 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
819 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
823 | 823 | //Delete transients |
824 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
825 | - delete_transient( 'give_earnings_total' ); |
|
826 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
827 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
824 | + delete_transient('give_estimated_monthly_stats'); |
|
825 | + delete_transient('give_earnings_total'); |
|
826 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
827 | + delete_transient(md5('give_earnings_todaytoday')); |
|
828 | 828 | |
829 | 829 | } |
830 | 830 | |
831 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
832 | 831 | \ No newline at end of file |
832 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
833 | 833 | \ No newline at end of file |
@@ -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 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr__( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr__($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr__( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr__($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ) |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give') |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Request Details', 'give' ); ?> "><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Request Details', 'give'); ?> "><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html__( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html__($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
184 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } else if ( is_email( $search ) ) { |
|
217 | + } else if (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | 'meta_query' => $this->get_meta_query() |
294 | 294 | ); |
295 | 295 | |
296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
297 | 297 | |
298 | - if ( $logs ) { |
|
299 | - foreach ( $logs as $log ) { |
|
298 | + if ($logs) { |
|
299 | + foreach ($logs as $log) { |
|
300 | 300 | |
301 | 301 | $logs_data[] = array( |
302 | 302 | 'ID' => $log->ID, |
303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
304 | 304 | 'date' => $log->post_date |
305 | 305 | ); |
306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $columns = $this->get_columns(); |
329 | 329 | $hidden = array(); // No hidden columns |
330 | 330 | $sortable = $this->get_sortable_columns(); |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | $this->items = $this->get_logs(); |
333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
334 | 334 | |
335 | - $this->set_pagination_args( array( |
|
335 | + $this->set_pagination_args(array( |
|
336 | 336 | 'total_items' => $total_items, |
337 | 337 | 'per_page' => $this->per_page, |
338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | 50 | 'ajax' => false // Does this table support ajax? |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,37 +64,37 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . get_the_title( $item[ $column_name ] ) . '</a>'; |
|
73 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.get_the_title($item[$column_name]).'</a>'; |
|
74 | 74 | |
75 | 75 | case 'user_id' : |
76 | - return '<a href="' . |
|
77 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
78 | - '">' . $item['user_name'] . '</a>'; |
|
76 | + return '<a href="'. |
|
77 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
78 | + '">'.$item['user_name'].'</a>'; |
|
79 | 79 | |
80 | 80 | case 'amount' : |
81 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
81 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
82 | 82 | |
83 | 83 | case 'status' : |
84 | 84 | |
85 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
85 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
86 | 86 | |
87 | - if ( $payment->mode == 'test' ) { |
|
88 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
87 | + if ($payment->mode == 'test') { |
|
88 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $value; |
92 | 92 | |
93 | 93 | case 'payment_id' : |
94 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
94 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
95 | 95 | |
96 | 96 | default: |
97 | - return $item[ $column_name ]; |
|
97 | + return $item[$column_name]; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function get_columns() { |
109 | 109 | $columns = array( |
110 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
111 | - 'user_id' => esc_html__( 'Donor', 'give' ), |
|
110 | + 'ID' => esc_html__('Log ID', 'give'), |
|
111 | + 'user_id' => esc_html__('Donor', 'give'), |
|
112 | 112 | 'form' => give_get_forms_label_singular(), |
113 | - 'amount' => esc_html__( 'Donation Amount', 'give' ), |
|
114 | - 'status' => esc_html__( 'Status', 'give' ), |
|
115 | - 'payment_id' => esc_html__( 'Transaction ID', 'give' ), |
|
116 | - 'date' => esc_html__( 'Date', 'give' ) |
|
113 | + 'amount' => esc_html__('Donation Amount', 'give'), |
|
114 | + 'status' => esc_html__('Status', 'give'), |
|
115 | + 'payment_id' => esc_html__('Transaction ID', 'give'), |
|
116 | + 'date' => esc_html__('Date', 'give') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | return $columns; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return int Current page number |
128 | 128 | */ |
129 | 129 | public function get_paged() { |
130 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
130 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return mixed int If User ID, string If Email/Login |
139 | 139 | */ |
140 | 140 | public function get_filtered_user() { |
141 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
141 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return int Download ID |
150 | 150 | */ |
151 | 151 | public function get_filtered_give_form() { |
152 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
152 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed string If search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
179 | + protected function display_tablenav($which) { |
|
180 | 180 | |
181 | - if ( 'top' === $which ) { |
|
182 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
181 | + if ('top' === $which) { |
|
182 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
183 | 183 | } |
184 | 184 | ?> |
185 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
185 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
186 | 186 | |
187 | 187 | <div class="alignleft actions bulkactions"> |
188 | - <?php $this->bulk_actions( $which ); ?> |
|
188 | + <?php $this->bulk_actions($which); ?> |
|
189 | 189 | </div> |
190 | 190 | <?php |
191 | - $this->extra_tablenav( $which ); |
|
192 | - $this->pagination( $which ); |
|
191 | + $this->extra_tablenav($which); |
|
192 | + $this->pagination($which); |
|
193 | 193 | ?> |
194 | 194 | |
195 | 195 | <br class="clear"/> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $meta_query = array(); |
214 | 214 | |
215 | - if ( $user ) { |
|
215 | + if ($user) { |
|
216 | 216 | // Show only logs from a specific user |
217 | 217 | $meta_query[] = array( |
218 | 218 | 'key' => '_give_log_user_id', |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | $search = $this->get_search(); |
224 | - if ( $search ) { |
|
225 | - if ( is_email( $search ) ) { |
|
224 | + if ($search) { |
|
225 | + if (is_email($search)) { |
|
226 | 226 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
227 | 227 | $key = '_give_log_user_info'; |
228 | 228 | $compare = 'LIKE'; |
@@ -231,32 +231,32 @@ discard block |
||
231 | 231 | $key = '_give_log_user_id'; |
232 | 232 | $compare = 'LIKE'; |
233 | 233 | |
234 | - if ( ! is_numeric( $search ) ) { |
|
234 | + if ( ! is_numeric($search)) { |
|
235 | 235 | // Searching for user by username |
236 | - $user = get_user_by( 'login', $search ); |
|
236 | + $user = get_user_by('login', $search); |
|
237 | 237 | |
238 | - if ( $user ) { |
|
238 | + if ($user) { |
|
239 | 239 | // Found one, set meta value to user's ID |
240 | 240 | $search = $user->ID; |
241 | 241 | } else { |
242 | 242 | // No user found so let's do a real search query |
243 | - $users = new WP_User_Query( array( |
|
243 | + $users = new WP_User_Query(array( |
|
244 | 244 | 'search' => $search, |
245 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
245 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
246 | 246 | 'number' => 1, |
247 | 247 | 'fields' => 'ids' |
248 | - ) ); |
|
248 | + )); |
|
249 | 249 | |
250 | 250 | $found_user = $users->get_results(); |
251 | 251 | |
252 | - if ( $found_user ) { |
|
252 | + if ($found_user) { |
|
253 | 253 | $search = $found_user[0]; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ( ! $this->file_search ) { |
|
259 | + if ( ! $this->file_search) { |
|
260 | 260 | // Meta query only works for non file name searche |
261 | 261 | $meta_query[] = array( |
262 | 262 | 'key' => $key, |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @since 1.0 |
278 | 278 | * @return void |
279 | 279 | */ |
280 | - function bulk_actions( $which = '' ) { |
|
280 | + function bulk_actions($which = '') { |
|
281 | 281 | give_log_views(); |
282 | 282 | } |
283 | 283 | |
@@ -289,22 +289,22 @@ discard block |
||
289 | 289 | * @return void |
290 | 290 | */ |
291 | 291 | public function give_forms_filter() { |
292 | - $give_forms = get_posts( array( |
|
292 | + $give_forms = get_posts(array( |
|
293 | 293 | 'post_type' => 'give_forms', |
294 | 294 | 'post_status' => 'any', |
295 | - 'posts_per_page' => - 1, |
|
295 | + 'posts_per_page' => -1, |
|
296 | 296 | 'orderby' => 'title', |
297 | 297 | 'order' => 'ASC', |
298 | 298 | 'fields' => 'ids', |
299 | 299 | 'update_post_meta_cache' => false, |
300 | 300 | 'update_post_term_cache' => false |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | |
303 | - if ( $give_forms ) { |
|
303 | + if ($give_forms) { |
|
304 | 304 | echo '<select name="form" id="give-log-form-filter">'; |
305 | - echo '<option value="0">' . esc_html__( 'All', 'give' ) . '</option>'; |
|
306 | - foreach ( $give_forms as $form ) { |
|
307 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html__( get_the_title( $form ) ) . '</option>'; |
|
305 | + echo '<option value="0">'.esc_html__('All', 'give').'</option>'; |
|
306 | + foreach ($give_forms as $form) { |
|
307 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html__(get_the_title($form)).'</option>'; |
|
308 | 308 | } |
309 | 309 | echo '</select>'; |
310 | 310 | } |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | global $give_logs; |
323 | 323 | |
324 | 324 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
325 | - wp_suspend_cache_addition( true ); |
|
325 | + wp_suspend_cache_addition(true); |
|
326 | 326 | |
327 | 327 | $logs_data = array(); |
328 | 328 | $paged = $this->get_paged(); |
329 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
329 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
330 | 330 | $user = $this->get_filtered_user(); |
331 | 331 | |
332 | 332 | $log_query = array( |
@@ -336,26 +336,26 @@ discard block |
||
336 | 336 | 'meta_query' => $this->get_meta_query() |
337 | 337 | ); |
338 | 338 | |
339 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
339 | + $logs = $give_logs->get_connected_logs($log_query); |
|
340 | 340 | |
341 | - if ( $logs ) { |
|
342 | - foreach ( $logs as $log ) { |
|
343 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
341 | + if ($logs) { |
|
342 | + foreach ($logs as $log) { |
|
343 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
344 | 344 | |
345 | 345 | // Make sure this payment hasn't been deleted |
346 | - if ( get_post( $payment_id ) ) : |
|
347 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
348 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
349 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
346 | + if (get_post($payment_id)) : |
|
347 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
348 | + $payment_meta = give_get_payment_meta($payment_id); |
|
349 | + $payment_amount = give_get_payment_amount($payment_id); |
|
350 | 350 | |
351 | 351 | $logs_data[] = array( |
352 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
352 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
353 | 353 | 'payment_id' => $payment_id, |
354 | 354 | 'form' => $log->post_parent, |
355 | 355 | 'amount' => $payment_amount, |
356 | 356 | 'user_id' => $user_info['id'], |
357 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
358 | - 'date' => get_post_field( 'post_date', $payment_id ) |
|
357 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
358 | + 'date' => get_post_field('post_date', $payment_id) |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | endif; |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | $columns = $this->get_columns(); |
385 | 385 | $hidden = array(); |
386 | 386 | $sortable = $this->get_sortable_columns(); |
387 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
387 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
388 | 388 | $current_page = $this->get_pagenum(); |
389 | 389 | $this->items = $this->get_logs(); |
390 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
390 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
391 | 391 | |
392 | - $this->set_pagination_args( array( |
|
392 | + $this->set_pagination_args(array( |
|
393 | 393 | 'total_items' => $total_items, |
394 | 394 | 'per_page' => $this->per_page, |
395 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
395 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
396 | 396 | ) |
397 | 397 | ); |
398 | 398 | } |
@@ -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 | |
@@ -22,80 +22,80 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - do_action( 'give_tools_recount_stats_before' ); |
|
29 | + do_action('give_tools_recount_stats_before'); |
|
30 | 30 | ?> |
31 | 31 | <div id="poststuff"> |
32 | 32 | <div class="postbox"> |
33 | 33 | |
34 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
34 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
35 | 35 | |
36 | 36 | <div class="inside recount-stats-controls"> |
37 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
37 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
38 | 38 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
39 | 39 | |
40 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
40 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
41 | 41 | |
42 | 42 | <select name="give-export-class" id="recount-stats-type"> |
43 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
44 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
45 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
46 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
47 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
48 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
49 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
50 | - <?php do_action( 'give_recount_tool_options' ); ?> |
|
43 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
44 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
45 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
46 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
47 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
48 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
49 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
50 | + <?php do_action('give_recount_tool_options'); ?> |
|
51 | 51 | </select> |
52 | 52 | |
53 | 53 | <span id="tools-form-dropdown" style="display: none"> |
54 | 54 | <?php |
55 | 55 | $args = array( |
56 | 56 | 'name' => 'form_id', |
57 | - 'number' => - 1, |
|
57 | + 'number' => -1, |
|
58 | 58 | 'chosen' => true, |
59 | 59 | ); |
60 | - echo Give()->html->forms_dropdown( $args ); |
|
60 | + echo Give()->html->forms_dropdown($args); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | |
64 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
64 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
65 | 65 | |
66 | 66 | <br/> |
67 | 67 | |
68 | 68 | <span class="give-recount-stats-descriptions"> |
69 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
70 | 70 | <span id="recount-form"><?php |
71 | 71 | printf( |
72 | 72 | /* translators: %s: form singular label */ |
73 | - esc_html__( 'Recalculates the donation and income stats for a specific %s.', 'give' ), |
|
74 | - give_get_forms_label_singular( true ) |
|
73 | + esc_html__('Recalculates the donation and income stats for a specific %s.', 'give'), |
|
74 | + give_get_forms_label_singular(true) |
|
75 | 75 | ); |
76 | 76 | ?></span> |
77 | 77 | <span id="recount-all"><?php |
78 | 78 | printf( |
79 | 79 | /* translators: %s: form plural label */ |
80 | - esc_html__( 'Recalculates the earnings and sales stats for all %s.', 'give' ), |
|
81 | - give_get_forms_label_plural( true ) |
|
80 | + esc_html__('Recalculates the earnings and sales stats for all %s.', 'give'), |
|
81 | + give_get_forms_label_plural(true) |
|
82 | 82 | ); |
83 | 83 | ?></span> |
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
85 | - <?php do_action( 'give_recount_tool_descriptions' ); ?> |
|
86 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span> |
|
87 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | + <?php do_action('give_recount_tool_descriptions'); ?> |
|
86 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span> |
|
87 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
88 | 88 | </span> |
89 | 89 | |
90 | 90 | <span class="spinner"></span> |
91 | 91 | |
92 | 92 | </form> |
93 | - <?php do_action( 'give_tools_recount_forms' ); ?> |
|
93 | + <?php do_action('give_tools_recount_forms'); ?> |
|
94 | 94 | </div><!-- .inside --> |
95 | 95 | </div><!-- .postbox --> |
96 | 96 | </div><!-- #poststuff --> |
97 | 97 | <?php |
98 | - do_action( 'give_tools_recount_stats_after' ); |
|
98 | + do_action('give_tools_recount_stats_after'); |
|
99 | 99 | } |
100 | 100 | |
101 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
101 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -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 Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
115 | 115 | give_report_views(); |
116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $which |
125 | 125 | */ |
126 | - protected function display_tablenav( $which ) { |
|
126 | + protected function display_tablenav($which) { |
|
127 | 127 | |
128 | - if ( 'top' == $which ) { |
|
129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
128 | + if ('top' == $which) { |
|
129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
133 | 133 | |
134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3> |
|
135 | 135 | |
136 | 136 | <div class="alignright tablenav-right"> |
137 | 137 | <div class="actions bulkactions"> |
138 | - <?php $this->bulk_actions( $which ); ?> |
|
138 | + <?php $this->bulk_actions($which); ?> |
|
139 | 139 | </div> |
140 | 140 | <?php |
141 | - $this->extra_tablenav( $which ); |
|
142 | - $this->pagination( $which ); |
|
141 | + $this->extra_tablenav($which); |
|
142 | + $this->pagination($which); |
|
143 | 143 | ?> |
144 | 144 | </div> |
145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $gateways = give_get_payment_gateways(); |
165 | 165 | $stats = new Give_Payment_Stats(); |
166 | 166 | |
167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
168 | 168 | |
169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
171 | 171 | |
172 | 172 | $reports_data[] = array( |
173 | 173 | 'ID' => $gateway_id, |
174 | 174 | 'label' => $gateway['admin_label'], |
175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $columns = $this->get_columns(); |
198 | 198 | $hidden = array(); // No hidden columns |
199 | 199 | $sortable = $this->get_sortable_columns(); |
200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
201 | 201 | $this->items = $this->reports_data(); |
202 | 202 | |
203 | 203 | } |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __construct() { |
51 | 51 | |
52 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
52 | + add_action('admin_init', array($this, 'init')); |
|
53 | 53 | |
54 | 54 | //Customize CMB2 URL |
55 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
55 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
56 | 56 | |
57 | 57 | //Custom CMB2 Settings Fields |
58 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
59 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
60 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
61 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
62 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
63 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
64 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
65 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
66 | - add_action( 'admin_notices', array( $this, 'settings_notices' ) ); |
|
58 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
59 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
60 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
61 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
62 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
63 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
64 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
65 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
66 | + add_action('admin_notices', array($this, 'settings_notices')); |
|
67 | 67 | |
68 | 68 | // Include CMB CSS in the head to avoid FOUC |
69 | - add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
69 | + add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css')); |
|
70 | 70 | |
71 | - add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 ); |
|
71 | + add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @since 1.0 |
79 | 79 | */ |
80 | 80 | public function init() { |
81 | - register_setting( $this->key, $this->key ); |
|
81 | + register_setting($this->key, $this->key); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return mixed |
94 | 94 | */ |
95 | - public function give_update_cmb_meta_box_url( $url ) { |
|
95 | + public function give_update_cmb_meta_box_url($url) { |
|
96 | 96 | //Path to Give's CMB |
97 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
97 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function give_get_settings_tabs() { |
108 | 108 | |
109 | - $settings = $this->give_settings( null ); |
|
109 | + $settings = $this->give_settings(null); |
|
110 | 110 | |
111 | 111 | $tabs = array(); |
112 | - $tabs['general'] = esc_html__( 'General', 'give' ); |
|
113 | - $tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' ); |
|
114 | - $tabs['display'] = esc_html__( 'Display Options', 'give' ); |
|
115 | - $tabs['emails'] = esc_html__( 'Emails', 'give' ); |
|
112 | + $tabs['general'] = esc_html__('General', 'give'); |
|
113 | + $tabs['gateways'] = esc_html__('Payment Gateways', 'give'); |
|
114 | + $tabs['display'] = esc_html__('Display Options', 'give'); |
|
115 | + $tabs['emails'] = esc_html__('Emails', 'give'); |
|
116 | 116 | |
117 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
118 | - $tabs['addons'] = esc_html__( 'Add-ons', 'give' ); |
|
117 | + if ( ! empty($settings['addons']['fields'])) { |
|
118 | + $tabs['addons'] = esc_html__('Add-ons', 'give'); |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
122 | - $tabs['licenses'] = esc_html__( 'Licenses', 'give' ); |
|
121 | + if ( ! empty($settings['licenses']['fields'])) { |
|
122 | + $tabs['licenses'] = esc_html__('Licenses', 'give'); |
|
123 | 123 | } |
124 | 124 | |
125 | - $tabs['advanced'] = esc_html__( 'Advanced', 'give' ); |
|
126 | - $tabs['api'] = esc_html__( 'API', 'give' ); |
|
127 | - $tabs['system_info'] = esc_html__( 'System Info', 'give' ); |
|
125 | + $tabs['advanced'] = esc_html__('Advanced', 'give'); |
|
126 | + $tabs['api'] = esc_html__('API', 'give'); |
|
127 | + $tabs['system_info'] = esc_html__('System Info', 'give'); |
|
128 | 128 | |
129 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
129 | + return apply_filters('give_settings_tabs', $tabs); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function admin_page_display() { |
138 | 138 | |
139 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
139 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
140 | 140 | |
141 | 141 | ?> |
142 | 142 | |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | |
145 | 145 | <h1 class="nav-tab-wrapper"> |
146 | 146 | <?php |
147 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
147 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
148 | 148 | |
149 | 149 | //Support legacy tab creation conditions based off $_GET parameter |
150 | 150 | //We pass the $_GET['tab'] to conditions executed later |
151 | 151 | $_GET['tab'] = $tab_id; |
152 | 152 | |
153 | - $tab_url = esc_url( add_query_arg( array( |
|
153 | + $tab_url = esc_url(add_query_arg(array( |
|
154 | 154 | 'settings-updated' => false, |
155 | 155 | 'tab' => $tab_id |
156 | - ) ) ); |
|
156 | + ))); |
|
157 | 157 | |
158 | - $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
|
158 | + $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
|
159 | 159 | |
160 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr__( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html__( $tab_name ) . '</a>'; |
|
160 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr__($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html__($tab_name).'</a>'; |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | ?> |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | |
166 | 166 | <?php |
167 | 167 | //Loop through and output settings |
168 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
168 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
169 | 169 | |
170 | 170 | //Support legacy tab creation conditions based off $_GET parameter |
171 | 171 | //We 'trick' the conditions into thinking this is the tab |
172 | 172 | $_GET['tab'] = $tab_id; |
173 | 173 | |
174 | - $tab_settings = $this->give_settings( $tab_id ); |
|
174 | + $tab_settings = $this->give_settings($tab_id); |
|
175 | 175 | |
176 | 176 | //Pass active tab within $tab_settings so we can hide with CSS via PHP |
177 | - if ( $active_tab == $tab_id ) { |
|
177 | + if ($active_tab == $tab_id) { |
|
178 | 178 | $tab_settings['active_tab'] = true; |
179 | 179 | } |
180 | 180 | |
181 | - cmb2_metabox_form( $tab_settings, $this->key ); |
|
181 | + cmb2_metabox_form($tab_settings, $this->key); |
|
182 | 182 | |
183 | 183 | } ?> |
184 | 184 | |
@@ -196,34 +196,34 @@ discard block |
||
196 | 196 | * @since 1.5 Modified to CSS hide non-active tabs |
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
199 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
200 | 200 | |
201 | 201 | |
202 | - $pagenow = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
202 | + $pagenow = isset($_GET['page']) ? $_GET['page'] : ''; |
|
203 | 203 | |
204 | 204 | //only modify the give settings form |
205 | - if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) { |
|
205 | + if ('give_settings' == $object_id && $pagenow == 'give-settings') { |
|
206 | 206 | |
207 | 207 | $style = ''; |
208 | - if ( ! isset( $cmb->meta_box['active_tab'] ) ) { |
|
208 | + if ( ! isset($cmb->meta_box['active_tab'])) { |
|
209 | 209 | $style = 'style="display:none;"'; |
210 | 210 | } |
211 | 211 | |
212 | 212 | //Set ID based off tab name - protects backwards compatibility |
213 | - $tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id']; |
|
213 | + $tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id']; |
|
214 | 214 | |
215 | - $save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div>' ); |
|
215 | + $save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div>'); |
|
216 | 216 | |
217 | 217 | //Filter so some tabs won't have save settings |
218 | - $no_save_button = apply_filters( 'give_settings_no_save_output', array( |
|
218 | + $no_save_button = apply_filters('give_settings_no_save_output', array( |
|
219 | 219 | 'system_info' |
220 | - ) ); |
|
220 | + )); |
|
221 | 221 | |
222 | - if ( in_array( $tab_id, $no_save_button ) ) { |
|
222 | + if (in_array($tab_id, $no_save_button)) { |
|
223 | 223 | $save_button = ''; |
224 | 224 | } |
225 | 225 | |
226 | - $form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>'; |
|
226 | + $form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>'; |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return array |
242 | 242 | */ |
243 | - public function give_settings( $active_tab ) { |
|
243 | + public function give_settings($active_tab) { |
|
244 | 244 | |
245 | 245 | $give_settings = array( |
246 | 246 | /** |
@@ -248,62 +248,62 @@ discard block |
||
248 | 248 | */ |
249 | 249 | 'general' => array( |
250 | 250 | 'id' => 'general_settings', |
251 | - 'give_title' => esc_html__( 'General Settings', 'give' ), |
|
252 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
253 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
251 | + 'give_title' => esc_html__('General Settings', 'give'), |
|
252 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
253 | + 'fields' => apply_filters('give_settings_general', array( |
|
254 | 254 | array( |
255 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
255 | + 'name' => esc_html__('General Settings', 'give'), |
|
256 | 256 | 'desc' => '', |
257 | 257 | 'type' => 'give_title', |
258 | 258 | 'id' => 'give_title_general_settings_1' |
259 | 259 | ), |
260 | 260 | array( |
261 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
261 | + 'name' => esc_html__('Success Page', 'give'), |
|
262 | 262 | /* translators: %s: [give_receipt] */ |
263 | - 'desc' => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
263 | + 'desc' => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
264 | 264 | 'id' => 'success_page', |
265 | 265 | 'type' => 'select', |
266 | - 'options' => give_cmb2_get_post_options( array( |
|
266 | + 'options' => give_cmb2_get_post_options(array( |
|
267 | 267 | 'post_type' => 'page', |
268 | - 'numberposts' => - 1 |
|
269 | - ) ), |
|
268 | + 'numberposts' => -1 |
|
269 | + )), |
|
270 | 270 | ), |
271 | 271 | array( |
272 | - 'name' => esc_html__( 'Failed Transaction Page', 'give' ), |
|
273 | - 'desc' => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
272 | + 'name' => esc_html__('Failed Transaction Page', 'give'), |
|
273 | + 'desc' => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
274 | 274 | 'id' => 'failure_page', |
275 | 275 | 'type' => 'select', |
276 | - 'options' => give_cmb2_get_post_options( array( |
|
276 | + 'options' => give_cmb2_get_post_options(array( |
|
277 | 277 | 'post_type' => 'page', |
278 | - 'numberposts' => - 1 |
|
279 | - ) ), |
|
278 | + 'numberposts' => -1 |
|
279 | + )), |
|
280 | 280 | ), |
281 | 281 | array( |
282 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
282 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
283 | 283 | /* translators: %s: [donation_history] */ |
284 | - 'desc' => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
284 | + 'desc' => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
285 | 285 | 'id' => 'history_page', |
286 | 286 | 'type' => 'select', |
287 | - 'options' => give_cmb2_get_post_options( array( |
|
287 | + 'options' => give_cmb2_get_post_options(array( |
|
288 | 288 | 'post_type' => 'page', |
289 | - 'numberposts' => - 1 |
|
290 | - ) ), |
|
289 | + 'numberposts' => -1 |
|
290 | + )), |
|
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
294 | - 'desc' => esc_html__( 'Where does your site operate from?', 'give' ), |
|
293 | + 'name' => esc_html__('Base Country', 'give'), |
|
294 | + 'desc' => esc_html__('Where does your site operate from?', 'give'), |
|
295 | 295 | 'id' => 'base_country', |
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => give_get_country_list(), |
298 | 298 | ), |
299 | 299 | array( |
300 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
300 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
301 | 301 | 'desc' => '', |
302 | 302 | 'type' => 'give_title', |
303 | 303 | 'id' => 'give_title_general_settings_2' |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
306 | + 'name' => esc_html__('Currency', 'give'), |
|
307 | 307 | 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', |
308 | 308 | 'id' => 'currency', |
309 | 309 | 'type' => 'select', |
@@ -311,28 +311,28 @@ discard block |
||
311 | 311 | 'default' => 'USD', |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
314 | + 'name' => esc_html__('Currency Position', 'give'), |
|
315 | 315 | 'desc' => 'Choose the position of the currency sign.', |
316 | 316 | 'id' => 'currency_position', |
317 | 317 | 'type' => 'select', |
318 | 318 | 'options' => array( |
319 | 319 | /* translators: %s: currency symbol */ |
320 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
320 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
321 | 321 | /* translators: %s: currency symbol */ |
322 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
322 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
323 | 323 | ), |
324 | 324 | 'default' => 'before', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
328 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
327 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
328 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
329 | 329 | 'id' => 'thousands_separator', |
330 | 330 | 'type' => 'text_small', |
331 | 331 | 'default' => ',', |
332 | 332 | ), |
333 | 333 | array( |
334 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
335 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
334 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
335 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
336 | 336 | 'id' => 'decimal_separator', |
337 | 337 | 'type' => 'text_small', |
338 | 338 | 'default' => '.', |
@@ -345,83 +345,83 @@ discard block |
||
345 | 345 | */ |
346 | 346 | 'gateways' => array( |
347 | 347 | 'id' => 'payment_gateways', |
348 | - 'give_title' => esc_html__( 'Payment Gateways', 'give' ), |
|
349 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
350 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
348 | + 'give_title' => esc_html__('Payment Gateways', 'give'), |
|
349 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
350 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
351 | 351 | array( |
352 | - 'name' => esc_html__( 'Gateways Settings', 'give' ), |
|
352 | + 'name' => esc_html__('Gateways Settings', 'give'), |
|
353 | 353 | 'desc' => '', |
354 | 354 | 'id' => 'give_title_gateway_settings_1', |
355 | 355 | 'type' => 'give_title' |
356 | 356 | ), |
357 | 357 | array( |
358 | - 'name' => esc_html__( 'Test Mode', 'give' ), |
|
359 | - 'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
358 | + 'name' => esc_html__('Test Mode', 'give'), |
|
359 | + 'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
360 | 360 | 'id' => 'test_mode', |
361 | 361 | 'type' => 'checkbox' |
362 | 362 | ), |
363 | 363 | array( |
364 | - 'name' => esc_html__( 'Enabled Gateways', 'give' ), |
|
365 | - 'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ), |
|
364 | + 'name' => esc_html__('Enabled Gateways', 'give'), |
|
365 | + 'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'), |
|
366 | 366 | 'id' => 'gateways', |
367 | 367 | 'type' => 'enabled_gateways' |
368 | 368 | ), |
369 | 369 | array( |
370 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
371 | - 'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ), |
|
370 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
371 | + 'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'), |
|
372 | 372 | 'id' => 'default_gateway', |
373 | 373 | 'type' => 'default_gateway' |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => esc_html__( 'PayPal Standard', 'give' ), |
|
376 | + 'name' => esc_html__('PayPal Standard', 'give'), |
|
377 | 377 | 'desc' => '', |
378 | 378 | 'type' => 'give_title', |
379 | 379 | 'id' => 'give_title_gateway_settings_2', |
380 | 380 | ), |
381 | 381 | array( |
382 | - 'name' => esc_html__( 'PayPal Email', 'give' ), |
|
383 | - 'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ), |
|
382 | + 'name' => esc_html__('PayPal Email', 'give'), |
|
383 | + 'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'), |
|
384 | 384 | 'id' => 'paypal_email', |
385 | 385 | 'type' => 'text_email', |
386 | 386 | ), |
387 | 387 | array( |
388 | - 'name' => esc_html__( 'PayPal Page Style', 'give' ), |
|
389 | - 'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
388 | + 'name' => esc_html__('PayPal Page Style', 'give'), |
|
389 | + 'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
390 | 390 | 'id' => 'paypal_page_style', |
391 | 391 | 'type' => 'text', |
392 | 392 | ), |
393 | 393 | array( |
394 | - 'name' => esc_html__( 'PayPal Transaction Type', 'give' ), |
|
395 | - 'desc' => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
394 | + 'name' => esc_html__('PayPal Transaction Type', 'give'), |
|
395 | + 'desc' => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
396 | 396 | 'id' => 'paypal_button_type', |
397 | 397 | 'type' => 'radio_inline', |
398 | 398 | 'options' => array( |
399 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
400 | - 'standard' => esc_html__( 'Standard Transaction', 'give' ) |
|
399 | + 'donation' => esc_html__('Donation', 'give'), |
|
400 | + 'standard' => esc_html__('Standard Transaction', 'give') |
|
401 | 401 | ), |
402 | 402 | 'default' => 'donation', |
403 | 403 | ), |
404 | 404 | array( |
405 | - 'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ), |
|
406 | - 'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
405 | + 'name' => esc_html__('Disable PayPal IPN Verification', 'give'), |
|
406 | + 'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
407 | 407 | 'id' => 'disable_paypal_verification', |
408 | 408 | 'type' => 'checkbox' |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'name' => esc_html__( 'Offline Donations', 'give' ), |
|
411 | + 'name' => esc_html__('Offline Donations', 'give'), |
|
412 | 412 | 'desc' => '', |
413 | 413 | 'type' => 'give_title', |
414 | 414 | 'id' => 'give_title_gateway_settings_3', |
415 | 415 | ), |
416 | 416 | array( |
417 | - 'name' => esc_html__( 'Collect Billing Details', 'give' ), |
|
418 | - 'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
417 | + 'name' => esc_html__('Collect Billing Details', 'give'), |
|
418 | + 'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
419 | 419 | 'id' => 'give_offline_donation_enable_billing_fields', |
420 | 420 | 'type' => 'checkbox' |
421 | 421 | ), |
422 | 422 | array( |
423 | - 'name' => esc_html__( 'Offline Donation Instructions', 'give' ), |
|
424 | - 'desc' => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
423 | + 'name' => esc_html__('Offline Donation Instructions', 'give'), |
|
424 | + 'desc' => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
425 | 425 | 'id' => 'global_offline_donation_content', |
426 | 426 | 'default' => give_get_default_offline_donation_content(), |
427 | 427 | 'type' => 'wysiwyg', |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | ) |
431 | 431 | ), |
432 | 432 | array( |
433 | - 'name' => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
434 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
433 | + 'name' => esc_html__('Offline Donation Email Instructions Subject', 'give'), |
|
434 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
435 | 435 | 'id' => 'offline_donation_subject', |
436 | - 'default' => esc_html__( '{donation} - Offline Donation Instructions', 'give' ), |
|
436 | + 'default' => esc_html__('{donation} - Offline Donation Instructions', 'give'), |
|
437 | 437 | 'type' => 'text' |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => esc_html__( 'Offline Donation Email Instructions', 'give' ), |
|
441 | - 'desc' => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
440 | + 'name' => esc_html__('Offline Donation Email Instructions', 'give'), |
|
441 | + 'desc' => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
442 | 442 | 'id' => 'global_offline_donation_email', |
443 | 443 | 'default' => give_get_default_offline_donation_email_content(), |
444 | 444 | 'type' => 'wysiwyg', |
@@ -452,95 +452,95 @@ discard block |
||
452 | 452 | /** Display Settings */ |
453 | 453 | 'display' => array( |
454 | 454 | 'id' => 'display_settings', |
455 | - 'give_title' => esc_html__( 'Display Settings', 'give' ), |
|
456 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
457 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
455 | + 'give_title' => esc_html__('Display Settings', 'give'), |
|
456 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
457 | + 'fields' => apply_filters('give_settings_display', array( |
|
458 | 458 | array( |
459 | - 'name' => esc_html__( 'Display Settings', 'give' ), |
|
459 | + 'name' => esc_html__('Display Settings', 'give'), |
|
460 | 460 | 'desc' => '', |
461 | 461 | 'id' => 'give_title_display_settings_1', |
462 | 462 | 'type' => 'give_title' |
463 | 463 | ), |
464 | 464 | array( |
465 | - 'name' => esc_html__( 'Disable CSS', 'give' ), |
|
466 | - 'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
465 | + 'name' => esc_html__('Disable CSS', 'give'), |
|
466 | + 'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
467 | 467 | 'id' => 'disable_css', |
468 | 468 | 'type' => 'checkbox' |
469 | 469 | ), |
470 | 470 | array( |
471 | - 'name' => esc_html__( 'Enable Floating Labels', 'give' ), |
|
471 | + 'name' => esc_html__('Enable Floating Labels', 'give'), |
|
472 | 472 | /* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */ |
473 | - 'desc' => sprintf( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' ) ), |
|
473 | + 'desc' => sprintf(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://bradfrost.com/blog/post/float-label-pattern/')), |
|
474 | 474 | 'id' => 'enable_floatlabels', |
475 | 475 | 'type' => 'checkbox' |
476 | 476 | ), |
477 | 477 | array( |
478 | - 'name' => esc_html__( 'Disable Welcome Screen', 'give' ), |
|
478 | + 'name' => esc_html__('Disable Welcome Screen', 'give'), |
|
479 | 479 | /* translators: %s: about page URL */ |
480 | - 'desc' => sprintf( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
480 | + 'desc' => sprintf(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))), |
|
481 | 481 | 'id' => 'disable_welcome', |
482 | 482 | 'type' => 'checkbox' |
483 | 483 | ), |
484 | 484 | array( |
485 | - 'name' => esc_html__( 'Post Types', 'give' ), |
|
485 | + 'name' => esc_html__('Post Types', 'give'), |
|
486 | 486 | 'desc' => '', |
487 | 487 | 'id' => 'give_title_display_settings_2', |
488 | 488 | 'type' => 'give_title' |
489 | 489 | ), |
490 | 490 | array( |
491 | - 'name' => esc_html__( 'Disable Form Single Views', 'give' ), |
|
492 | - 'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
491 | + 'name' => esc_html__('Disable Form Single Views', 'give'), |
|
492 | + 'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
493 | 493 | 'id' => 'disable_forms_singular', |
494 | 494 | 'type' => 'checkbox' |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'name' => esc_html__( 'Disable Form Archives', 'give' ), |
|
498 | - 'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
497 | + 'name' => esc_html__('Disable Form Archives', 'give'), |
|
498 | + 'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
499 | 499 | 'id' => 'disable_forms_archives', |
500 | 500 | 'type' => 'checkbox' |
501 | 501 | ), |
502 | 502 | array( |
503 | - 'name' => esc_html__( 'Disable Form Excerpts', 'give' ), |
|
504 | - 'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
503 | + 'name' => esc_html__('Disable Form Excerpts', 'give'), |
|
504 | + 'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
505 | 505 | 'id' => 'disable_forms_excerpt', |
506 | 506 | 'type' => 'checkbox' |
507 | 507 | ), |
508 | 508 | |
509 | 509 | array( |
510 | - 'name' => esc_html__( 'Featured Image Size', 'give' ), |
|
511 | - 'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ), |
|
510 | + 'name' => esc_html__('Featured Image Size', 'give'), |
|
511 | + 'desc' => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'), |
|
512 | 512 | 'id' => 'featured_image_size', |
513 | 513 | 'type' => 'select', |
514 | 514 | 'default' => 'large', |
515 | 515 | 'options' => give_get_featured_image_sizes() |
516 | 516 | ), |
517 | 517 | array( |
518 | - 'name' => esc_html__( 'Disable Form Featured Image', 'give' ), |
|
519 | - 'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
518 | + 'name' => esc_html__('Disable Form Featured Image', 'give'), |
|
519 | + 'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
520 | 520 | 'id' => 'disable_form_featured_img', |
521 | 521 | 'type' => 'checkbox' |
522 | 522 | ), |
523 | 523 | array( |
524 | - 'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ), |
|
525 | - 'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
524 | + 'name' => esc_html__('Disable Single Form Sidebar', 'give'), |
|
525 | + 'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
526 | 526 | 'id' => 'disable_form_sidebar', |
527 | 527 | 'type' => 'checkbox' |
528 | 528 | ), |
529 | 529 | array( |
530 | - 'name' => esc_html__( 'Taxonomies', 'give' ), |
|
530 | + 'name' => esc_html__('Taxonomies', 'give'), |
|
531 | 531 | 'desc' => '', |
532 | 532 | 'id' => 'give_title_display_settings_3', |
533 | 533 | 'type' => 'give_title' |
534 | 534 | ), |
535 | 535 | array( |
536 | - 'name' => esc_html__( 'Enable Form Categories', 'give' ), |
|
537 | - 'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
536 | + 'name' => esc_html__('Enable Form Categories', 'give'), |
|
537 | + 'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
538 | 538 | 'id' => 'enable_categories', |
539 | 539 | 'type' => 'checkbox' |
540 | 540 | ), |
541 | 541 | array( |
542 | - 'name' => esc_html__( 'Enable Form Tags', 'give' ), |
|
543 | - 'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
542 | + 'name' => esc_html__('Enable Form Tags', 'give'), |
|
543 | + 'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
544 | 544 | 'id' => 'enable_tags', |
545 | 545 | 'type' => 'checkbox' |
546 | 546 | ), |
@@ -553,95 +553,95 @@ discard block |
||
553 | 553 | */ |
554 | 554 | 'emails' => array( |
555 | 555 | 'id' => 'email_settings', |
556 | - 'give_title' => esc_html__( 'Email Settings', 'give' ), |
|
557 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
558 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
556 | + 'give_title' => esc_html__('Email Settings', 'give'), |
|
557 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
558 | + 'fields' => apply_filters('give_settings_emails', array( |
|
559 | 559 | array( |
560 | - 'name' => esc_html__( 'Email Settings', 'give' ), |
|
560 | + 'name' => esc_html__('Email Settings', 'give'), |
|
561 | 561 | 'desc' => '', |
562 | 562 | 'id' => 'give_title_email_settings_1', |
563 | 563 | 'type' => 'give_title' |
564 | 564 | ), |
565 | 565 | array( |
566 | 566 | 'id' => 'email_template', |
567 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
568 | - 'desc' => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
567 | + 'name' => esc_html__('Email Template', 'give'), |
|
568 | + 'desc' => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
569 | 569 | 'type' => 'select', |
570 | 570 | 'options' => give_get_email_templates() |
571 | 571 | ), |
572 | 572 | array( |
573 | 573 | 'id' => 'email_logo', |
574 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
575 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
574 | + 'name' => esc_html__('Logo', 'give'), |
|
575 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
576 | 576 | 'type' => 'file' |
577 | 577 | ), |
578 | 578 | array( |
579 | 579 | 'id' => 'from_name', |
580 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
581 | - 'desc' => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ), |
|
582 | - 'default' => get_bloginfo( 'name' ), |
|
580 | + 'name' => esc_html__('From Name', 'give'), |
|
581 | + 'desc' => esc_html__('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), |
|
582 | + 'default' => get_bloginfo('name'), |
|
583 | 583 | 'type' => 'text' |
584 | 584 | ), |
585 | 585 | array( |
586 | 586 | 'id' => 'from_email', |
587 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
588 | - 'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
589 | - 'default' => get_bloginfo( 'admin_email' ), |
|
587 | + 'name' => esc_html__('From Email', 'give'), |
|
588 | + 'desc' => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
589 | + 'default' => get_bloginfo('admin_email'), |
|
590 | 590 | 'type' => 'text' |
591 | 591 | ), |
592 | 592 | array( |
593 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
593 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
594 | 594 | 'desc' => '', |
595 | 595 | 'id' => 'give_title_email_settings_2', |
596 | 596 | 'type' => 'give_title' |
597 | 597 | ), |
598 | 598 | array( |
599 | 599 | 'id' => 'donation_subject', |
600 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
601 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
602 | - 'default' => esc_html__( 'Donation Receipt', 'give' ), |
|
600 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
601 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
602 | + 'default' => esc_html__('Donation Receipt', 'give'), |
|
603 | 603 | 'type' => 'text' |
604 | 604 | ), |
605 | 605 | array( |
606 | 606 | 'id' => 'donation_receipt', |
607 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
607 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
608 | 608 | /* translators: %s: emails tags list */ |
609 | - 'desc' => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>', |
|
609 | + 'desc' => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>', |
|
610 | 610 | 'type' => 'wysiwyg', |
611 | 611 | 'default' => give_get_default_donation_receipt_email() |
612 | 612 | ), |
613 | 613 | array( |
614 | - 'name' => esc_html__( 'New Donation Notification', 'give' ), |
|
614 | + 'name' => esc_html__('New Donation Notification', 'give'), |
|
615 | 615 | 'desc' => '', |
616 | 616 | 'id' => 'give_title_email_settings_3', |
617 | 617 | 'type' => 'give_title' |
618 | 618 | ), |
619 | 619 | array( |
620 | 620 | 'id' => 'donation_notification_subject', |
621 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
622 | - 'desc' => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ), |
|
621 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
622 | + 'desc' => esc_html__('Enter the subject line for the donation notification email.', 'give'), |
|
623 | 623 | 'type' => 'text', |
624 | - 'default' => esc_html__( 'New Donation - #{payment_id}', 'give' ) |
|
624 | + 'default' => esc_html__('New Donation - #{payment_id}', 'give') |
|
625 | 625 | ), |
626 | 626 | array( |
627 | 627 | 'id' => 'donation_notification', |
628 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
628 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
629 | 629 | /* translators: %s: emails tags list */ |
630 | - 'desc' => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>', |
|
630 | + 'desc' => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>', |
|
631 | 631 | 'type' => 'wysiwyg', |
632 | 632 | 'default' => give_get_default_donation_notification_email() |
633 | 633 | ), |
634 | 634 | array( |
635 | 635 | 'id' => 'admin_notice_emails', |
636 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
637 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give' ), |
|
636 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
637 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give'), |
|
638 | 638 | 'type' => 'textarea', |
639 | - 'default' => get_bloginfo( 'admin_email' ) |
|
639 | + 'default' => get_bloginfo('admin_email') |
|
640 | 640 | ), |
641 | 641 | array( |
642 | 642 | 'id' => 'disable_admin_notices', |
643 | - 'name' => esc_html__( 'Disable Admin Notifications', 'give' ), |
|
644 | - 'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
643 | + 'name' => esc_html__('Disable Admin Notifications', 'give'), |
|
644 | + 'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
645 | 645 | 'type' => 'checkbox' |
646 | 646 | ) |
647 | 647 | ) |
@@ -650,99 +650,99 @@ discard block |
||
650 | 650 | /** Extension Settings */ |
651 | 651 | 'addons' => array( |
652 | 652 | 'id' => 'addons', |
653 | - 'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ), |
|
654 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
655 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
653 | + 'give_title' => esc_html__('Give Add-ons Settings', 'give'), |
|
654 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
655 | + 'fields' => apply_filters('give_settings_addons', array() |
|
656 | 656 | ) |
657 | 657 | ), |
658 | 658 | /** Licenses Settings */ |
659 | 659 | 'licenses' => array( |
660 | 660 | 'id' => 'licenses', |
661 | - 'give_title' => esc_html__( 'Give Licenses', 'give' ), |
|
662 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
663 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
661 | + 'give_title' => esc_html__('Give Licenses', 'give'), |
|
662 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
663 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
664 | 664 | ) |
665 | 665 | ), |
666 | 666 | /** Advanced Options */ |
667 | 667 | 'advanced' => array( |
668 | 668 | 'id' => 'advanced_options', |
669 | - 'give_title' => esc_html__( 'Advanced Options', 'give' ), |
|
670 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
671 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
669 | + 'give_title' => esc_html__('Advanced Options', 'give'), |
|
670 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
671 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
672 | 672 | array( |
673 | - 'name' => esc_html__( 'Access Control', 'give' ), |
|
673 | + 'name' => esc_html__('Access Control', 'give'), |
|
674 | 674 | 'desc' => '', |
675 | 675 | 'id' => 'give_title_session_control_1', |
676 | 676 | 'type' => 'give_title' |
677 | 677 | ), |
678 | 678 | array( |
679 | 679 | 'id' => 'session_lifetime', |
680 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
681 | - 'desc' => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ), |
|
680 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
681 | + 'desc' => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'), |
|
682 | 682 | 'type' => 'select', |
683 | 683 | 'options' => array( |
684 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
685 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
686 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
687 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
684 | + '86400' => esc_html__('24 Hours', 'give'), |
|
685 | + '172800' => esc_html__('48 Hours', 'give'), |
|
686 | + '259200' => esc_html__('72 Hours', 'give'), |
|
687 | + '604800' => esc_html__('1 Week', 'give'), |
|
688 | 688 | ) |
689 | 689 | ), |
690 | 690 | array( |
691 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
692 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
691 | + 'name' => esc_html__('Email Access', 'give'), |
|
692 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
693 | 693 | 'id' => 'email_access', |
694 | 694 | 'type' => 'checkbox', |
695 | 695 | ), |
696 | 696 | array( |
697 | 697 | 'id' => 'recaptcha_key', |
698 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
698 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
699 | 699 | /* translators: %s: https://www.google.com/recaptcha/ */ |
700 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
700 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
701 | 701 | 'default' => '', |
702 | 702 | 'type' => 'text' |
703 | 703 | ), |
704 | 704 | array( |
705 | 705 | 'id' => 'recaptcha_secret', |
706 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
707 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
706 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
707 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
708 | 708 | 'default' => '', |
709 | 709 | 'type' => 'text' |
710 | 710 | ), |
711 | 711 | array( |
712 | - 'name' => esc_html__( 'Data Control', 'give' ), |
|
712 | + 'name' => esc_html__('Data Control', 'give'), |
|
713 | 713 | 'desc' => '', |
714 | 714 | 'id' => 'give_title_data_control_2', |
715 | 715 | 'type' => 'give_title' |
716 | 716 | ), |
717 | 717 | array( |
718 | - 'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ), |
|
719 | - 'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
718 | + 'name' => esc_html__('Remove All Data on Uninstall?', 'give'), |
|
719 | + 'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
720 | 720 | 'id' => 'uninstall_on_delete', |
721 | 721 | 'type' => 'checkbox' |
722 | 722 | ), |
723 | 723 | array( |
724 | - 'name' => esc_html__( 'Filter Control', 'give' ), |
|
724 | + 'name' => esc_html__('Filter Control', 'give'), |
|
725 | 725 | 'desc' => '', |
726 | 726 | 'id' => 'give_title_filter_control', |
727 | 727 | 'type' => 'give_title' |
728 | 728 | ), |
729 | 729 | array( |
730 | 730 | /* translators: %s: the_content */ |
731 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
731 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
732 | 732 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
733 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
733 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
734 | 734 | 'id' => 'disable_the_content_filter', |
735 | 735 | 'type' => 'checkbox' |
736 | 736 | ), |
737 | 737 | array( |
738 | - 'name' => esc_html__( 'Script Loading', 'give' ), |
|
738 | + 'name' => esc_html__('Script Loading', 'give'), |
|
739 | 739 | 'desc' => '', |
740 | 740 | 'id' => 'give_title_script_control', |
741 | 741 | 'type' => 'give_title' |
742 | 742 | ), |
743 | 743 | array( |
744 | - 'name' => esc_html__( 'Load Scripts in Footer?', 'give' ), |
|
745 | - 'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
744 | + 'name' => esc_html__('Load Scripts in Footer?', 'give'), |
|
745 | + 'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
746 | 746 | 'id' => 'scripts_footer', |
747 | 747 | 'type' => 'checkbox' |
748 | 748 | ) |
@@ -752,13 +752,13 @@ discard block |
||
752 | 752 | /** API Settings */ |
753 | 753 | 'api' => array( |
754 | 754 | 'id' => 'api', |
755 | - 'give_title' => esc_html__( 'API', 'give' ), |
|
756 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
755 | + 'give_title' => esc_html__('API', 'give'), |
|
756 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
757 | 757 | 'show_names' => false, // Hide field names on the left |
758 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
758 | + 'fields' => apply_filters('give_settings_system', array( |
|
759 | 759 | array( |
760 | 760 | 'id' => 'api', |
761 | - 'name' => esc_html__( 'API', 'give' ), |
|
761 | + 'name' => esc_html__('API', 'give'), |
|
762 | 762 | 'type' => 'api' |
763 | 763 | ) |
764 | 764 | ) |
@@ -767,13 +767,13 @@ discard block |
||
767 | 767 | /** Licenses Settings */ |
768 | 768 | 'system_info' => array( |
769 | 769 | 'id' => 'system_info', |
770 | - 'give_title' => esc_html__( 'System Info', 'give' ), |
|
771 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
772 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
770 | + 'give_title' => esc_html__('System Info', 'give'), |
|
771 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
772 | + 'fields' => apply_filters('give_settings_system', array( |
|
773 | 773 | array( |
774 | 774 | 'id' => 'system_info', |
775 | - 'name' => esc_html__( 'System Info', 'give' ), |
|
776 | - 'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
775 | + 'name' => esc_html__('System Info', 'give'), |
|
776 | + 'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
777 | 777 | 'type' => 'system_info' |
778 | 778 | ) |
779 | 779 | ) |
@@ -782,15 +782,15 @@ discard block |
||
782 | 782 | ); |
783 | 783 | |
784 | 784 | //Return all settings array if no active tab |
785 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
785 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
786 | 786 | |
787 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
787 | + return apply_filters('give_registered_settings', $give_settings); |
|
788 | 788 | |
789 | 789 | } |
790 | 790 | |
791 | 791 | |
792 | 792 | // Add other tabs and settings fields as needed |
793 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
793 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
794 | 794 | |
795 | 795 | } |
796 | 796 | |
@@ -799,11 +799,11 @@ discard block |
||
799 | 799 | */ |
800 | 800 | public function settings_notices() { |
801 | 801 | |
802 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
802 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
803 | 803 | return; |
804 | 804 | } |
805 | 805 | |
806 | - add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' ); |
|
806 | + add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated'); |
|
807 | 807 | |
808 | 808 | } |
809 | 809 | |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return mixed Field value or exception is thrown |
819 | 819 | */ |
820 | - public function __get( $field ) { |
|
820 | + public function __get($field) { |
|
821 | 821 | |
822 | 822 | // Allowed fields to retrieve |
823 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
823 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
824 | 824 | return $this->{$field}; |
825 | 825 | } |
826 | - if ( 'option_metabox' === $field ) { |
|
826 | + if ('option_metabox' === $field) { |
|
827 | 827 | return $this->option_metabox(); |
828 | 828 | } |
829 | 829 | |
830 | - throw new Exception( 'Invalid property: ' . $field ); |
|
830 | + throw new Exception('Invalid property: '.$field); |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -844,12 +844,12 @@ discard block |
||
844 | 844 | * |
845 | 845 | * @return mixed Option value |
846 | 846 | */ |
847 | -function give_get_option( $key = '', $default = false ) { |
|
847 | +function give_get_option($key = '', $default = false) { |
|
848 | 848 | global $give_options; |
849 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
850 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
849 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
850 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
851 | 851 | |
852 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
852 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | |
@@ -867,33 +867,33 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @return boolean True if updated, false if not. |
869 | 869 | */ |
870 | -function give_update_option( $key = '', $value = false ) { |
|
870 | +function give_update_option($key = '', $value = false) { |
|
871 | 871 | |
872 | 872 | // If no key, exit |
873 | - if ( empty( $key ) ) { |
|
873 | + if (empty($key)) { |
|
874 | 874 | return false; |
875 | 875 | } |
876 | 876 | |
877 | - if ( empty( $value ) ) { |
|
878 | - $remove_option = give_delete_option( $key ); |
|
877 | + if (empty($value)) { |
|
878 | + $remove_option = give_delete_option($key); |
|
879 | 879 | |
880 | 880 | return $remove_option; |
881 | 881 | } |
882 | 882 | |
883 | 883 | // First let's grab the current settings |
884 | - $options = get_option( 'give_settings' ); |
|
884 | + $options = get_option('give_settings'); |
|
885 | 885 | |
886 | 886 | // Let's let devs alter that value coming in |
887 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
887 | + $value = apply_filters('give_update_option', $value, $key); |
|
888 | 888 | |
889 | 889 | // Next let's try to update the value |
890 | - $options[ $key ] = $value; |
|
891 | - $did_update = update_option( 'give_settings', $options ); |
|
890 | + $options[$key] = $value; |
|
891 | + $did_update = update_option('give_settings', $options); |
|
892 | 892 | |
893 | 893 | // If it updated, let's update the global variable |
894 | - if ( $did_update ) { |
|
894 | + if ($did_update) { |
|
895 | 895 | global $give_options; |
896 | - $give_options[ $key ] = $value; |
|
896 | + $give_options[$key] = $value; |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | return $did_update; |
@@ -910,27 +910,27 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @return boolean True if updated, false if not. |
912 | 912 | */ |
913 | -function give_delete_option( $key = '' ) { |
|
913 | +function give_delete_option($key = '') { |
|
914 | 914 | |
915 | 915 | // If no key, exit |
916 | - if ( empty( $key ) ) { |
|
916 | + if (empty($key)) { |
|
917 | 917 | return false; |
918 | 918 | } |
919 | 919 | |
920 | 920 | // First let's grab the current settings |
921 | - $options = get_option( 'give_settings' ); |
|
921 | + $options = get_option('give_settings'); |
|
922 | 922 | |
923 | 923 | // Next let's try to update the value |
924 | - if ( isset( $options[ $key ] ) ) { |
|
924 | + if (isset($options[$key])) { |
|
925 | 925 | |
926 | - unset( $options[ $key ] ); |
|
926 | + unset($options[$key]); |
|
927 | 927 | |
928 | 928 | } |
929 | 929 | |
930 | - $did_update = update_option( 'give_settings', $options ); |
|
930 | + $did_update = update_option('give_settings', $options); |
|
931 | 931 | |
932 | 932 | // If it updated, let's update the global variable |
933 | - if ( $did_update ) { |
|
933 | + if ($did_update) { |
|
934 | 934 | global $give_options; |
935 | 935 | $give_options = $options; |
936 | 936 | } |
@@ -949,9 +949,9 @@ discard block |
||
949 | 949 | */ |
950 | 950 | function give_get_settings() { |
951 | 951 | |
952 | - $settings = get_option( 'give_settings' ); |
|
952 | + $settings = get_option('give_settings'); |
|
953 | 953 | |
954 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
954 | + return (array) apply_filters('give_get_settings', $settings); |
|
955 | 955 | |
956 | 956 | } |
957 | 957 | |
@@ -969,25 +969,25 @@ discard block |
||
969 | 969 | * |
970 | 970 | * @return array |
971 | 971 | */ |
972 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
973 | - if ( is_int( $position ) ) { |
|
974 | - array_splice( $array, $position, 0, $insert ); |
|
972 | +function give_settings_array_insert($array, $position, $insert) { |
|
973 | + if (is_int($position)) { |
|
974 | + array_splice($array, $position, 0, $insert); |
|
975 | 975 | } else { |
976 | 976 | |
977 | - foreach ( $array as $index => $subarray ) { |
|
978 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
977 | + foreach ($array as $index => $subarray) { |
|
978 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
979 | 979 | $pos = $index; |
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
983 | - if ( ! isset( $pos ) ) { |
|
983 | + if ( ! isset($pos)) { |
|
984 | 984 | return $array; |
985 | 985 | } |
986 | 986 | |
987 | 987 | $array = array_merge( |
988 | - array_slice( $array, 0, $pos ), |
|
988 | + array_slice($array, 0, $pos), |
|
989 | 989 | $insert, |
990 | - array_slice( $array, $pos ) |
|
990 | + array_slice($array, $pos) |
|
991 | 991 | ); |
992 | 992 | } |
993 | 993 | |
@@ -1010,31 +1010,31 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return void |
1012 | 1012 | */ |
1013 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1013 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1014 | 1014 | |
1015 | 1015 | $id = $field_type_object->field->args['id']; |
1016 | 1016 | $field_description = $field_type_object->field->args['desc']; |
1017 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
1017 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
1018 | 1018 | |
1019 | 1019 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
1020 | 1020 | |
1021 | - foreach ( $gateways as $key => $option ) : |
|
1021 | + foreach ($gateways as $key => $option) : |
|
1022 | 1022 | |
1023 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
1023 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
1024 | 1024 | $enabled = '1'; |
1025 | 1025 | } else { |
1026 | 1026 | $enabled = null; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
1030 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
1029 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
1030 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
1031 | 1031 | |
1032 | 1032 | endforeach; |
1033 | 1033 | |
1034 | 1034 | echo '</ul>'; |
1035 | 1035 | |
1036 | - if ( $field_description ) { |
|
1037 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1036 | + if ($field_description) { |
|
1037 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | } |
@@ -1050,31 +1050,31 @@ discard block |
||
1050 | 1050 | * |
1051 | 1051 | * @return void |
1052 | 1052 | */ |
1053 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1053 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1054 | 1054 | |
1055 | 1055 | $id = $field_type_object->field->args['id']; |
1056 | 1056 | $field_description = $field_type_object->field->args['desc']; |
1057 | 1057 | $gateways = give_get_enabled_payment_gateways(); |
1058 | 1058 | |
1059 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
1059 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
1060 | 1060 | |
1061 | 1061 | //Add a field to the Give Form admin single post view of this field |
1062 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
1063 | - echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>'; |
|
1062 | + if ($field_type_object->field->object_type === 'post') { |
|
1063 | + echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>'; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | - foreach ( $gateways as $key => $option ) : |
|
1066 | + foreach ($gateways as $key => $option) : |
|
1067 | 1067 | |
1068 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
1068 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
1069 | 1069 | |
1070 | 1070 | |
1071 | - echo '<option value="' . esc_attr__( $key ) . '"' . $selected . '>' . esc_html__( $option['admin_label'] ) . '</option>'; |
|
1071 | + echo '<option value="'.esc_attr__($key).'"'.$selected.'>'.esc_html__($option['admin_label']).'</option>'; |
|
1072 | 1072 | |
1073 | 1073 | endforeach; |
1074 | 1074 | |
1075 | 1075 | echo '</select>'; |
1076 | 1076 | |
1077 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1077 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1078 | 1078 | |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1089,13 +1089,13 @@ discard block |
||
1089 | 1089 | * |
1090 | 1090 | * @return void |
1091 | 1091 | */ |
1092 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1092 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1093 | 1093 | |
1094 | 1094 | $id = $field_type_object->field->args['id']; |
1095 | 1095 | $title = $field_type_object->field->args['name']; |
1096 | 1096 | $field_description = $field_type_object->field->args['desc']; |
1097 | 1097 | |
1098 | - echo '<hr>' . $field_description; |
|
1098 | + echo '<hr>'.$field_description; |
|
1099 | 1099 | |
1100 | 1100 | } |
1101 | 1101 | |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | * |
1111 | 1111 | * @return void |
1112 | 1112 | */ |
1113 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1113 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1114 | 1114 | |
1115 | 1115 | $id = $field_type_object->field->args['id']; |
1116 | 1116 | $title = $field_type_object->field->args['name']; |
@@ -1130,25 +1130,25 @@ discard block |
||
1130 | 1130 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1131 | 1131 | * @return array An array of options that matches the CMB2 options array |
1132 | 1132 | */ |
1133 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1133 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1134 | 1134 | |
1135 | - $post_options = array( '' => '' ); // Blank option |
|
1135 | + $post_options = array('' => ''); // Blank option |
|
1136 | 1136 | |
1137 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1137 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1138 | 1138 | return $post_options; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - $args = wp_parse_args( $query_args, array( |
|
1141 | + $args = wp_parse_args($query_args, array( |
|
1142 | 1142 | 'post_type' => 'page', |
1143 | 1143 | 'numberposts' => 10, |
1144 | - ) ); |
|
1144 | + )); |
|
1145 | 1145 | |
1146 | - $posts = get_posts( $args ); |
|
1146 | + $posts = get_posts($args); |
|
1147 | 1147 | |
1148 | - if ( $posts ) { |
|
1149 | - foreach ( $posts as $post ) { |
|
1148 | + if ($posts) { |
|
1149 | + foreach ($posts as $post) { |
|
1150 | 1150 | |
1151 | - $post_options[ $post->ID ] = $post->post_title; |
|
1151 | + $post_options[$post->ID] = $post->post_title; |
|
1152 | 1152 | |
1153 | 1153 | } |
1154 | 1154 | } |
@@ -1168,17 +1168,17 @@ discard block |
||
1168 | 1168 | global $_wp_additional_image_sizes; |
1169 | 1169 | $sizes = array(); |
1170 | 1170 | |
1171 | - foreach ( get_intermediate_image_sizes() as $_size ) { |
|
1171 | + foreach (get_intermediate_image_sizes() as $_size) { |
|
1172 | 1172 | |
1173 | - if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { |
|
1174 | - $sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1175 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1176 | - $sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height']; |
|
1173 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) { |
|
1174 | + $sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1175 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1176 | + $sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height']; |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1181 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | |
@@ -1192,34 +1192,34 @@ discard block |
||
1192 | 1192 | * |
1193 | 1193 | * @return void |
1194 | 1194 | */ |
1195 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1195 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1196 | 1196 | |
1197 | 1197 | $id = $field_type_object->field->args['id']; |
1198 | 1198 | $field_description = $field_type_object->field->args['desc']; |
1199 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1199 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1200 | 1200 | $field_classes = 'regular-text give-license-field'; |
1201 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1201 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1202 | 1202 | |
1203 | - if ( $license_status === 'valid' ) { |
|
1203 | + if ($license_status === 'valid') { |
|
1204 | 1204 | $field_classes .= ' give-license-active'; |
1205 | 1205 | } |
1206 | 1206 | |
1207 | - $html = $field_type_object->input( array( |
|
1207 | + $html = $field_type_object->input(array( |
|
1208 | 1208 | 'class' => $field_classes, |
1209 | 1209 | 'type' => $type |
1210 | - ) ); |
|
1210 | + )); |
|
1211 | 1211 | |
1212 | 1212 | //License is active so show deactivate button |
1213 | - if ( $license_status === 'valid' ) { |
|
1214 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1213 | + if ($license_status === 'valid') { |
|
1214 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1215 | 1215 | } else { |
1216 | 1216 | //This license is not valid so delete it |
1217 | - give_delete_option( $id ); |
|
1217 | + give_delete_option($id); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1220 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1221 | 1221 | |
1222 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1222 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1223 | 1223 | |
1224 | 1224 | echo $html; |
1225 | 1225 | } |
@@ -1233,13 +1233,13 @@ discard block |
||
1233 | 1233 | */ |
1234 | 1234 | function give_api_callback() { |
1235 | 1235 | |
1236 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1236 | + if ( ! current_user_can('manage_give_settings')) { |
|
1237 | 1237 | return; |
1238 | 1238 | } |
1239 | 1239 | |
1240 | - do_action( 'give_tools_api_keys_before' ); |
|
1240 | + do_action('give_tools_api_keys_before'); |
|
1241 | 1241 | |
1242 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1242 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1243 | 1243 | |
1244 | 1244 | $api_keys_table = new Give_API_Keys_Table(); |
1245 | 1245 | $api_keys_table->prepare_items(); |
@@ -1248,17 +1248,17 @@ discard block |
||
1248 | 1248 | <span class="cmb2-metabox-description api-description"> |
1249 | 1249 | <?php echo sprintf( |
1250 | 1250 | /* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */ |
1251 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1252 | - esc_url( 'https://givewp.com/documentation/give-api-reference/' ), |
|
1253 | - esc_url( 'https://givewp.com/addons/zapier/' ) |
|
1251 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1252 | + esc_url('https://givewp.com/documentation/give-api-reference/'), |
|
1253 | + esc_url('https://givewp.com/addons/zapier/') |
|
1254 | 1254 | ); ?> |
1255 | 1255 | </span> |
1256 | 1256 | <?php |
1257 | 1257 | |
1258 | - do_action( 'give_tools_api_keys_after' ); |
|
1258 | + do_action('give_tools_api_keys_after'); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1261 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1262 | 1262 | |
1263 | 1263 | /** |
1264 | 1264 | * Hook Callback |
@@ -1271,8 +1271,8 @@ discard block |
||
1271 | 1271 | * |
1272 | 1272 | * @return void |
1273 | 1273 | */ |
1274 | -function give_hook_callback( $args ) { |
|
1275 | - do_action( 'give_' . $args['id'] ); |
|
1274 | +function give_hook_callback($args) { |
|
1275 | + do_action('give_'.$args['id']); |
|
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | /** |
@@ -1282,10 +1282,10 @@ discard block |
||
1282 | 1282 | * |
1283 | 1283 | */ |
1284 | 1284 | |
1285 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1286 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1287 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1288 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1289 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1290 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1285 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1286 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1287 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1288 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1289 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1290 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1291 | 1291 | } |
1292 | 1292 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param $_banner_details |
28 | 28 | */ |
29 | - function __construct( $_banner_details ) { |
|
29 | + function __construct($_banner_details) { |
|
30 | 30 | |
31 | 31 | global $current_user; |
32 | 32 | $this->banner_details = $_banner_details; |
33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
35 | 35 | |
36 | 36 | //Get current user |
37 | 37 | $this->user_id = $current_user->ID; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | public function init() { |
51 | 51 | |
52 | 52 | //Testing? |
53 | - if ( $this->test_mode ) { |
|
54 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
53 | + if ($this->test_mode) { |
|
54 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | //Get the current page to add the notice to |
58 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
59 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
58 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
59 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | global $pagenow; |
72 | 72 | |
73 | 73 | //Make sure we're on the plugins page. |
74 | - if ( $pagenow !== 'plugins.php' ) { |
|
74 | + if ($pagenow !== 'plugins.php') { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // If the user hasn't already dismissed our alert, |
79 | 79 | // Output the activation banner |
80 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
80 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
81 | 81 | |
82 | 82 | <!-- * I output inline styles here |
83 | 83 | * because there's no reason to keep these |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | <h3><?php |
158 | 158 | printf( |
159 | 159 | /* translators: %s: Add-on name */ |
160 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
161 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
160 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
161 | + '<span>'.$this->banner_details['name'].'</span>' |
|
162 | 162 | ); |
163 | 163 | ?></h3> |
164 | 164 | |
165 | 165 | <a href="<?php |
166 | 166 | //The Dismiss Button |
167 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
168 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
167 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
168 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
169 | 169 | |
170 | 170 | <!-- * Now we output a few "actions" |
171 | 171 | * that the user can take from here --> |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | <div class="alert-actions"> |
174 | 174 | |
175 | 175 | <?php //Point them to your settings page |
176 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
176 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
177 | 177 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
178 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
178 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
179 | 179 | </a> |
180 | 180 | <?php } ?> |
181 | 181 | |
182 | 182 | <?php |
183 | 183 | // Show them how to configure the Addon |
184 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
184 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
185 | 185 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
186 | 186 | <span class="dashicons dashicons-media-text"></span> |
187 | 187 | <?php |
188 | 188 | printf( |
189 | 189 | /* translators: %s: Add-on name */ |
190 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
190 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
191 | 191 | $this->banner_details['name'] |
192 | 192 | ); |
193 | 193 | ?> |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <?php |
197 | 197 | //Let them signup for plugin updates |
198 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
198 | + if (isset($this->banner_details['support_url'])) { ?> |
|
199 | 199 | |
200 | 200 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
201 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
201 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
202 | 202 | </a> |
203 | 203 | |
204 | 204 | <?php } ?> |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
221 | 221 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
222 | 222 | */ |
223 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
223 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
224 | 224 | |
225 | 225 | //Get the global user |
226 | 226 | global $current_user; |
227 | 227 | $user_id = $current_user->ID; |
228 | 228 | |
229 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
229 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Payment History Page |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | function give_payment_history_page() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
27 | + $give_payment = get_post_type_object('give_payment'); |
|
28 | 28 | |
29 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
29 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
31 | 31 | } else { |
32 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
32 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
33 | 33 | $payments_table = new Give_Payment_History_Table(); |
34 | 34 | $payments_table->prepare_items(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap"> |
37 | 37 | <h2><?php echo $give_payment->labels->menu_name ?></h2> |
38 | - <?php do_action( 'give_payments_page_top' ); ?> |
|
39 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
38 | + <?php do_action('give_payments_page_top'); ?> |
|
39 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
40 | 40 | <input type="hidden" name="post_type" value="give_forms" /> |
41 | 41 | <input type="hidden" name="page" value="give-payment-history" /> |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php $payments_table->display() ?> |
48 | 48 | </form> |
49 | - <?php do_action( 'give_payments_page_bottom' ); ?> |
|
49 | + <?php do_action('give_payments_page_bottom'); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php |
52 | 52 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | * @param $title |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_view_order_details_title( $admin_title, $title ) { |
|
64 | +function give_view_order_details_title($admin_title, $title) { |
|
65 | 65 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
66 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
67 | 67 | return $admin_title; |
68 | 68 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
69 | + if ( ! isset($_GET['give-action'])) |
|
70 | 70 | return $admin_title; |
71 | 71 | |
72 | - switch( $_GET['give-action'] ) : |
|
72 | + switch ($_GET['give-action']) : |
|
73 | 73 | |
74 | 74 | case 'view-order-details' : |
75 | - $title = esc_html__( 'View Donation Details', 'give' ) . ' - ' . $admin_title; |
|
75 | + $title = esc_html__('View Donation Details', 'give').' - '.$admin_title; |
|
76 | 76 | break; |
77 | 77 | case 'edit-payment' : |
78 | - $title = esc_html__( 'Edit Payment', 'give' ) . ' - ' . $admin_title; |
|
78 | + $title = esc_html__('Edit Payment', 'give').' - '.$admin_title; |
|
79 | 79 | break; |
80 | 80 | default: |
81 | 81 | $title = $admin_title; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | return $title; |
86 | 86 | } |
87 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
87 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | * @param $context |
97 | 97 | * @return string |
98 | 98 | */ |
99 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
99 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
100 | 100 | |
101 | - $post = get_post( $post_id ); |
|
102 | - if( ! $post ) |
|
101 | + $post = get_post($post_id); |
|
102 | + if ( ! $post) |
|
103 | 103 | return $url; |
104 | 104 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
105 | + if ('give_payment' != $post->post_type) |
|
106 | 106 | return $url; |
107 | 107 | |
108 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
108 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
109 | 109 | |
110 | 110 | return $url; |
111 | 111 | } |
112 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
112 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |