@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => __( 'Income', 'give' ), |
|
75 | + 'earnings' => __('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => __( 'Donors', 'give' ), |
|
78 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => __('Donors', 'give'), |
|
78 | + 'gateways' => __('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,50 +284,50 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | - <?php echo Give()->html->year_dropdown( 'start_year' ); ?> |
|
317 | - <?php echo Give()->html->month_dropdown( 'start_month' ); ?> |
|
318 | - <?php echo _x( 'to', 'Date one to date two', 'give' ); ?> |
|
319 | - <?php echo Give()->html->year_dropdown( 'end_year' ); ?> |
|
320 | - <?php echo Give()->html->month_dropdown( 'end_month' ); ?> |
|
316 | + <?php echo Give()->html->year_dropdown('start_year'); ?> |
|
317 | + <?php echo Give()->html->month_dropdown('start_month'); ?> |
|
318 | + <?php echo _x('to', 'Date one to date two', 'give'); ?> |
|
319 | + <?php echo Give()->html->year_dropdown('end_year'); ?> |
|
320 | + <?php echo Give()->html->month_dropdown('end_month'); ?> |
|
321 | 321 | <input type="hidden" name="give-action" value="earnings_export"/> |
322 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
322 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
323 | 323 | </form> |
324 | 324 | </td> |
325 | 325 | </tr> |
326 | 326 | <tr class="give-export-payment-history"> |
327 | 327 | <td class="row-title"> |
328 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
328 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
329 | 329 | |
330 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
330 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
331 | 331 | </td> |
332 | 332 | <td> |
333 | 333 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -335,29 +335,29 @@ discard block |
||
335 | 335 | $args = array( |
336 | 336 | 'id' => 'give-payment-export-start', |
337 | 337 | 'name' => 'start', |
338 | - 'placeholder' => __( 'Start date', 'give' ) |
|
338 | + 'placeholder' => __('Start date', 'give') |
|
339 | 339 | ); |
340 | - echo Give()->html->date_field( $args ); ?> |
|
340 | + echo Give()->html->date_field($args); ?> |
|
341 | 341 | <?php |
342 | 342 | $args = array( |
343 | 343 | 'id' => 'give-payment-export-end', |
344 | 344 | 'name' => 'end', |
345 | - 'placeholder' => __( 'End date', 'give' ) |
|
345 | + 'placeholder' => __('End date', 'give') |
|
346 | 346 | ); |
347 | - echo Give()->html->date_field( $args ); ?> |
|
347 | + echo Give()->html->date_field($args); ?> |
|
348 | 348 | <select name="status"> |
349 | - <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
349 | + <option value="any"><?php _e('All Statuses', 'give'); ?></option> |
|
350 | 350 | <?php |
351 | 351 | $statuses = give_get_payment_statuses(); |
352 | - foreach ( $statuses as $status => $label ) { |
|
353 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
352 | + foreach ($statuses as $status => $label) { |
|
353 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
354 | 354 | } |
355 | 355 | ?> |
356 | 356 | </select> |
357 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
357 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
358 | 358 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
359 | 359 | <span> |
360 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
360 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
361 | 361 | <span class="spinner"></span> |
362 | 362 | </span> |
363 | 363 | </form> |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | </tr> |
367 | 367 | <tr class="alternate give-export-donors"> |
368 | 368 | <td class="row-title"> |
369 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
369 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
370 | 370 | |
371 | - <p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
371 | + <p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
372 | 372 | </td> |
373 | 373 | <td> |
374 | 374 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -379,54 +379,54 @@ discard block |
||
379 | 379 | 'id' => 'give_customer_export_form', |
380 | 380 | 'chosen' => true |
381 | 381 | ); |
382 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
382 | + echo Give()->html->forms_dropdown($args); ?> |
|
383 | 383 | |
384 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
384 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
385 | 385 | |
386 | 386 | <div id="export-donor-options-wrap" class="give-clearfix"> |
387 | - <p><?php _e( 'Export Columns', 'give' ); ?>:</p> |
|
387 | + <p><?php _e('Export Columns', 'give'); ?>:</p> |
|
388 | 388 | <ul id="give-export-option-ul"> |
389 | 389 | <li> |
390 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?> |
|
390 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?> |
|
391 | 391 | </label> |
392 | 392 | </li> |
393 | 393 | <li> |
394 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?> |
|
394 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?> |
|
395 | 395 | </label> |
396 | 396 | </li> |
397 | 397 | <li> |
398 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?> |
|
398 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?> |
|
399 | 399 | </label> |
400 | 400 | </li> |
401 | 401 | <li> |
402 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?> |
|
402 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?> |
|
403 | 403 | </label> |
404 | 404 | </li> |
405 | 405 | <li> |
406 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?> |
|
406 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?> |
|
407 | 407 | </label> |
408 | 408 | </li> |
409 | 409 | <li> |
410 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?> |
|
410 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?> |
|
411 | 411 | </label> |
412 | 412 | </li> |
413 | 413 | <li> |
414 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?> |
|
414 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?> |
|
415 | 415 | </label> |
416 | 416 | </li> |
417 | 417 | </ul> |
418 | 418 | </div> |
419 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
419 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
420 | 420 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
421 | 421 | <input type="hidden" name="give-action" value="email_export"/> |
422 | 422 | </form> |
423 | 423 | </td> |
424 | 424 | </tr> |
425 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
425 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
426 | 426 | </tbody> |
427 | 427 | </table> |
428 | 428 | |
429 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
429 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
430 | 430 | |
431 | 431 | </div> |
432 | 432 | <!-- .post-body-content --> |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | <?php |
437 | 437 | } |
438 | 438 | |
439 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
439 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
440 | 440 | |
441 | 441 | /** |
442 | 442 | * Renders the Reports page |
@@ -446,19 +446,19 @@ discard block |
||
446 | 446 | */ |
447 | 447 | function give_reports_tab_logs() { |
448 | 448 | |
449 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
449 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
450 | 450 | |
451 | 451 | $current_view = 'sales'; |
452 | 452 | $log_views = give_log_default_views(); |
453 | 453 | |
454 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
454 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
455 | 455 | $current_view = $_GET['view']; |
456 | 456 | } |
457 | 457 | |
458 | - do_action( 'give_logs_view_' . $current_view ); |
|
458 | + do_action('give_logs_view_'.$current_view); |
|
459 | 459 | } |
460 | 460 | |
461 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
461 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
462 | 462 | |
463 | 463 | /** |
464 | 464 | * Retrieves estimated monthly earnings and sales |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function give_estimated_monthly_stats() { |
470 | 470 | |
471 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
471 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
472 | 472 | |
473 | - if ( false === $estimated ) { |
|
473 | + if (false === $estimated) { |
|
474 | 474 | |
475 | 475 | $estimated = array( |
476 | 476 | 'earnings' => 0, |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | |
480 | 480 | $stats = new Give_Payment_Stats; |
481 | 481 | |
482 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
483 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
482 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
483 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
484 | 484 | |
485 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
486 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
487 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
488 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
485 | + $current_day = date('d', current_time('timestamp')); |
|
486 | + $current_month = date('n', current_time('timestamp')); |
|
487 | + $current_year = date('Y', current_time('timestamp')); |
|
488 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
489 | 489 | |
490 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
491 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
490 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
491 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
492 | 492 | |
493 | 493 | // Cache for one day |
494 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
494 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
495 | 495 | } |
496 | 496 | |
497 | - return maybe_unserialize( $estimated ); |
|
497 | + return maybe_unserialize($estimated); |
|
498 | 498 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => __( 'Show Donation Amount:', 'give' ), |
|
42 | + 'label' => __('Show Donation Amount:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => __( 'Show', 'give' ), |
|
45 | - 'false' => __( 'Hide', 'give' ), |
|
44 | + 'true' => __('Show', 'give'), |
|
45 | + 'false' => __('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'donor', |
51 | - 'label' => __( 'Show Donor Name:', 'give' ), |
|
51 | + 'label' => __('Show Donor Name:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => __( 'Show', 'give' ), |
|
54 | - 'false' => __( 'Hide', 'give' ), |
|
53 | + 'true' => __('Show', 'give'), |
|
54 | + 'false' => __('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'date', |
60 | - 'label' => __( 'Show Date:', 'give' ), |
|
60 | + 'label' => __('Show Date:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => __( 'Show', 'give' ), |
|
63 | - 'false' => __( 'Hide', 'give' ), |
|
62 | + 'true' => __('Show', 'give'), |
|
63 | + 'false' => __('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_key', |
69 | - 'label' => __( 'Show Payment Key:', 'give' ), |
|
69 | + 'label' => __('Show Payment Key:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => __( 'Show', 'give' ), |
|
72 | - 'false' => __( 'Hide', 'give' ), |
|
71 | + 'true' => __('Show', 'give'), |
|
72 | + 'false' => __('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_method', |
78 | - 'label' => __( 'Show Payment Method:', 'give' ), |
|
78 | + 'label' => __('Show Payment Method:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => __( 'Show', 'give' ), |
|
81 | - 'false' => __( 'Hide', 'give' ), |
|
80 | + 'true' => __('Show', 'give'), |
|
81 | + 'false' => __('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'payment_id', |
87 | - 'label' => __( 'Show Payment ID:', 'give' ), |
|
87 | + 'label' => __('Show Payment ID:', 'give'), |
|
88 | 88 | 'options' => array( |
89 | - 'true' => __( 'Show', 'give' ), |
|
90 | - 'false' => __( 'Hide', 'give' ), |
|
89 | + 'true' => __('Show', 'give'), |
|
90 | + 'false' => __('Hide', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array $output Response messages |
25 | 25 | */ |
26 | -function give_edit_customer( $args ) { |
|
26 | +function give_edit_customer($args) { |
|
27 | 27 | |
28 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
28 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
31 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
30 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
31 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $args ) ) { |
|
34 | + if (empty($args)) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $customer_id = (int) $args['customerinfo']['id']; |
40 | 40 | $nonce = $args['_wpnonce']; |
41 | 41 | |
42 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
43 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
42 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
43 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
44 | 44 | } |
45 | 45 | |
46 | - $customer = new Give_Customer( $customer_id ); |
|
47 | - if ( empty( $customer->id ) ) { |
|
46 | + $customer = new Give_Customer($customer_id); |
|
47 | + if (empty($customer->id)) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | 'user_id' => 0 |
55 | 55 | ); |
56 | 56 | |
57 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
57 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
58 | 58 | |
59 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
60 | - give_set_error( 'give-invalid-email', __( 'Please enter a valid email address.', 'give' ) ); |
|
59 | + if ( ! is_email($customer_info['email'])) { |
|
60 | + give_set_error('give-invalid-email', __('Please enter a valid email address.', 'give')); |
|
61 | 61 | } |
62 | 62 | |
63 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
63 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
64 | 64 | |
65 | 65 | // Make sure we don't already have this user attached to a customer |
66 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
67 | - give_set_error( 'give-invalid-customer-user_id', sprintf( __( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
66 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
67 | + give_set_error('give-invalid-customer-user_id', sprintf(__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Make sure it's actually a user |
71 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
72 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
73 | - give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
71 | + $user = get_user_by('id', $customer_info['user_id']); |
|
72 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
73 | + give_set_error('give-invalid-user_id', sprintf(__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | } |
@@ -78,82 +78,82 @@ discard block |
||
78 | 78 | // Record this for later |
79 | 79 | $previous_user_id = $customer->user_id; |
80 | 80 | |
81 | - if ( give_get_errors() ) { |
|
81 | + if (give_get_errors()) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Setup the customer address, if present |
86 | 86 | $address = array(); |
87 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
87 | + if (intval($customer_info['user_id']) > 0) { |
|
88 | 88 | |
89 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
89 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
90 | 90 | |
91 | - if ( false === $current_address ) { |
|
92 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
93 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
94 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
95 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
96 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
97 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
91 | + if (false === $current_address) { |
|
92 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
93 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
94 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
95 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
96 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
97 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
98 | 98 | } else { |
99 | - $current_address = wp_parse_args( $current_address, array( |
|
99 | + $current_address = wp_parse_args($current_address, array( |
|
100 | 100 | 'line1', |
101 | 101 | 'line2', |
102 | 102 | 'city', |
103 | 103 | 'zip', |
104 | 104 | 'state', |
105 | 105 | 'country' |
106 | - ) ); |
|
107 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
110 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
111 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
106 | + )); |
|
107 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
110 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
111 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Sanitize the inputs |
118 | 118 | $customer_data = array(); |
119 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
119 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
120 | 120 | $customer_data['email'] = $customer_info['email']; |
121 | 121 | $customer_data['user_id'] = $customer_info['user_id']; |
122 | 122 | |
123 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
124 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
123 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
124 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
125 | 125 | |
126 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
127 | - $address = array_map( 'sanitize_text_field', $address ); |
|
126 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
127 | + $address = array_map('sanitize_text_field', $address); |
|
128 | 128 | |
129 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
129 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
130 | 130 | |
131 | 131 | $output = array(); |
132 | 132 | $previous_email = $customer->email; |
133 | 133 | |
134 | - if ( $customer->update( $customer_data ) ) { |
|
134 | + if ($customer->update($customer_data)) { |
|
135 | 135 | |
136 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
137 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
136 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
137 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Update some payment meta if we need to |
141 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
141 | + $payments_array = explode(',', $customer->payment_ids); |
|
142 | 142 | |
143 | - if ( $customer->email != $previous_email ) { |
|
144 | - foreach ( $payments_array as $payment_id ) { |
|
145 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
143 | + if ($customer->email != $previous_email) { |
|
144 | + foreach ($payments_array as $payment_id) { |
|
145 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( $customer->user_id != $previous_user_id ) { |
|
150 | - foreach ( $payments_array as $payment_id ) { |
|
151 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
149 | + if ($customer->user_id != $previous_user_id) { |
|
150 | + foreach ($payments_array as $payment_id) { |
|
151 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | $output['success'] = true; |
156 | - $customer_data = array_merge( $customer_data, $address ); |
|
156 | + $customer_data = array_merge($customer_data, $address); |
|
157 | 157 | $output['customer_info'] = $customer_data; |
158 | 158 | |
159 | 159 | } else { |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
165 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
166 | 166 | |
167 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
168 | - header( 'Content-Type: application/json' ); |
|
169 | - echo json_encode( $output ); |
|
167 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
168 | + header('Content-Type: application/json'); |
|
169 | + echo json_encode($output); |
|
170 | 170 | wp_die(); |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
177 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Save a customer note being added |
@@ -185,53 +185,53 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return int The Note ID that was saved, or 0 if nothing was saved |
187 | 187 | */ |
188 | -function give_customer_save_note( $args ) { |
|
188 | +function give_customer_save_note($args) { |
|
189 | 189 | |
190 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
190 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
191 | 191 | |
192 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
193 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
192 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
193 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
194 | 194 | } |
195 | 195 | |
196 | - if ( empty( $args ) ) { |
|
196 | + if (empty($args)) { |
|
197 | 197 | return; |
198 | 198 | } |
199 | 199 | |
200 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
200 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
201 | 201 | $customer_id = (int) $args['customer_id']; |
202 | 202 | $nonce = $args['add_customer_note_nonce']; |
203 | 203 | |
204 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
205 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
204 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
205 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
206 | 206 | } |
207 | 207 | |
208 | - if ( empty( $customer_note ) ) { |
|
209 | - give_set_error( 'empty-customer-note', __( 'A note is required', 'give' ) ); |
|
208 | + if (empty($customer_note)) { |
|
209 | + give_set_error('empty-customer-note', __('A note is required', 'give')); |
|
210 | 210 | } |
211 | 211 | |
212 | - if ( give_get_errors() ) { |
|
212 | + if (give_get_errors()) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
216 | - $customer = new Give_Customer( $customer_id ); |
|
217 | - $new_note = $customer->add_note( $customer_note ); |
|
216 | + $customer = new Give_Customer($customer_id); |
|
217 | + $new_note = $customer->add_note($customer_note); |
|
218 | 218 | |
219 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
219 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
220 | 220 | |
221 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
221 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
222 | 222 | |
223 | 223 | ob_start(); |
224 | 224 | ?> |
225 | 225 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
226 | 226 | <span class="note-content-wrap"> |
227 | - <?php echo stripslashes( $new_note ); ?> |
|
227 | + <?php echo stripslashes($new_note); ?> |
|
228 | 228 | </span> |
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | $output = ob_get_contents(); |
232 | 232 | ob_end_clean(); |
233 | 233 | |
234 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
234 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
235 | 235 | echo $output; |
236 | 236 | exit; |
237 | 237 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | } |
246 | 246 | |
247 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
247 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Delete a customer |
@@ -255,87 +255,87 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return int Whether it was a successful deletion |
257 | 257 | */ |
258 | -function give_customer_delete( $args ) { |
|
258 | +function give_customer_delete($args) { |
|
259 | 259 | |
260 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
260 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
261 | 261 | |
262 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
263 | - wp_die( __( 'You do not have permission to delete this donor.', 'give' ) ); |
|
262 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
263 | + wp_die(__('You do not have permission to delete this donor.', 'give')); |
|
264 | 264 | } |
265 | 265 | |
266 | - if ( empty( $args ) ) { |
|
266 | + if (empty($args)) { |
|
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | 270 | $customer_id = (int) $args['customer_id']; |
271 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
272 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
271 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
272 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
273 | 273 | $nonce = $args['_wpnonce']; |
274 | 274 | |
275 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
276 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
275 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
276 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
277 | 277 | } |
278 | 278 | |
279 | - if ( ! $confirm ) { |
|
280 | - give_set_error( 'customer-delete-no-confirm', __( 'Please confirm you want to delete this donor', 'give' ) ); |
|
279 | + if ( ! $confirm) { |
|
280 | + give_set_error('customer-delete-no-confirm', __('Please confirm you want to delete this donor', 'give')); |
|
281 | 281 | } |
282 | 282 | |
283 | - if ( give_get_errors() ) { |
|
284 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
283 | + if (give_get_errors()) { |
|
284 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
285 | 285 | exit; |
286 | 286 | } |
287 | 287 | |
288 | - $customer = new Give_Customer( $customer_id ); |
|
288 | + $customer = new Give_Customer($customer_id); |
|
289 | 289 | |
290 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
290 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
291 | 291 | |
292 | 292 | $success = false; |
293 | 293 | |
294 | - if ( $customer->id > 0 ) { |
|
294 | + if ($customer->id > 0) { |
|
295 | 295 | |
296 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
297 | - $success = Give()->customers->delete( $customer->id ); |
|
296 | + $payments_array = explode(',', $customer->payment_ids); |
|
297 | + $success = Give()->customers->delete($customer->id); |
|
298 | 298 | |
299 | - if ( $success ) { |
|
299 | + if ($success) { |
|
300 | 300 | |
301 | - if ( $remove_data ) { |
|
301 | + if ($remove_data) { |
|
302 | 302 | |
303 | 303 | // Remove all payments, logs, etc |
304 | - foreach ( $payments_array as $payment_id ) { |
|
305 | - give_delete_purchase( $payment_id ); |
|
304 | + foreach ($payments_array as $payment_id) { |
|
305 | + give_delete_purchase($payment_id); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | } else { |
309 | 309 | |
310 | 310 | // Just set the payments to customer_id of 0 |
311 | - foreach ( $payments_array as $payment_id ) { |
|
312 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
311 | + foreach ($payments_array as $payment_id) { |
|
312 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | } |
316 | 316 | |
317 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
317 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
318 | 318 | |
319 | 319 | } else { |
320 | 320 | |
321 | - give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor', 'give' ) ); |
|
322 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
321 | + give_set_error('give-donor-delete-failed', __('Error deleting donor', 'give')); |
|
322 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
323 | 323 | |
324 | 324 | } |
325 | 325 | |
326 | 326 | } else { |
327 | 327 | |
328 | - give_set_error( 'give-customer-delete-invalid-id', __( 'Invalid Donor ID', 'give' ) ); |
|
329 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
328 | + give_set_error('give-customer-delete-invalid-id', __('Invalid Donor ID', 'give')); |
|
329 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
333 | - wp_redirect( $redirect ); |
|
333 | + wp_redirect($redirect); |
|
334 | 334 | exit; |
335 | 335 | |
336 | 336 | } |
337 | 337 | |
338 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
338 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
339 | 339 | |
340 | 340 | /** |
341 | 341 | * Disconnect a user ID from a donor |
@@ -346,39 +346,39 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool If the disconnect was successful |
348 | 348 | */ |
349 | -function give_disconnect_customer_user_id( $args ) { |
|
349 | +function give_disconnect_customer_user_id($args) { |
|
350 | 350 | |
351 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
351 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
352 | 352 | |
353 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
354 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
353 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
354 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
355 | 355 | } |
356 | 356 | |
357 | - if ( empty( $args ) ) { |
|
357 | + if (empty($args)) { |
|
358 | 358 | return; |
359 | 359 | } |
360 | 360 | |
361 | 361 | $customer_id = (int) $args['customer_id']; |
362 | 362 | $nonce = $args['_wpnonce']; |
363 | 363 | |
364 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
365 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
364 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
365 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
366 | 366 | } |
367 | 367 | |
368 | - $customer = new Give_Customer( $customer_id ); |
|
369 | - if ( empty( $customer->id ) ) { |
|
368 | + $customer = new Give_Customer($customer_id); |
|
369 | + if (empty($customer->id)) { |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id ); |
|
373 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id); |
|
374 | 374 | |
375 | - $customer_args = array( 'user_id' => 0 ); |
|
375 | + $customer_args = array('user_id' => 0); |
|
376 | 376 | |
377 | - if ( $customer->update( $customer_args ) ) { |
|
377 | + if ($customer->update($customer_args)) { |
|
378 | 378 | global $wpdb; |
379 | 379 | |
380 | - if ( ! empty( $customer->payment_ids ) ) { |
|
381 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
380 | + if ( ! empty($customer->payment_ids)) { |
|
381 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | $output['success'] = true; |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | } else { |
387 | 387 | |
388 | 388 | $output['success'] = false; |
389 | - give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor', 'give' ) ); |
|
389 | + give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor', 'give')); |
|
390 | 390 | } |
391 | 391 | |
392 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
392 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
393 | 393 | |
394 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
395 | - header( 'Content-Type: application/json' ); |
|
396 | - echo json_encode( $output ); |
|
394 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
395 | + header('Content-Type: application/json'); |
|
396 | + echo json_encode($output); |
|
397 | 397 | wp_die(); |
398 | 398 | } |
399 | 399 | |
@@ -401,4 +401,4 @@ discard block |
||
401 | 401 | |
402 | 402 | } |
403 | 403 | |
404 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
404 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,94 +28,94 @@ discard block |
||
28 | 28 | |
29 | 29 | global $give_options; |
30 | 30 | |
31 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
32 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
33 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
31 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
32 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
33 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
34 | 34 | |
35 | 35 | // Use minified libraries if SCRIPT_DEBUG is turned off |
36 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
36 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
37 | 37 | |
38 | 38 | //Localize / PHP to AJAX vars |
39 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
39 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
40 | 40 | 'ajaxurl' => give_get_ajax_url(), |
41 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
42 | - 'currency_sign' => give_currency_filter( '' ), |
|
41 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
42 | + 'currency_sign' => give_currency_filter(''), |
|
43 | 43 | 'currency_pos' => give_get_currency_position(), |
44 | - 'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',', |
|
45 | - 'decimal_separator' => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.', |
|
46 | - 'no_gateway' => __( 'Please select a payment method', 'give' ), |
|
47 | - 'bad_minimum' => __( 'The minimum donation amount for this form is', 'give' ), |
|
48 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
49 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
50 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ), |
|
44 | + 'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',', |
|
45 | + 'decimal_separator' => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.', |
|
46 | + 'no_gateway' => __('Please select a payment method', 'give'), |
|
47 | + 'bad_minimum' => __('The minimum donation amount for this form is', 'give'), |
|
48 | + 'general_loading' => __('Loading...', 'give'), |
|
49 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
50 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2), |
|
51 | 51 | 'give_version' => GIVE_VERSION |
52 | - ) ); |
|
53 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
52 | + )); |
|
53 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
54 | 54 | 'ajaxurl' => give_get_ajax_url(), |
55 | - 'loading' => __( 'Loading', 'give' ), |
|
55 | + 'loading' => __('Loading', 'give'), |
|
56 | 56 | // General loading message |
57 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
57 | + 'select_option' => __('Please select an option', 'give'), |
|
58 | 58 | // Variable pricing error with multi-purchase option enabled |
59 | - 'default_gateway' => give_get_default_gateway( null ), |
|
60 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
61 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ) |
|
62 | - ) ); |
|
59 | + 'default_gateway' => give_get_default_gateway(null), |
|
60 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
61 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2) |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | //DEBUG is On |
65 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
65 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
66 | 66 | |
67 | - if ( give_is_cc_verify_enabled() ) { |
|
68 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
69 | - wp_enqueue_script( 'give-cc-validator' ); |
|
67 | + if (give_is_cc_verify_enabled()) { |
|
68 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
69 | + wp_enqueue_script('give-cc-validator'); |
|
70 | 70 | } |
71 | 71 | |
72 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
73 | - wp_enqueue_script( 'give-float-labels' ); |
|
72 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
73 | + wp_enqueue_script('give-float-labels'); |
|
74 | 74 | |
75 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
76 | - wp_enqueue_script( 'give-blockui' ); |
|
75 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
76 | + wp_enqueue_script('give-blockui'); |
|
77 | 77 | |
78 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
79 | - wp_enqueue_script( 'give-qtip' ); |
|
78 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
79 | + wp_enqueue_script('give-qtip'); |
|
80 | 80 | |
81 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
82 | - wp_enqueue_script( 'give-accounting' ); |
|
81 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
82 | + wp_enqueue_script('give-accounting'); |
|
83 | 83 | |
84 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
85 | - wp_enqueue_script( 'give-magnific' ); |
|
84 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
85 | + wp_enqueue_script('give-magnific'); |
|
86 | 86 | |
87 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-checkout-global' ); |
|
87 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-checkout-global'); |
|
89 | 89 | |
90 | 90 | //General scripts |
91 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-scripts' ); |
|
91 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-scripts'); |
|
93 | 93 | |
94 | 94 | // Load AJAX scripts, if enabled |
95 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
96 | - wp_enqueue_script( 'give-ajax' ); |
|
95 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
96 | + wp_enqueue_script('give-ajax'); |
|
97 | 97 | |
98 | 98 | //Localize / Pass AJAX vars from PHP |
99 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
100 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
99 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
100 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | 105 | //DEBUG is OFF (one JS file to rule them all!) |
106 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give' ); |
|
106 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give'); |
|
108 | 108 | |
109 | 109 | //Localize / Pass AJAX vars from PHP |
110 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
111 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
110 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
111 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
118 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Register Styles |
@@ -127,47 +127,47 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_register_styles() { |
129 | 129 | |
130 | - if ( give_get_option( 'disable_css', false ) ) { |
|
130 | + if (give_get_option('disable_css', false)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Use minified libraries if SCRIPT_DEBUG is turned off |
135 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
135 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
136 | 136 | |
137 | - $file = 'give' . $suffix . '.css'; |
|
137 | + $file = 'give'.$suffix.'.css'; |
|
138 | 138 | $templates_dir = give_get_theme_template_dir_name(); |
139 | 139 | |
140 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
141 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
142 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
143 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
144 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
140 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
141 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
142 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
143 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
144 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
145 | 145 | |
146 | 146 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
147 | 147 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
148 | 148 | // This allows users to copy just give.css to their theme |
149 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
150 | - if ( ! empty( $nonmin ) ) { |
|
151 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
149 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
150 | + if ( ! empty($nonmin)) { |
|
151 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
152 | 152 | } else { |
153 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
153 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
154 | 154 | } |
155 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
156 | - if ( ! empty( $nonmin ) ) { |
|
157 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
155 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
156 | + if ( ! empty($nonmin)) { |
|
157 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
158 | 158 | } else { |
159 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
159 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
160 | 160 | } |
161 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
162 | - $url = trailingslashit( give_get_templates_url() ) . $file; |
|
161 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
162 | + $url = trailingslashit(give_get_templates_url()).$file; |
|
163 | 163 | } |
164 | 164 | |
165 | - wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' ); |
|
166 | - wp_enqueue_style( 'give-styles' ); |
|
165 | + wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all'); |
|
166 | + wp_enqueue_style('give-styles'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
170 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Load Admin Scripts |
@@ -181,103 +181,103 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return void |
183 | 183 | */ |
184 | -function give_load_admin_scripts( $hook ) { |
|
184 | +function give_load_admin_scripts($hook) { |
|
185 | 185 | |
186 | 186 | global $wp_version, $post, $post_type; |
187 | 187 | |
188 | 188 | //Directories of assets |
189 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
190 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
191 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
189 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
190 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
191 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
192 | 192 | |
193 | 193 | // Use minified libraries if SCRIPT_DEBUG is turned off |
194 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
194 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
195 | 195 | |
196 | 196 | //Global Admin: |
197 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
198 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
197 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
198 | + wp_enqueue_style('give-admin-bar-notification'); |
|
199 | 199 | |
200 | 200 | //Give Admin Only: |
201 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
201 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | 205 | //CSS |
206 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
207 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
208 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
209 | - wp_enqueue_style( 'give-admin' ); |
|
210 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
211 | - wp_enqueue_style( 'jquery-chosen' ); |
|
212 | - wp_enqueue_style( 'thickbox' ); |
|
206 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
207 | + wp_enqueue_style('jquery-ui-css'); |
|
208 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
209 | + wp_enqueue_style('give-admin'); |
|
210 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
211 | + wp_enqueue_style('jquery-chosen'); |
|
212 | + wp_enqueue_style('thickbox'); |
|
213 | 213 | |
214 | 214 | //JS |
215 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
216 | - wp_enqueue_script( 'jquery-chosen' ); |
|
215 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
216 | + wp_enqueue_script('jquery-chosen'); |
|
217 | 217 | |
218 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
219 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
218 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
219 | + wp_enqueue_script('give-admin-scripts'); |
|
220 | 220 | |
221 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
222 | - wp_enqueue_script( 'jquery-flot' ); |
|
221 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
222 | + wp_enqueue_script('jquery-flot'); |
|
223 | 223 | |
224 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
225 | - wp_enqueue_script( 'give-qtip' ); |
|
224 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
225 | + wp_enqueue_script('give-qtip'); |
|
226 | 226 | |
227 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
228 | - wp_enqueue_script( 'thickbox' ); |
|
227 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
228 | + wp_enqueue_script('thickbox'); |
|
229 | 229 | |
230 | 230 | //Forms CPT Script |
231 | - if ( $post_type === 'give_forms' ) { |
|
232 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
233 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
231 | + if ($post_type === 'give_forms') { |
|
232 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
233 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | //Settings Scripts |
237 | - if (isset($_GET['page']) && $_GET['page'] == 'give-settings' ) { |
|
237 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
238 | 238 | wp_enqueue_script('jquery-ui-sortable'); |
239 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
240 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
239 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
240 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //Localize strings & variables for JS |
244 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
245 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
244 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
245 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
246 | 246 | 'give_version' => GIVE_VERSION, |
247 | - 'quick_edit_warning' => __( 'Sorry, not available for variable priced forms.', 'give' ), |
|
248 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
249 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
250 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
251 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
252 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
253 | - 'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor', 'give' ), |
|
254 | - 'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
255 | - 'one_price_min' => __( 'You must have at least one price', 'give' ), |
|
256 | - 'one_file_min' => __( 'You must have at least one file', 'give' ), |
|
257 | - 'one_field_min' => __( 'You must have at least one field', 'give' ), |
|
258 | - 'one_option' => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
259 | - 'one_or_more_option' => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
260 | - 'numeric_item_price' => __( 'Item price must be numeric', 'give' ), |
|
261 | - 'numeric_quantity' => __( 'Quantity must be numeric', 'give' ), |
|
262 | - 'currency_sign' => give_currency_filter( '' ), |
|
263 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
247 | + 'quick_edit_warning' => __('Sorry, not available for variable priced forms.', 'give'), |
|
248 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
249 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
250 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
251 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
252 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
253 | + 'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor', 'give'), |
|
254 | + 'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
255 | + 'one_price_min' => __('You must have at least one price', 'give'), |
|
256 | + 'one_file_min' => __('You must have at least one file', 'give'), |
|
257 | + 'one_field_min' => __('You must have at least one field', 'give'), |
|
258 | + 'one_option' => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
259 | + 'one_or_more_option' => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
260 | + 'numeric_item_price' => __('Item price must be numeric', 'give'), |
|
261 | + 'numeric_quantity' => __('Quantity must be numeric', 'give'), |
|
262 | + 'currency_sign' => give_currency_filter(''), |
|
263 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
264 | 264 | 'currency_decimals' => give_currency_decimal_filter(), |
265 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
266 | - 'remove_text' => __( 'Remove', 'give' ), |
|
267 | - 'type_to_search' => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
268 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
269 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
270 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
271 | - ) ); |
|
272 | - |
|
273 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
265 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
266 | + 'remove_text' => __('Remove', 'give'), |
|
267 | + 'type_to_search' => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
268 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
269 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
270 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
271 | + )); |
|
272 | + |
|
273 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
274 | 274 | //call for new media manager |
275 | 275 | wp_enqueue_media(); |
276 | 276 | } |
277 | 277 | |
278 | 278 | } |
279 | 279 | |
280 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
280 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Admin Give Icon |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | ?> |
295 | 295 | <style type="text/css" media="screen"> |
296 | 296 | |
297 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
297 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
298 | 298 | @font-face { |
299 | 299 | font-family: 'give-icomoon'; |
300 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
301 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
302 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
303 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
304 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
300 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
301 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
302 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
303 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
304 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
305 | 305 | font-weight: normal; |
306 | 306 | font-style: normal; |
307 | 307 | } |
@@ -320,4 +320,4 @@ discard block |
||
320 | 320 | <?php |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
323 | +add_action('admin_head', 'give_admin_icon'); |
@@ -10,11 +10,11 @@ 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 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,324 +48,324 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => __( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => __('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => __( 'Donation Option', 'give' ), |
|
61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => __('Donation Option', 'give'), |
|
61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => __( 'Set Donation', 'give' ), |
|
67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => __('Set Donation', 'give'), |
|
67 | + 'multi' => __('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => __( 'Set Donation', 'give' ), |
|
72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => __('Set Donation', 'give'), |
|
72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
80 | - 'value' => give_format_amount( $price ), |
|
79 | + 'placeholder' => give_format_amount('1.00'), |
|
80 | + 'value' => give_format_amount($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
95 | + 'add_button' => __('Add Level', 'give'), |
|
96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => __( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => __('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => __( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => __('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'attributes' => array( |
113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
113 | + 'placeholder' => give_format_amount('1.00'), |
|
114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
115 | 115 | ), |
116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
117 | 117 | ), |
118 | 118 | array( |
119 | - 'name' => __( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => __('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => __('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => __( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => __('Default', 'give'), |
|
129 | + 'id' => $prefix.'default', |
|
130 | 130 | 'type' => 'give_default_radio_inline' |
131 | 131 | ), |
132 | - ) ), |
|
132 | + )), |
|
133 | 133 | ), |
134 | 134 | //Display Style |
135 | 135 | array( |
136 | - 'name' => __( 'Display Style', 'give' ), |
|
137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => __('Display Style', 'give'), |
|
137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
138 | + 'id' => $prefix.'display_style', |
|
139 | 139 | 'type' => 'radio_inline', |
140 | 140 | 'default' => 'buttons', |
141 | 141 | 'options' => array( |
142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
143 | - 'radios' => __( 'Radios', 'give' ), |
|
144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => __('Buttons', 'give'), |
|
143 | + 'radios' => __('Radios', 'give'), |
|
144 | + 'dropdown' => __('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => __('Custom Amount', 'give'), |
|
150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
151 | + 'id' => $prefix.'custom_amount', |
|
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'no', |
154 | 154 | 'options' => array( |
155 | - 'yes' => __( 'Yes', 'give' ), |
|
156 | - 'no' => __( 'No', 'give' ), |
|
155 | + 'yes' => __('Yes', 'give'), |
|
156 | + 'no' => __('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => __('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
162 | + 'id' => $prefix.'custom_amount_minimum', |
|
163 | 163 | 'type' => 'text_small', |
164 | 164 | 'row_classes' => 'give-subfield', |
165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_amount('1.00'), |
|
169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'row_classes' => 'give-subfield', |
179 | 179 | 'attributes' => array( |
180 | 180 | 'rows' => 3, |
181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => __( 'Goal', 'give' ), |
|
187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => __('Goal', 'give'), |
|
187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
188 | + 'id' => $prefix.'goal_option', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => 'no', |
191 | 191 | 'options' => array( |
192 | - 'yes' => __( 'Yes', 'give' ), |
|
193 | - 'no' => __( 'No', 'give' ), |
|
192 | + 'yes' => __('Yes', 'give'), |
|
193 | + 'no' => __('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Goal Amount', 'give' ), |
|
198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => __('Goal Amount', 'give'), |
|
198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
199 | + 'id' => $prefix.'set_goal', |
|
200 | 200 | 'type' => 'text_small', |
201 | 201 | 'row_classes' => 'give-subfield', |
202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
204 | 204 | 'attributes' => array( |
205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
205 | + 'placeholder' => give_format_amount('0.00'), |
|
206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | |
211 | 211 | array( |
212 | - 'name' => __( 'Goal Format', 'give' ), |
|
213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
214 | - 'id' => $prefix . 'goal_format', |
|
212 | + 'name' => __('Goal Format', 'give'), |
|
213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
214 | + 'id' => $prefix.'goal_format', |
|
215 | 215 | 'type' => 'radio_inline', |
216 | 216 | 'default' => 'amount', |
217 | 217 | 'row_classes' => 'give-subfield', |
218 | 218 | 'options' => array( |
219 | - 'amount' => __( 'Amount ', 'give' ), |
|
220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
219 | + 'amount' => __('Amount ', 'give'), |
|
220 | + 'percentage' => __('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
225 | + 'id' => $prefix.'goal_color', |
|
226 | 226 | 'type' => 'colorpicker', |
227 | 227 | 'row_classes' => 'give-subfield', |
228 | 228 | 'default' => '#2bc253', |
229 | 229 | ), |
230 | 230 | ) |
231 | 231 | ) |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Content Field |
237 | 237 | */ |
238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
239 | 239 | 'id' => 'form_content_options', |
240 | - 'title' => __( 'Form Content', 'give' ), |
|
241 | - 'object_types' => array( 'give_forms' ), |
|
240 | + 'title' => __('Form Content', 'give'), |
|
241 | + 'object_types' => array('give_forms'), |
|
242 | 242 | 'context' => 'normal', |
243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
245 | 245 | //Donation Option |
246 | 246 | array( |
247 | - 'name' => __( 'Display Content', 'give' ), |
|
248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
249 | - 'id' => $prefix . 'content_option', |
|
247 | + 'name' => __('Display Content', 'give'), |
|
248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
249 | + 'id' => $prefix.'content_option', |
|
250 | 250 | 'type' => 'select', |
251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
252 | - 'none' => __( 'No content', 'give' ), |
|
253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
251 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
252 | + 'none' => __('No content', 'give'), |
|
253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
255 | 255 | ) |
256 | 256 | ), |
257 | 257 | 'default' => 'none', |
258 | 258 | ), |
259 | 259 | array( |
260 | - 'name' => __( 'Content', 'give' ), |
|
261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
262 | - 'id' => $prefix . 'form_content', |
|
260 | + 'name' => __('Content', 'give'), |
|
261 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
262 | + 'id' => $prefix.'form_content', |
|
263 | 263 | 'row_classes' => 'give-subfield', |
264 | 264 | 'type' => 'wysiwyg' |
265 | 265 | ), |
266 | 266 | ) |
267 | 267 | ) |
268 | - ) ); |
|
268 | + )); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Display Options |
273 | 273 | */ |
274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
275 | 275 | 'id' => 'form_display_options', |
276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
277 | - 'object_types' => array( 'give_forms' ), |
|
276 | + 'title' => __('Form Display Options', 'give'), |
|
277 | + 'object_types' => array('give_forms'), |
|
278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
280 | 280 | 'show_names' => true, // Show field names on the left |
281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
282 | 282 | array( |
283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
285 | - 'id' => $prefix . 'payment_display', |
|
283 | + 'name' => __('Payment Fields', 'give'), |
|
284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
285 | + 'id' => $prefix.'payment_display', |
|
286 | 286 | 'type' => 'select', |
287 | 287 | 'options' => array( |
288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
288 | + 'onpage' => __('Show on Page', 'give'), |
|
289 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
290 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
291 | 291 | ), |
292 | 292 | 'default' => 'onpage', |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'reveal_label', |
|
296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
295 | + 'id' => $prefix.'reveal_label', |
|
296 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
297 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
298 | 298 | 'type' => 'text_small', |
299 | 299 | 'row_classes' => 'give-subfield', |
300 | 300 | 'attributes' => array( |
301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
301 | + 'placeholder' => __('Donate Now', 'give'), |
|
302 | 302 | ), |
303 | 303 | ), |
304 | 304 | array( |
305 | - 'id' => $prefix . 'checkout_label', |
|
306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
305 | + 'id' => $prefix.'checkout_label', |
|
306 | + 'name' => __('Complete Donation Text', 'give'), |
|
307 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
308 | 308 | 'type' => 'text_small', |
309 | 309 | 'attributes' => array( |
310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
310 | + 'placeholder' => __('Donate Now', 'give'), |
|
311 | 311 | ), |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
316 | - 'id' => $prefix . 'default_gateway', |
|
314 | + 'name' => __('Default Gateway', 'give'), |
|
315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
316 | + 'id' => $prefix.'default_gateway', |
|
317 | 317 | 'type' => 'default_gateway' |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
322 | - 'id' => $prefix . 'logged_in_only', |
|
320 | + 'name' => __('Disable Guest Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
322 | + 'id' => $prefix.'logged_in_only', |
|
323 | 323 | 'type' => 'checkbox' |
324 | 324 | ), |
325 | 325 | array( |
326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
328 | - 'id' => $prefix . 'show_register_form', |
|
326 | + 'name' => __('Register / Login Form', 'give'), |
|
327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
328 | + 'id' => $prefix.'show_register_form', |
|
329 | 329 | 'type' => 'select', |
330 | 330 | 'options' => array( |
331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
334 | - 'none' => __( 'None', 'give' ), |
|
331 | + 'both' => __('Registration and Login Forms', 'give'), |
|
332 | + 'registration' => __('Registration Form Only', 'give'), |
|
333 | + 'login' => __('Login Form Only', 'give'), |
|
334 | + 'none' => __('None', 'give'), |
|
335 | 335 | ), |
336 | 336 | 'default' => 'none', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<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/" ) ), |
|
341 | - 'id' => $prefix . 'form_floating_labels', |
|
339 | + 'name' => __('Floating Labels', 'give'), |
|
340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<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/")), |
|
341 | + 'id' => $prefix.'form_floating_labels', |
|
342 | 342 | 'type' => 'select', |
343 | 343 | 'options' => array( |
344 | - '' => __( 'Use the global setting', 'give' ), |
|
345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
344 | + '' => __('Use the global setting', 'give'), |
|
345 | + 'enabled' => __('Enabled', 'give'), |
|
346 | + 'disabled' => __('Disabled', 'give'), |
|
347 | 347 | ), |
348 | 348 | 'default' => 'none', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'Close Form when Goal Achieved', 'give' ), |
|
352 | - 'desc' => __( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
353 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
351 | + 'name' => __('Close Form when Goal Achieved', 'give'), |
|
352 | + 'desc' => __('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
353 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'yes' => __( 'Yes', 'give' ), |
|
357 | - 'no' => __( 'No', 'give' ), |
|
356 | + 'yes' => __('Yes', 'give'), |
|
357 | + 'no' => __('No', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'no', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
363 | - 'desc' => __( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
364 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
362 | + 'name' => __('Goal Achieved Message', 'give'), |
|
363 | + 'desc' => __('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
364 | + 'id' => $prefix.'form_goal_achieved_message', |
|
365 | 365 | 'type' => 'textarea', |
366 | 366 | 'row_classes' => 'give-subfield', |
367 | 367 | 'attributes' => array( |
368 | - 'placeholder' => __( 'Thank you to all our donors, we have met our goal.', 'give' ), |
|
368 | + 'placeholder' => __('Thank you to all our donors, we have met our goal.', 'give'), |
|
369 | 369 | ), |
370 | 370 | ) |
371 | 371 | ) |
@@ -376,47 +376,47 @@ discard block |
||
376 | 376 | /** |
377 | 377 | * Terms & Conditions |
378 | 378 | */ |
379 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
379 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
380 | 380 | 'id' => 'form_terms_options', |
381 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
382 | - 'object_types' => array( 'give_forms' ), |
|
381 | + 'title' => __('Terms and Conditions', 'give'), |
|
382 | + 'object_types' => array('give_forms'), |
|
383 | 383 | 'context' => 'normal', |
384 | 384 | 'priority' => 'high', //Show above Content WYSIWYG |
385 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
385 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
386 | 386 | //Donation Option |
387 | 387 | array( |
388 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
389 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
390 | - 'id' => $prefix . 'terms_option', |
|
388 | + 'name' => __('Terms and Conditions', 'give'), |
|
389 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
390 | + 'id' => $prefix.'terms_option', |
|
391 | 391 | 'type' => 'select', |
392 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
393 | - 'none' => __( 'No', 'give' ), |
|
394 | - 'yes' => __( 'Yes', 'give' ), |
|
392 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
393 | + 'none' => __('No', 'give'), |
|
394 | + 'yes' => __('Yes', 'give'), |
|
395 | 395 | ) |
396 | 396 | ), |
397 | 397 | 'default' => 'none', |
398 | 398 | ), |
399 | 399 | array( |
400 | - 'id' => $prefix . 'agree_label', |
|
401 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
402 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
400 | + 'id' => $prefix.'agree_label', |
|
401 | + 'name' => __('Agree to Terms Label', 'give'), |
|
402 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
403 | 403 | 'type' => 'text', |
404 | 404 | 'row_classes' => 'give-subfield', |
405 | 405 | 'size' => 'regular', |
406 | 406 | 'attributes' => array( |
407 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
407 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
408 | 408 | ), |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'id' => $prefix . 'agree_text', |
|
411 | + 'id' => $prefix.'agree_text', |
|
412 | 412 | 'row_classes' => 'give-subfield', |
413 | - 'name' => __( 'Agreement Text', 'give' ), |
|
414 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
413 | + 'name' => __('Agreement Text', 'give'), |
|
414 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
415 | 415 | 'type' => 'wysiwyg' |
416 | 416 | ), |
417 | 417 | ) |
418 | 418 | ) |
419 | - ) ); |
|
419 | + )); |
|
420 | 420 | |
421 | 421 | return $meta_boxes; |
422 | 422 | |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | |
431 | 431 | <div class="table-container"> |
432 | 432 | <div class="table-row"> |
433 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
434 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
435 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
436 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
437 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
433 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
434 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
435 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
436 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
437 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
438 | 438 | |
439 | 439 | </div> |
440 | 440 | </div> |
441 | 441 | |
442 | 442 | <?php |
443 | 443 | } |
444 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
444 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
445 | 445 | |
446 | 446 | |
447 | 447 | /** |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | * @param $object_type |
459 | 459 | * @param $field_type_object |
460 | 460 | */ |
461 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
461 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
462 | 462 | |
463 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
463 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
464 | 464 | |
465 | 465 | $field_options_array = array( |
466 | 466 | 'class' => 'give-hidden give-level-id-input', |
467 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
468 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
467 | + 'name' => $field_type_object->_name('[level_id]'), |
|
468 | + 'id' => $field_type_object->_id('_level_id'), |
|
469 | 469 | 'value' => $escaped_value, |
470 | 470 | 'type' => 'number', |
471 | 471 | 'desc' => '', |
472 | 472 | ); |
473 | 473 | |
474 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
475 | - echo $field_type_object->input( $field_options_array ); |
|
474 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
475 | + echo $field_type_object->input($field_options_array); |
|
476 | 476 | |
477 | 477 | } |
478 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
478 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
479 | 479 | |
480 | 480 | |
481 | 481 | /** |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | * @param $object_type |
488 | 488 | * @param $field_type_object |
489 | 489 | */ |
490 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
491 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
492 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
490 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
491 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
492 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
496 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
497 | 497 | |
498 | 498 | |
499 | 499 | /** |
@@ -503,20 +503,20 @@ discard block |
||
503 | 503 | */ |
504 | 504 | function give_add_shortcode_to_publish_metabox() { |
505 | 505 | |
506 | - if ( 'give_forms' !== get_post_type() ) { |
|
506 | + if ('give_forms' !== get_post_type()) { |
|
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | |
510 | 510 | global $post; |
511 | 511 | |
512 | 512 | //Only enqueue scripts for CPT on post type screen |
513 | - if ( 'give_forms' === $post->post_type ) { |
|
513 | + if ('give_forms' === $post->post_type) { |
|
514 | 514 | //Shortcode column with select all input |
515 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
516 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
515 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
516 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
517 | 517 | |
518 | 518 | } |
519 | 519 | |
520 | 520 | } |
521 | 521 | |
522 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
522 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |