@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | -function _give_sanitize_number_decimals_setting_field( $value ) { |
|
30 | - return absint( $value ); |
|
29 | +function _give_sanitize_number_decimals_setting_field($value) { |
|
30 | + return absint($value); |
|
31 | 31 | } |
32 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10 ); |
|
33 | 32 | \ No newline at end of file |
33 | +add_filter('give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10); |
|
34 | 34 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_add_shortcode_to_publish_metabox() { |
24 | 24 | |
25 | - if ( 'give_forms' !== get_post_type() ) { |
|
25 | + if ('give_forms' !== get_post_type()) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | global $post; |
29 | 29 | |
30 | 30 | //Only enqueue scripts for CPT on post type screen |
31 | - if ( 'give_forms' === $post->post_type ) { |
|
31 | + if ('give_forms' === $post->post_type) { |
|
32 | 32 | //Shortcode column with select all input |
33 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
34 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
33 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
34 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
40 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | // Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => esc_html__( 'Name', 'give' ), |
|
36 | - 'form_category' => esc_html__( 'Categories', 'give' ), |
|
37 | - 'form_tag' => esc_html__( 'Tags', 'give' ), |
|
38 | - 'price' => esc_html__( 'Amount', 'give' ), |
|
39 | - 'goal' => esc_html__( 'Goal', 'give' ), |
|
40 | - 'donations' => esc_html__( 'Donations', 'give' ), |
|
41 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
42 | - 'shortcode' => esc_html__( 'Shortcode', 'give' ), |
|
43 | - 'date' => esc_html__( 'Date', 'give' ), |
|
35 | + 'title' => esc_html__('Name', 'give'), |
|
36 | + 'form_category' => esc_html__('Categories', 'give'), |
|
37 | + 'form_tag' => esc_html__('Tags', 'give'), |
|
38 | + 'price' => esc_html__('Amount', 'give'), |
|
39 | + 'goal' => esc_html__('Goal', 'give'), |
|
40 | + 'donations' => esc_html__('Donations', 'give'), |
|
41 | + 'earnings' => esc_html__('Income', 'give'), |
|
42 | + 'shortcode' => esc_html__('Shortcode', 'give'), |
|
43 | + 'date' => esc_html__('Date', 'give'), |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | // Does the user want categories / tags? |
47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form_category': |
74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
75 | 75 | break; |
76 | 76 | case 'form_tag': |
77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
78 | 78 | break; |
79 | 79 | case 'price': |
80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
81 | - echo give_price_range( $post_id ); |
|
80 | + if (give_has_variable_prices($post_id)) { |
|
81 | + echo give_price_range($post_id); |
|
82 | 82 | } else { |
83 | - echo give_price( $post_id, false ); |
|
84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
83 | + echo give_price($post_id, false); |
|
84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case 'goal': |
88 | - if ( give_is_setting_enabled( get_post_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
89 | - echo give_goal( $post_id, false ); |
|
88 | + if (give_is_setting_enabled(get_post_meta($post_id, '_give_goal_option', true))) { |
|
89 | + echo give_goal($post_id, false); |
|
90 | 90 | } else { |
91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
91 | + esc_html_e('No Goal Set', 'give'); |
|
92 | 92 | } |
93 | 93 | |
94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
95 | 95 | break; |
96 | 96 | case 'donations': |
97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">'; |
|
99 | - echo give_get_form_sales_stats( $post_id ); |
|
97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">'; |
|
99 | + echo give_get_form_sales_stats($post_id); |
|
100 | 100 | echo '</a>'; |
101 | 101 | } else { |
102 | 102 | echo '-'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'earnings': |
106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">'; |
|
108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">'; |
|
108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
109 | 109 | echo '</a>'; |
110 | 110 | } else { |
111 | 111 | echo '-'; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'shortcode': |
115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return array $columns Array of sortable columns |
131 | 131 | */ |
132 | -function give_sortable_form_columns( $columns ) { |
|
132 | +function give_sortable_form_columns($columns) { |
|
133 | 133 | $columns['price'] = 'amount'; |
134 | 134 | $columns['sales'] = 'sales'; |
135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $columns; |
140 | 140 | } |
141 | 141 | |
142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return array $vars Array of all the sort variables |
152 | 152 | */ |
153 | -function give_sort_forms( $vars ) { |
|
153 | +function give_sort_forms($vars) { |
|
154 | 154 | // Check if we're viewing the "give_forms" post type |
155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
156 | 156 | return $vars; |
157 | 157 | } |
158 | 158 | |
159 | - switch ( $vars['orderby'] ) { |
|
159 | + switch ($vars['orderby']) { |
|
160 | 160 | // Check if 'orderby' is set to "sales" |
161 | 161 | case 'sales': |
162 | 162 | $vars = array_merge( |
@@ -225,16 +225,16 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return array Array of all sort variables |
227 | 227 | */ |
228 | -function give_filter_forms( $vars ) { |
|
229 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
228 | +function give_filter_forms($vars) { |
|
229 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
230 | 230 | |
231 | 231 | // If an author ID was passed, use it |
232 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
232 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
233 | 233 | |
234 | 234 | $author_id = $_REQUEST['author']; |
235 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
235 | + if ((int) $author_id !== get_current_user_id()) { |
|
236 | 236 | // Tried to view the products of another person, sorry |
237 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
237 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
238 | 238 | } |
239 | 239 | $vars = array_merge( |
240 | 240 | $vars, |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | * @return void |
259 | 259 | */ |
260 | 260 | function give_forms_load() { |
261 | - add_filter( 'request', 'give_sort_forms' ); |
|
262 | - add_filter( 'request', 'give_filter_forms' ); |
|
261 | + add_filter('request', 'give_sort_forms'); |
|
262 | + add_filter('request', 'give_filter_forms'); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
265 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Remove Forms Month Filter |
@@ -276,17 +276,17 @@ discard block |
||
276 | 276 | * @global $typenow The post type we are viewing |
277 | 277 | * @return array Empty array disables the dropdown |
278 | 278 | */ |
279 | -function give_remove_month_filter( $dates ) { |
|
279 | +function give_remove_month_filter($dates) { |
|
280 | 280 | global $typenow; |
281 | 281 | |
282 | - if ( $typenow == 'give_forms' ) { |
|
282 | + if ($typenow == 'give_forms') { |
|
283 | 283 | $dates = array(); |
284 | 284 | } |
285 | 285 | |
286 | 286 | return $dates; |
287 | 287 | } |
288 | 288 | |
289 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
289 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Updates price when saving post |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return int|null |
299 | 299 | */ |
300 | -function give_price_save_quick_edit( $post_id ) { |
|
301 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
300 | +function give_price_save_quick_edit($post_id) { |
|
301 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
302 | 302 | return; |
303 | 303 | } |
304 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
304 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
305 | 305 | return $post_id; |
306 | 306 | } |
307 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
307 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
308 | 308 | return $post_id; |
309 | 309 | } |
310 | 310 | |
311 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
312 | - update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
311 | + if (isset($_REQUEST['_give_regprice'])) { |
|
312 | + update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
316 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Process bulk edit actions via AJAX |
@@ -323,18 +323,18 @@ discard block |
||
323 | 323 | */ |
324 | 324 | function give_save_bulk_edit() { |
325 | 325 | |
326 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
326 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
327 | 327 | |
328 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
329 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
330 | - foreach ( $post_ids as $post_id ) { |
|
328 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
329 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
330 | + foreach ($post_ids as $post_id) { |
|
331 | 331 | |
332 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
332 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | |
336 | - if ( ! empty( $price ) ) { |
|
337 | - update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
336 | + if ( ! empty($price)) { |
|
337 | + update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
@@ -342,4 +342,4 @@ discard block |
||
342 | 342 | die(); |
343 | 343 | } |
344 | 344 | |
345 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
345 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults. |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | - 'ajax' => false, // Does this table support ajax? |
|
125 | - ) ); |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | + 'ajax' => false, // Does this table support ajax? |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public function advanced_filters() { |
138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
141 | 141 | ?> |
142 | 142 | <div id="give-payment-filters"> |
143 | 143 | <span id="give-payment-date-filters"> |
144 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
144 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
145 | 145 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
146 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
146 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
147 | 147 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
148 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
148 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
149 | 149 | </span> |
150 | - <?php if ( ! empty( $status ) ) : ?> |
|
151 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
150 | + <?php if ( ! empty($status)) : ?> |
|
151 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
152 | 152 | <?php endif; ?> |
153 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
154 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
153 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
154 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
155 | 155 | <?php endif; ?> |
156 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
156 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
157 | 157 | </div> |
158 | 158 | |
159 | 159 | <?php |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - public function search_box( $text, $input_id ) { |
|
174 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
173 | + public function search_box($text, $input_id) { |
|
174 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | 177 | |
178 | - $input_id = $input_id . '-search-input'; |
|
178 | + $input_id = $input_id.'-search-input'; |
|
179 | 179 | |
180 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
181 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
180 | + if ( ! empty($_REQUEST['orderby'])) { |
|
181 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
182 | 182 | } |
183 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
184 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
183 | + if ( ! empty($_REQUEST['order'])) { |
|
184 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | <p class="search-box" role="search"> |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 1.7 |
195 | 195 | */ |
196 | - do_action( 'give_payment_history_search' ); |
|
196 | + do_action('give_payment_history_search'); |
|
197 | 197 | ?> |
198 | 198 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
199 | 199 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
200 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
200 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
201 | 201 | </p> |
202 | 202 | <?php |
203 | 203 | } |
@@ -211,52 +211,52 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function get_views() { |
213 | 213 | |
214 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
215 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
216 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
217 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
218 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
219 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
220 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
221 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
222 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
214 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
215 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
216 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
217 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
218 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
219 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
220 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
221 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
222 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
223 | 223 | |
224 | 224 | $views = array( |
225 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
225 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
226 | 226 | 'status', |
227 | 227 | 'paged', |
228 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
229 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
228 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
229 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
230 | 230 | 'status' => 'publish', |
231 | 231 | 'paged' => false, |
232 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
233 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
232 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
233 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
234 | 234 | 'status' => 'pending', |
235 | 235 | 'paged' => false, |
236 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
237 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
236 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
237 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
238 | 238 | 'status' => 'refunded', |
239 | 239 | 'paged' => false, |
240 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
241 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
240 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
241 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
242 | 242 | 'status' => 'revoked', |
243 | 243 | 'paged' => false, |
244 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
245 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
244 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
245 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
246 | 246 | 'status' => 'failed', |
247 | 247 | 'paged' => false, |
248 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
249 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
248 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
249 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
250 | 250 | 'status' => 'cancelled', |
251 | 251 | 'paged' => false, |
252 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
253 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
252 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
253 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
254 | 254 | 'status' => 'abandoned', |
255 | 255 | 'paged' => false, |
256 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
256 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
257 | 257 | ); |
258 | 258 | |
259 | - return apply_filters( 'give_payments_table_views', $views ); |
|
259 | + return apply_filters('give_payments_table_views', $views); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -269,15 +269,15 @@ discard block |
||
269 | 269 | public function get_columns() { |
270 | 270 | $columns = array( |
271 | 271 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
272 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
273 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
274 | - 'status' => esc_html__( 'Status', 'give' ), |
|
275 | - 'date' => esc_html__( 'Date', 'give' ), |
|
276 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
277 | - 'details' => esc_html__( 'Details', 'give' ), |
|
272 | + 'donation' => esc_html__('Donation', 'give'), |
|
273 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
274 | + 'status' => esc_html__('Status', 'give'), |
|
275 | + 'date' => esc_html__('Date', 'give'), |
|
276 | + 'amount' => esc_html__('Amount', 'give'), |
|
277 | + 'details' => esc_html__('Details', 'give'), |
|
278 | 278 | ); |
279 | 279 | |
280 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
280 | + return apply_filters('give_payments_table_columns', $columns); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function get_sortable_columns() { |
291 | 291 | $columns = array( |
292 | - 'donation' => array( 'ID', true ), |
|
293 | - 'donation_form' => array( 'donation_form', false ), |
|
294 | - 'status' => array( 'status', false ), |
|
295 | - 'amount' => array( 'amount', false ), |
|
296 | - 'date' => array( 'date', false ), |
|
292 | + 'donation' => array('ID', true), |
|
293 | + 'donation_form' => array('donation_form', false), |
|
294 | + 'status' => array('status', false), |
|
295 | + 'amount' => array('amount', false), |
|
296 | + 'date' => array('date', false), |
|
297 | 297 | ); |
298 | 298 | |
299 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
299 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -322,65 +322,65 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return string Column Name |
324 | 324 | */ |
325 | - public function column_default( $payment, $column_name ) { |
|
325 | + public function column_default($payment, $column_name) { |
|
326 | 326 | |
327 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
328 | - $row_actions = $this->get_row_actions( $payment ); |
|
327 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
328 | + $row_actions = $this->get_row_actions($payment); |
|
329 | 329 | |
330 | - switch ( $column_name ) { |
|
330 | + switch ($column_name) { |
|
331 | 331 | case 'donation' : |
332 | 332 | $value = sprintf( |
333 | 333 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
334 | 334 | $single_donation_url, |
335 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ), |
|
335 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID), |
|
336 | 336 | $payment->ID, |
337 | - esc_html__( 'by', 'give' ), |
|
338 | - $this->get_donor( $payment ) |
|
337 | + esc_html__('by', 'give'), |
|
338 | + $this->get_donor($payment) |
|
339 | 339 | ); |
340 | - $value .= $this->get_donor_email( $payment ); |
|
341 | - $value .= $this->row_actions( $row_actions ); |
|
340 | + $value .= $this->get_donor_email($payment); |
|
341 | + $value .= $this->row_actions($row_actions); |
|
342 | 342 | break; |
343 | 343 | |
344 | 344 | case 'amount' : |
345 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
346 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
345 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
346 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
347 | 347 | break; |
348 | 348 | |
349 | 349 | case 'donation_form' : |
350 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
351 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
352 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
350 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
351 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
352 | + $level = give_get_payment_form_title($payment->meta, true); |
|
353 | 353 | |
354 | - if ( ! empty( $level ) ) { |
|
354 | + if ( ! empty($level)) { |
|
355 | 355 | $value .= $level; |
356 | 356 | } |
357 | 357 | |
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'date' : |
361 | - $date = strtotime( $payment->date ); |
|
362 | - $value = date_i18n( give_date_format(), $date ); |
|
361 | + $date = strtotime($payment->date); |
|
362 | + $value = date_i18n(give_date_format(), $date); |
|
363 | 363 | break; |
364 | 364 | |
365 | 365 | case 'status' : |
366 | - $value = $this->get_payment_status( $payment ); |
|
366 | + $value = $this->get_payment_status($payment); |
|
367 | 367 | break; |
368 | 368 | |
369 | 369 | case 'details' : |
370 | 370 | $value = sprintf( |
371 | 371 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
372 | 372 | $single_donation_url, |
373 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ) |
|
373 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID) |
|
374 | 374 | ); |
375 | 375 | break; |
376 | 376 | |
377 | 377 | default: |
378 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
378 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
379 | 379 | break; |
380 | 380 | |
381 | 381 | } |
382 | 382 | |
383 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
383 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return string Data shown in the Email column |
395 | 395 | */ |
396 | - public function get_donor_email( $payment ) { |
|
396 | + public function get_donor_email($payment) { |
|
397 | 397 | |
398 | - $email = give_get_payment_user_email( $payment->ID ); |
|
398 | + $email = give_get_payment_user_email($payment->ID); |
|
399 | 399 | |
400 | - if ( empty( $email ) ) { |
|
401 | - $email = esc_html__( '(unknown)', 'give' ); |
|
400 | + if (empty($email)) { |
|
401 | + $email = esc_html__('(unknown)', 'give'); |
|
402 | 402 | } |
403 | 403 | |
404 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
404 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
405 | 405 | |
406 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
406 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @return mixed|void |
417 | 417 | */ |
418 | - function get_row_actions( $payment ) { |
|
418 | + function get_row_actions($payment) { |
|
419 | 419 | |
420 | 420 | $actions = array(); |
421 | - $email = give_get_payment_user_email( $payment->ID ); |
|
421 | + $email = give_get_payment_user_email($payment->ID); |
|
422 | 422 | |
423 | 423 | // Add search term string back to base URL. |
424 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
425 | - if ( ! empty( $search_terms ) ) { |
|
426 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
424 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
425 | + if ( ! empty($search_terms)) { |
|
426 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
427 | 427 | } |
428 | 428 | |
429 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
429 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
430 | 430 | |
431 | 431 | $actions['email_links'] = sprintf( |
432 | 432 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | ), |
441 | 441 | 'give_payment_nonce' |
442 | 442 | ), |
443 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
444 | - esc_html__( 'Resend Receipt', 'give' ) |
|
443 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
444 | + esc_html__('Resend Receipt', 'give') |
|
445 | 445 | ); |
446 | 446 | |
447 | 447 | } |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | ), |
459 | 459 | 'give_donation_nonce' |
460 | 460 | ), |
461 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
462 | - esc_html__( 'Delete', 'give' ) |
|
461 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
462 | + esc_html__('Delete', 'give') |
|
463 | 463 | ); |
464 | 464 | |
465 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
465 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -476,10 +476,10 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @return string Data shown in the Email column |
478 | 478 | */ |
479 | - function get_payment_status( $payment ) { |
|
480 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
481 | - if ( $payment->mode == 'test' ) { |
|
482 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
479 | + function get_payment_status($payment) { |
|
480 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
481 | + if ($payment->mode == 'test') { |
|
482 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | return $value; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return string Displays a checkbox. |
497 | 497 | */ |
498 | - public function column_cb( $payment ) { |
|
498 | + public function column_cb($payment) { |
|
499 | 499 | return sprintf( |
500 | 500 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
501 | 501 | 'payment', |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @return string Displays a checkbox. |
515 | 515 | */ |
516 | - public function get_payment_id( $payment ) { |
|
517 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
516 | + public function get_payment_id($payment) { |
|
517 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,19 +527,19 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return string Data shown in the User column |
529 | 529 | */ |
530 | - public function get_donor( $payment ) { |
|
530 | + public function get_donor($payment) { |
|
531 | 531 | |
532 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
532 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
533 | 533 | |
534 | - if ( ! empty( $customer_id ) ) { |
|
535 | - $customer = new Give_Customer( $customer_id ); |
|
536 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
534 | + if ( ! empty($customer_id)) { |
|
535 | + $customer = new Give_Customer($customer_id); |
|
536 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
537 | 537 | } else { |
538 | - $email = give_get_payment_user_email( $payment->ID ); |
|
539 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
538 | + $email = give_get_payment_user_email($payment->ID); |
|
539 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
540 | 540 | } |
541 | 541 | |
542 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
542 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -551,18 +551,18 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_bulk_actions() { |
553 | 553 | $actions = array( |
554 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
555 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
556 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
557 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
558 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
559 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
560 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
561 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
562 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
554 | + 'delete' => esc_html__('Delete', 'give'), |
|
555 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
556 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
557 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
558 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
559 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
560 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
561 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
562 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
563 | 563 | ); |
564 | 564 | |
565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,59 +573,59 @@ discard block |
||
573 | 573 | * @return void |
574 | 574 | */ |
575 | 575 | public function process_bulk_action() { |
576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
577 | 577 | $action = $this->current_action(); |
578 | 578 | |
579 | - if ( ! is_array( $ids ) ) { |
|
580 | - $ids = array( $ids ); |
|
579 | + if ( ! is_array($ids)) { |
|
580 | + $ids = array($ids); |
|
581 | 581 | } |
582 | 582 | |
583 | - if ( empty( $action ) ) { |
|
583 | + if (empty($action)) { |
|
584 | 584 | return; |
585 | 585 | } |
586 | 586 | |
587 | - foreach ( $ids as $id ) { |
|
587 | + foreach ($ids as $id) { |
|
588 | 588 | |
589 | 589 | // Detect when a bulk action is being triggered. |
590 | - switch ( $this->current_action() ) { |
|
590 | + switch ($this->current_action()) { |
|
591 | 591 | |
592 | 592 | case'delete': |
593 | - give_delete_purchase( $id ); |
|
593 | + give_delete_purchase($id); |
|
594 | 594 | break; |
595 | 595 | |
596 | 596 | case 'set-status-publish': |
597 | - give_update_payment_status( $id, 'publish' ); |
|
597 | + give_update_payment_status($id, 'publish'); |
|
598 | 598 | break; |
599 | 599 | |
600 | 600 | case 'set-status-pending': |
601 | - give_update_payment_status( $id, 'pending' ); |
|
601 | + give_update_payment_status($id, 'pending'); |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'set-status-refunded': |
605 | - give_update_payment_status( $id, 'refunded' ); |
|
605 | + give_update_payment_status($id, 'refunded'); |
|
606 | 606 | break; |
607 | 607 | case 'set-status-revoked': |
608 | - give_update_payment_status( $id, 'revoked' ); |
|
608 | + give_update_payment_status($id, 'revoked'); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | case 'set-status-failed': |
612 | - give_update_payment_status( $id, 'failed' ); |
|
612 | + give_update_payment_status($id, 'failed'); |
|
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'set-status-cancelled': |
616 | - give_update_payment_status( $id, 'cancelled' ); |
|
616 | + give_update_payment_status($id, 'cancelled'); |
|
617 | 617 | break; |
618 | 618 | |
619 | 619 | case 'set-status-abandoned': |
620 | - give_update_payment_status( $id, 'abandoned' ); |
|
620 | + give_update_payment_status($id, 'abandoned'); |
|
621 | 621 | break; |
622 | 622 | |
623 | 623 | case 'set-status-preapproval': |
624 | - give_update_payment_status( $id, 'preapproval' ); |
|
624 | + give_update_payment_status($id, 'preapproval'); |
|
625 | 625 | break; |
626 | 626 | |
627 | 627 | case 'resend-receipt': |
628 | - give_email_donation_receipt( $id, false ); |
|
628 | + give_email_donation_receipt($id, false); |
|
629 | 629 | break; |
630 | 630 | } |
631 | 631 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @param int $id The ID of the payment. |
638 | 638 | * @param string $current_action The action that is being triggered. |
639 | 639 | */ |
640 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
640 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | } |
@@ -653,27 +653,27 @@ discard block |
||
653 | 653 | |
654 | 654 | $args = array(); |
655 | 655 | |
656 | - if ( isset( $_GET['user'] ) ) { |
|
657 | - $args['user'] = urldecode( $_GET['user'] ); |
|
658 | - } elseif ( isset( $_GET['s'] ) ) { |
|
659 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
660 | - if ( $is_user ) { |
|
661 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
662 | - unset( $args['s'] ); |
|
656 | + if (isset($_GET['user'])) { |
|
657 | + $args['user'] = urldecode($_GET['user']); |
|
658 | + } elseif (isset($_GET['s'])) { |
|
659 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
660 | + if ($is_user) { |
|
661 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
662 | + unset($args['s']); |
|
663 | 663 | } else { |
664 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
664 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
669 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
668 | + if ( ! empty($_GET['start-date'])) { |
|
669 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
670 | 670 | } |
671 | 671 | |
672 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
673 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
672 | + if ( ! empty($_GET['end-date'])) { |
|
673 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
674 | 674 | } |
675 | 675 | |
676 | - $payment_count = give_count_payments( $args ); |
|
676 | + $payment_count = give_count_payments($args); |
|
677 | 677 | $this->complete_count = $payment_count->publish; |
678 | 678 | $this->pending_count = $payment_count->pending; |
679 | 679 | $this->refunded_count = $payment_count->refunded; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $this->cancelled_count = $payment_count->cancelled; |
683 | 683 | $this->abandoned_count = $payment_count->abandoned; |
684 | 684 | |
685 | - foreach ( $payment_count as $count ) { |
|
685 | + foreach ($payment_count as $count) { |
|
686 | 686 | $this->total_count += $count; |
687 | 687 | } |
688 | 688 | } |
@@ -697,26 +697,26 @@ discard block |
||
697 | 697 | public function payments_data() { |
698 | 698 | |
699 | 699 | $per_page = $this->per_page; |
700 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
701 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
702 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
703 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
704 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
705 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
706 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
707 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
708 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
709 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
710 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
711 | - |
|
712 | - if ( ! empty( $search ) ) { |
|
700 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
701 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
702 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
703 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
704 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
705 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
706 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
707 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
708 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
709 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
710 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
711 | + |
|
712 | + if ( ! empty($search)) { |
|
713 | 713 | $status = 'any'; // Force all payment statuses when searching. |
714 | 714 | } |
715 | 715 | |
716 | 716 | $args = array( |
717 | 717 | 'output' => 'payments', |
718 | 718 | 'number' => $per_page, |
719 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
719 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
720 | 720 | 'orderby' => $orderby, |
721 | 721 | 'order' => $order, |
722 | 722 | 'user' => $user, |
@@ -730,14 +730,14 @@ discard block |
||
730 | 730 | 'end_date' => $end_date, |
731 | 731 | ); |
732 | 732 | |
733 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
733 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
734 | 734 | |
735 | 735 | $args['search_in_notes'] = true; |
736 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
736 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
737 | 737 | |
738 | 738 | } |
739 | 739 | |
740 | - $p_query = new Give_Payments_Query( $args ); |
|
740 | + $p_query = new Give_Payments_Query($args); |
|
741 | 741 | |
742 | 742 | return $p_query->get_payments(); |
743 | 743 | |
@@ -757,17 +757,17 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function prepare_items() { |
759 | 759 | |
760 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
760 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
761 | 761 | |
762 | 762 | $columns = $this->get_columns(); |
763 | 763 | $hidden = array(); // No hidden columns. |
764 | 764 | $sortable = $this->get_sortable_columns(); |
765 | 765 | $data = $this->payments_data(); |
766 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
766 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
767 | 767 | |
768 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
768 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
769 | 769 | |
770 | - switch ( $status ) { |
|
770 | + switch ($status) { |
|
771 | 771 | case 'publish': |
772 | 772 | $total_items = $this->complete_count; |
773 | 773 | break; |
@@ -794,19 +794,19 @@ discard block |
||
794 | 794 | break; |
795 | 795 | default: |
796 | 796 | // Retrieve the count of the non-default-Give status. |
797 | - $count = wp_count_posts( 'give_payment' ); |
|
797 | + $count = wp_count_posts('give_payment'); |
|
798 | 798 | $total_items = $count->{$status}; |
799 | 799 | break; |
800 | 800 | } |
801 | 801 | |
802 | 802 | $this->items = $data; |
803 | 803 | |
804 | - $this->set_pagination_args( array( |
|
804 | + $this->set_pagination_args(array( |
|
805 | 805 | 'total_items' => $total_items, |
806 | 806 | // We have to calculate the total number of items. |
807 | 807 | 'per_page' => $this->per_page, |
808 | 808 | // We have to determine how many items to show on a page. |
809 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
809 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
810 | 810 | // We have to calculate the total number of pages. |
811 | 811 | ) |
812 | 812 | ); |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $customer_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $gateway = $payment->gateway; |
46 | 46 | $currency_code = $payment->currency; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | <h1 id="transaction-details-heading"><?php |
54 | 54 | printf( |
55 | 55 | /* translators: %s: donation number */ |
56 | - esc_html__( 'Donation %s', 'give' ), |
|
56 | + esc_html__('Donation %s', 'give'), |
|
57 | 57 | $number |
58 | 58 | ); |
59 | - if ( $payment_mode == 'test' ) { |
|
60 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
59 | + if ($payment_mode == 'test') { |
|
60 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
61 | 61 | } |
62 | 62 | ?></h1> |
63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @param int $payment_id Payment id. |
71 | 71 | */ |
72 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
72 | + do_action('give_view_order_details_before', $payment_id); |
|
73 | 73 | ?> |
74 | 74 | <form id="give-edit-order-form" method="post"> |
75 | 75 | <?php |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id Payment id. |
82 | 82 | */ |
83 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
83 | + do_action('give_view_order_details_form_top', $payment_id); |
|
84 | 84 | ?> |
85 | 85 | <div id="poststuff"> |
86 | 86 | <div id="give-dashboard-widgets-wrap"> |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param int $payment_id Payment id. |
98 | 98 | */ |
99 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
99 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
100 | 100 | ?> |
101 | 101 | |
102 | 102 | <div id="give-order-update" class="postbox give-order-data"> |
103 | 103 | |
104 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
104 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
105 | 105 | |
106 | 106 | <div class="inside"> |
107 | 107 | <div class="give-admin-box"> |
@@ -114,33 +114,33 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param int $payment_id Payment id. |
116 | 116 | */ |
117 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
117 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <div class="give-admin-box-inside"> |
121 | 121 | <p> |
122 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
122 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
123 | 123 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
124 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
125 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
124 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
125 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
126 | 126 | <?php endforeach; ?> |
127 | 127 | </select> |
128 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
129 | 129 | </p> |
130 | 130 | </div> |
131 | 131 | |
132 | 132 | <div class="give-admin-box-inside"> |
133 | 133 | <p> |
134 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
135 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
134 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
135 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
136 | 136 | </p> |
137 | 137 | </div> |
138 | 138 | |
139 | 139 | <div class="give-admin-box-inside"> |
140 | 140 | <p> |
141 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
142 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
143 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
141 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
142 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
143 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
144 | 144 | </p> |
145 | 145 | </div> |
146 | 146 | |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param int $payment_id Payment id. |
156 | 156 | */ |
157 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
157 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
158 | 158 | |
159 | 159 | // @TODO: Fees |
160 | - $fees = give_get_payment_fees( $payment_id ); |
|
161 | - if ( ! empty( $fees ) ) : ?> |
|
160 | + $fees = give_get_payment_fees($payment_id); |
|
161 | + if ( ! empty($fees)) : ?> |
|
162 | 162 | <div class="give-order-fees give-admin-box-inside"> |
163 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
163 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
164 | 164 | <ul class="give-payment-fees"> |
165 | - <?php foreach ( $fees as $fee ) : ?> |
|
165 | + <?php foreach ($fees as $fee) : ?> |
|
166 | 166 | <li> |
167 | 167 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
168 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
168 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
169 | 169 | </li> |
170 | 170 | <?php endforeach; ?> |
171 | 171 | </ul> |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | |
175 | 175 | <div class="give-order-payment give-admin-box-inside"> |
176 | 176 | <p> |
177 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
178 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
179 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
177 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
178 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
179 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
180 | 180 | </p> |
181 | 181 | </div> |
182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param int $payment_id Payment id. |
190 | 190 | */ |
191 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
191 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | </div> |
@@ -206,17 +206,17 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param int $payment_id Payment id. |
208 | 208 | */ |
209 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
209 | + do_action('give_view_order_details_update_before', $payment_id); |
|
210 | 210 | ?> |
211 | 211 | |
212 | 212 | <div id="major-publishing-actions"> |
213 | 213 | <div id="publishing-action"> |
214 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
215 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
216 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
214 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
215 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
216 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
217 | 217 | 'give-action' => 'email_links', |
218 | 218 | 'purchase_id' => $payment_id, |
219 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
219 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
220 | 220 | <?php endif; ?> |
221 | 221 | </div> |
222 | 222 | <div class="clear"></div> |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param int $payment_id Payment id. |
232 | 232 | */ |
233 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
233 | + do_action('give_view_order_details_update_after', $payment_id); |
|
234 | 234 | ?> |
235 | 235 | |
236 | 236 | </div> |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | <div id="give-order-details" class="postbox give-order-data"> |
243 | 243 | |
244 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
244 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
245 | 245 | |
246 | 246 | <div class="inside"> |
247 | 247 | <div class="give-admin-box"> |
@@ -254,44 +254,44 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @param int $payment_id Payment id. |
256 | 256 | */ |
257 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
257 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
258 | 258 | |
259 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
260 | - if ( $gateway ) : ?> |
|
259 | + $gateway = give_get_payment_gateway($payment_id); |
|
260 | + if ($gateway) : ?> |
|
261 | 261 | <div class="give-order-gateway give-admin-box-inside"> |
262 | 262 | <p> |
263 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
264 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
263 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
264 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
265 | 265 | </p> |
266 | 266 | </div> |
267 | 267 | <?php endif; ?> |
268 | 268 | |
269 | 269 | <div class="give-order-payment-key give-admin-box-inside"> |
270 | 270 | <p> |
271 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
272 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
271 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
272 | + <?php echo give_get_payment_key($payment_id); ?> |
|
273 | 273 | </p> |
274 | 274 | </div> |
275 | 275 | |
276 | 276 | <div class="give-order-ip give-admin-box-inside"> |
277 | 277 | <p> |
278 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
279 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
278 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
279 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
280 | 280 | </p> |
281 | 281 | </div> |
282 | 282 | |
283 | - <?php if ( $transaction_id ) : ?> |
|
283 | + <?php if ($transaction_id) : ?> |
|
284 | 284 | <div class="give-order-tx-id give-admin-box-inside"> |
285 | 285 | <p> |
286 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
287 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
286 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
287 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
288 | 288 | </p> |
289 | 289 | </div> |
290 | 290 | <?php endif; ?> |
291 | 291 | |
292 | 292 | <div class="give-admin-box-inside"> |
293 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
294 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
293 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
294 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
295 | 295 | </p> |
296 | 296 | </div> |
297 | 297 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @param int $payment_id Payment id. |
305 | 305 | */ |
306 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
306 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
307 | 307 | ?> |
308 | 308 | |
309 | 309 | </div> |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param int $payment_id Payment id. |
325 | 325 | */ |
326 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
326 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
327 | 327 | ?> |
328 | 328 | |
329 | 329 | </div> |
@@ -343,55 +343,55 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @param int $payment_id Payment id. |
345 | 345 | */ |
346 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
346 | + do_action('give_view_order_details_main_before', $payment_id); |
|
347 | 347 | ?> |
348 | 348 | |
349 | 349 | <?php $column_count = 'columns-3'; ?> |
350 | 350 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
351 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
351 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
352 | 352 | |
353 | 353 | <div class="inside"> |
354 | 354 | |
355 | 355 | <div class="column-container"> |
356 | 356 | <div class="column"> |
357 | 357 | <p> |
358 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
358 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
359 | 359 | <?php |
360 | - if ( $payment_meta['form_id'] ) : |
|
360 | + if ($payment_meta['form_id']) : |
|
361 | 361 | printf( |
362 | 362 | '<a href="%1$s" target="_blank">#%2$s</a>', |
363 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
363 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
364 | 364 | $payment_meta['form_id'] |
365 | 365 | ); |
366 | 366 | endif; |
367 | 367 | ?> |
368 | 368 | </p> |
369 | 369 | <p> |
370 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
371 | - <?php give_get_form_dropdown( array( |
|
370 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
371 | + <?php give_get_form_dropdown(array( |
|
372 | 372 | 'id' => $payment_meta['form_id'], |
373 | 373 | 'selected' => $payment_meta['form_id'], |
374 | 374 | 'chosen' => true, |
375 | - ), true ); ?> |
|
375 | + ), true); ?> |
|
376 | 376 | </p> |
377 | 377 | </div> |
378 | 378 | <div class="column"> |
379 | 379 | <p> |
380 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
381 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
380 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
381 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
382 | 382 | </p> |
383 | 383 | <p> |
384 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
384 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
385 | 385 | <span class="give-donation-level"> |
386 | 386 | <?php |
387 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
388 | - if ( empty( $var_prices ) ) { |
|
389 | - esc_html_e( 'n/a', 'give' ); |
|
387 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
388 | + if (empty($var_prices)) { |
|
389 | + esc_html_e('n/a', 'give'); |
|
390 | 390 | } else { |
391 | 391 | $prices_atts = ''; |
392 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
393 | - foreach ( $variable_prices as $variable_price ) { |
|
394 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
392 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
393 | + foreach ($variable_prices as $variable_price) { |
|
394 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | // Variable price dropdown options. |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | 'chosen' => true, |
402 | 402 | 'show_option_all' => '', |
403 | 403 | 'show_option_none' => '', |
404 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
404 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
405 | 405 | 'selected' => $payment_meta['price_id'], |
406 | 406 | ); |
407 | 407 | // Render variable prices select tag html. |
408 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
408 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
409 | 409 | } |
410 | 410 | ?> |
411 | 411 | </span> |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | </div> |
414 | 414 | <div class="column"> |
415 | 415 | <p> |
416 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
417 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
416 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
417 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
418 | 418 | </p> |
419 | 419 | <p> |
420 | 420 | <?php |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @param int $payment_id Payment id. |
429 | 429 | */ |
430 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
430 | + do_action('give_donation_details_thead_before', $payment_id); |
|
431 | 431 | |
432 | 432 | |
433 | 433 | /** |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param int $payment_id Payment id. |
441 | 441 | */ |
442 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
442 | + do_action('give_donation_details_thead_after', $payment_id); |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @param int $payment_id Payment id. |
452 | 452 | */ |
453 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
453 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
454 | 454 | |
455 | 455 | /** |
456 | 456 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @param int $payment_id Payment id. |
463 | 463 | */ |
464 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
464 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
465 | 465 | ?> |
466 | 466 | </p> |
467 | 467 | </div> |
@@ -481,57 +481,57 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @param int $payment_id Payment id. |
483 | 483 | */ |
484 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
484 | + do_action('give_view_order_details_files_after', $payment_id); |
|
485 | 485 | ?> |
486 | 486 | |
487 | 487 | <div id="give-donor-details" class="postbox"> |
488 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
488 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
489 | 489 | |
490 | 490 | <div class="inside"> |
491 | 491 | |
492 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
492 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
493 | 493 | |
494 | 494 | <div class="column-container customer-info"> |
495 | 495 | <div class="column"> |
496 | 496 | <p> |
497 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
497 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
498 | 498 | <?php |
499 | - if ( ! empty( $customer->id ) ) { |
|
499 | + if ( ! empty($customer->id)) { |
|
500 | 500 | printf( |
501 | 501 | '<a href="%1$s" target="_blank">#%2$s</a>', |
502 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
502 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
503 | 503 | $customer->id |
504 | 504 | ); |
505 | 505 | } |
506 | 506 | ?> |
507 | 507 | </p> |
508 | 508 | <p> |
509 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
510 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
509 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
510 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
511 | 511 | </p> |
512 | 512 | </div> |
513 | 513 | <div class="column"> |
514 | 514 | <p> |
515 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
515 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
516 | 516 | <?php echo $customer->name; ?> |
517 | 517 | </p> |
518 | 518 | <p> |
519 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
519 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
520 | 520 | <?php echo $customer->email; ?> |
521 | 521 | </p> |
522 | 522 | </div> |
523 | 523 | <div class="column"> |
524 | 524 | <p> |
525 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
525 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
526 | 526 | <?php |
527 | - echo Give()->html->donor_dropdown( array( |
|
527 | + echo Give()->html->donor_dropdown(array( |
|
528 | 528 | 'selected' => $customer->id, |
529 | 529 | 'name' => 'customer-id', |
530 | - ) ); |
|
530 | + )); |
|
531 | 531 | ?> |
532 | 532 | </p> |
533 | 533 | <p> |
534 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
534 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
535 | 535 | </p> |
536 | 536 | </div> |
537 | 537 | </div> |
@@ -539,13 +539,13 @@ discard block |
||
539 | 539 | <div class="column-container new-customer" style="display: none"> |
540 | 540 | <div class="column"> |
541 | 541 | <p> |
542 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
542 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
543 | 543 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
544 | 544 | </p> |
545 | 545 | </div> |
546 | 546 | <div class="column"> |
547 | 547 | <p> |
548 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
548 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
549 | 549 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
550 | 550 | </p> |
551 | 551 | </div> |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | <p> |
554 | 554 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
555 | 555 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
556 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
556 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
557 | 557 | <br> |
558 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
558 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
559 | 559 | </p> |
560 | 560 | </div> |
561 | 561 | </div> |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @param array $payment_meta Payment meta. |
572 | 572 | * @param array $user_info User information. |
573 | 573 | */ |
574 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
574 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
575 | 575 | |
576 | 576 | /** |
577 | 577 | * Fires in order details page, in the donor-details metabox. |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @param int $payment_id Payment id. |
582 | 582 | */ |
583 | - do_action( 'give_payment_view_details', $payment_id ); |
|
583 | + do_action('give_payment_view_details', $payment_id); |
|
584 | 584 | ?> |
585 | 585 | |
586 | 586 | </div> |
@@ -596,11 +596,11 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param int $payment_id Payment id. |
598 | 598 | */ |
599 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
599 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
600 | 600 | ?> |
601 | 601 | |
602 | 602 | <div id="give-billing-details" class="postbox"> |
603 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
603 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
604 | 604 | |
605 | 605 | <div class="inside"> |
606 | 606 | |
@@ -610,57 +610,57 @@ discard block |
||
610 | 610 | <div class="data column-container"> |
611 | 611 | <div class="column"> |
612 | 612 | <div class="give-wrap-address-line1"> |
613 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
614 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
613 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
614 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
615 | 615 | </div> |
616 | 616 | <div class="give-wrap-address-line2"> |
617 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
618 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
617 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
618 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
619 | 619 | </div> |
620 | 620 | </div> |
621 | 621 | <div class="column"> |
622 | 622 | <div class="give-wrap-address-city"> |
623 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
624 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
623 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
624 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
625 | 625 | </div> |
626 | 626 | <div class="give-wrap-address-zip"> |
627 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
628 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
627 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
628 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
629 | 629 | |
630 | 630 | </div> |
631 | 631 | </div> |
632 | 632 | <div class="column"> |
633 | 633 | <div id="give-order-address-country-wrap"> |
634 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
634 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
635 | 635 | <?php |
636 | - echo Give()->html->select( array( |
|
636 | + echo Give()->html->select(array( |
|
637 | 637 | 'options' => give_get_country_list(), |
638 | 638 | 'name' => 'give-payment-address[0][country]', |
639 | 639 | 'selected' => $address['country'], |
640 | 640 | 'show_option_all' => false, |
641 | 641 | 'show_option_none' => false, |
642 | 642 | 'chosen' => true, |
643 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
644 | - ) ); |
|
643 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
644 | + )); |
|
645 | 645 | ?> |
646 | 646 | </div> |
647 | 647 | <div id="give-order-address-state-wrap"> |
648 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
648 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
649 | 649 | <?php |
650 | - $states = give_get_states( $address['country'] ); |
|
651 | - if ( ! empty( $states ) ) { |
|
652 | - echo Give()->html->select( array( |
|
650 | + $states = give_get_states($address['country']); |
|
651 | + if ( ! empty($states)) { |
|
652 | + echo Give()->html->select(array( |
|
653 | 653 | 'options' => $states, |
654 | 654 | 'name' => 'give-payment-address[0][state]', |
655 | 655 | 'selected' => $address['state'], |
656 | 656 | 'show_option_all' => false, |
657 | 657 | 'show_option_none' => false, |
658 | 658 | 'chosen' => true, |
659 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
660 | - ) ); |
|
659 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
660 | + )); |
|
661 | 661 | } else { |
662 | 662 | ?> |
663 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
663 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
664 | 664 | <?php |
665 | 665 | } ?> |
666 | 666 | </div> |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @param int $payment_id Payment id. |
682 | 682 | */ |
683 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
683 | + do_action('give_payment_billing_details', $payment_id); |
|
684 | 684 | ?> |
685 | 685 | |
686 | 686 | </div> |
@@ -696,32 +696,32 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @param int $payment_id Payment id. |
698 | 698 | */ |
699 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
699 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
700 | 700 | ?> |
701 | 701 | |
702 | 702 | <div id="give-payment-notes" class="postbox"> |
703 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
703 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
704 | 704 | |
705 | 705 | <div class="inside"> |
706 | 706 | <div id="give-payment-notes-inner"> |
707 | 707 | <?php |
708 | - $notes = give_get_payment_notes( $payment_id ); |
|
709 | - if ( ! empty( $notes ) ) { |
|
708 | + $notes = give_get_payment_notes($payment_id); |
|
709 | + if ( ! empty($notes)) { |
|
710 | 710 | $no_notes_display = ' style="display:none;"'; |
711 | - foreach ( $notes as $note ) : |
|
711 | + foreach ($notes as $note) : |
|
712 | 712 | |
713 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
713 | + echo give_get_payment_note_html($note, $payment_id); |
|
714 | 714 | |
715 | 715 | endforeach; |
716 | 716 | } else { |
717 | 717 | $no_notes_display = ''; |
718 | 718 | } |
719 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
719 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
720 | 720 | </div> |
721 | 721 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
722 | 722 | |
723 | 723 | <div class="give-clearfix"> |
724 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
724 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
725 | 725 | </div> |
726 | 726 | |
727 | 727 | </div> |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | * |
738 | 738 | * @param int $payment_id Payment id. |
739 | 739 | */ |
740 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
740 | + do_action('give_view_order_details_main_after', $payment_id); |
|
741 | 741 | ?> |
742 | 742 | |
743 | 743 | </div> |
@@ -759,11 +759,11 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @param int $payment_id Payment id. |
761 | 761 | */ |
762 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
762 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
763 | 763 | |
764 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
764 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
765 | 765 | ?> |
766 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
766 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
767 | 767 | <input type="hidden" name="give_action" value="update_payment_details"/> |
768 | 768 | </form> |
769 | 769 | <?php |
@@ -774,6 +774,6 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @param int $payment_id Payment id. |
776 | 776 | */ |
777 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
777 | + do_action('give_view_order_details_after', $payment_id); |
|
778 | 778 | ?> |
779 | 779 | </div><!-- /.wrap --> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly. |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * 'testing' => false, // (required) Never leave as "true" in production!!! |
33 | 33 | * } |
34 | 34 | */ |
35 | - function __construct( $_banner_details ) { |
|
35 | + function __construct($_banner_details) { |
|
36 | 36 | $current_user = wp_get_current_user(); |
37 | 37 | |
38 | 38 | $this->plugin_activate_by = 0; |
39 | 39 | $this->banner_details = $_banner_details; |
40 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
41 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
42 | - $this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user'; |
|
40 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
41 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
42 | + $this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user'; |
|
43 | 43 | |
44 | 44 | //Get current user |
45 | 45 | $this->user_id = $current_user->ID; |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | public function init() { |
63 | 63 | |
64 | 64 | //Testing? |
65 | - if ( $this->test_mode ) { |
|
66 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
65 | + if ($this->test_mode) { |
|
66 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | //Get the current page to add the notice to |
70 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
71 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
70 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
71 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
72 | 72 | |
73 | 73 | // File path of addon must be included in banner detail other addon activate meta will not delete. |
74 | - add_action( 'deactivate_' . $this->get_plugin_file_name(), array( $this, 'remove_addon_activate_meta' ) ); |
|
74 | + add_action('deactivate_'.$this->get_plugin_file_name(), array($this, 'remove_addon_activate_meta')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | private function is_plugin_page() { |
86 | 86 | $screen = get_current_screen(); |
87 | 87 | |
88 | - return ( $screen->parent_file === 'plugins.php' ); |
|
88 | + return ($screen->parent_file === 'plugins.php'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | public function give_addon_activation_admin_notice() { |
99 | 99 | |
100 | 100 | // Bailout. |
101 | - if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) { |
|
101 | + if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // If the user hasn't already dismissed the alert, output activation banner. |
106 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { |
|
106 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { |
|
107 | 107 | |
108 | 108 | // Output inline styles here because there's no reason |
109 | 109 | // to enqueued them after the alert is dismissed. |
@@ -185,44 +185,44 @@ discard block |
||
185 | 185 | <h3><?php |
186 | 186 | printf( |
187 | 187 | /* translators: %s: Add-on name */ |
188 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
189 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
188 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
189 | + '<span>'.$this->banner_details['name'].'</span>' |
|
190 | 190 | ); |
191 | 191 | ?></h3> |
192 | 192 | |
193 | 193 | <a href="<?php |
194 | 194 | //The Dismiss Button. |
195 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
196 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
195 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
196 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
197 | 197 | class="dashicons dashicons-dismiss"></span></a> |
198 | 198 | |
199 | 199 | <div class="alert-actions"> |
200 | 200 | |
201 | 201 | <?php //Point them to your settings page. |
202 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
202 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
203 | 203 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
204 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
204 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
205 | 205 | </a> |
206 | 206 | <?php } ?> |
207 | 207 | |
208 | 208 | <?php |
209 | 209 | // Show them how to configure the Addon. |
210 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
210 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
211 | 211 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
212 | 212 | <span class="dashicons dashicons-media-text"></span><?php |
213 | 213 | printf( |
214 | 214 | /* translators: %s: Add-on name */ |
215 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
215 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
216 | 216 | $this->banner_details['name'] |
217 | 217 | ); |
218 | 218 | ?></a> |
219 | 219 | <?php } ?> |
220 | 220 | <?php |
221 | 221 | //Let them signup for plugin updates |
222 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
222 | + if (isset($this->banner_details['support_url'])) { ?> |
|
223 | 223 | |
224 | 224 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
225 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
225 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
226 | 226 | </a> |
227 | 227 | |
228 | 228 | <?php } ?> |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
250 | 250 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
251 | 251 | */ |
252 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
252 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
253 | 253 | |
254 | 254 | //Get the global user |
255 | 255 | $current_user = wp_get_current_user(); |
256 | 256 | $user_id = $current_user->ID; |
257 | 257 | |
258 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
258 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | * @access private |
267 | 267 | */ |
268 | 268 | private function add_addon_activate_meta() { |
269 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
269 | + $user_id = get_option($this->activate_by_meta_key); |
|
270 | 270 | $this->plugin_activate_by = (int) $user_id; |
271 | 271 | |
272 | - if ( ! $user_id ) { |
|
273 | - add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' ); |
|
272 | + if ( ! $user_id) { |
|
273 | + add_option($this->activate_by_meta_key, $this->user_id, '', 'no'); |
|
274 | 274 | $this->plugin_activate_by = (int) $this->user_id; |
275 | 275 | } |
276 | 276 | } |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * @access public |
284 | 284 | */ |
285 | 285 | public function remove_addon_activate_meta() { |
286 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
286 | + $user_id = get_option($this->activate_by_meta_key); |
|
287 | 287 | |
288 | - if ( $user_id ) { |
|
289 | - delete_option( $this->activate_by_meta_key ); |
|
288 | + if ($user_id) { |
|
289 | + delete_option($this->activate_by_meta_key); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -299,35 +299,35 @@ discard block |
||
299 | 299 | * @return mixed |
300 | 300 | */ |
301 | 301 | private function get_plugin_file_name() { |
302 | - $active_plugins = get_option( 'active_plugins' ); |
|
302 | + $active_plugins = get_option('active_plugins'); |
|
303 | 303 | $file_name = ''; |
304 | 304 | |
305 | 305 | try { |
306 | 306 | |
307 | 307 | // Check addon file path. |
308 | - if ( ! empty( $this->banner_details['file'] ) ) { |
|
308 | + if ( ! empty($this->banner_details['file'])) { |
|
309 | 309 | $file_name = ''; |
310 | - if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) { |
|
311 | - $file_path = array_pop( $file_path ); |
|
312 | - $file_name = current( explode( '/', $file_path ) ); |
|
310 | + if ($file_path = explode('/plugins/', $this->banner_details['file'])) { |
|
311 | + $file_path = array_pop($file_path); |
|
312 | + $file_name = current(explode('/', $file_path)); |
|
313 | 313 | } |
314 | 314 | |
315 | - foreach ( $active_plugins as $plugin ) { |
|
316 | - if ( false !== strpos( $plugin, $file_name ) ) { |
|
315 | + foreach ($active_plugins as $plugin) { |
|
316 | + if (false !== strpos($plugin, $file_name)) { |
|
317 | 317 | $file_name = $plugin; |
318 | 318 | break; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | } else { |
322 | - throw new Exception( __( "File path must be added of {$this->banner_details['name']} addon in banner details.", 'give' ) ); |
|
322 | + throw new Exception(__("File path must be added of {$this->banner_details['name']} addon in banner details.", 'give')); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | // Check plugin path calculated by addon file path. |
326 | - if ( empty( $file_name ) ) { |
|
327 | - throw new Exception( __( "Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give' ) ); |
|
326 | + if (empty($file_name)) { |
|
327 | + throw new Exception(__("Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give')); |
|
328 | 328 | } |
329 | 329 | |
330 | - } catch ( Exception $e ) { |
|
330 | + } catch (Exception $e) { |
|
331 | 331 | echo $e->getMessage(); |
332 | 332 | } |
333 | 333 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | global $status, $page; |
54 | 54 | |
55 | 55 | // Set parent defaults |
56 | - parent::__construct( array( |
|
57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
59 | - 'ajax' => false,// Does this table support ajax? |
|
60 | - ) ); |
|
56 | + parent::__construct(array( |
|
57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
59 | + 'ajax' => false, // Does this table support ajax? |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | $this->query(); |
63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Column Name |
75 | 75 | */ |
76 | - public function column_default( $item, $column_name ) { |
|
77 | - return $item[ $column_name ]; |
|
76 | + public function column_default($item, $column_name) { |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string Column Name |
89 | 89 | */ |
90 | - public function column_key( $item ) { |
|
91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
90 | + public function column_key($item) { |
|
91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Column Name |
103 | 103 | */ |
104 | - public function column_token( $item ) { |
|
105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
104 | + public function column_token($item) { |
|
105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'section' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-tools', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'], |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html__( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html__('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate', |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html__( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html__('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke', |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html__( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html__('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
192 | + 'user' => esc_html__('Username', 'give'), |
|
193 | + 'key' => esc_html__('Public Key', 'give'), |
|
194 | + 'token' => esc_html__('Token', 'give'), |
|
195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $which |
208 | 208 | */ |
209 | - protected function display_tablenav( $which ) { |
|
210 | - if ( 'top' === $which ) { |
|
211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
209 | + protected function display_tablenav($which) { |
|
210 | + if ('top' === $which) { |
|
211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
212 | 212 | } |
213 | 213 | ?> |
214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
215 | 215 | |
216 | 216 | <div class="alignleft actions bulkactions"> |
217 | - <?php $this->bulk_actions( $which ); ?> |
|
217 | + <?php $this->bulk_actions($which); ?> |
|
218 | 218 | </div> |
219 | 219 | |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -237,19 +237,19 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place |
242 | 242 | static $give_api_is_bottom; |
243 | 243 | |
244 | - if ( $give_api_is_bottom ) { |
|
244 | + if ($give_api_is_bottom) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
250 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
250 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
251 | 251 | <?php echo Give()->html->ajax_user_search(); ?> |
252 | - <?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
252 | + <?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
253 | 253 | <?php |
254 | 254 | $give_api_is_bottom = true; |
255 | 255 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return int Current page number |
263 | 263 | */ |
264 | 264 | public function get_paged() { |
265 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
265 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,21 +273,21 @@ discard block |
||
273 | 273 | * @return array |
274 | 274 | */ |
275 | 275 | public function query() { |
276 | - $users = get_users( array( |
|
276 | + $users = get_users(array( |
|
277 | 277 | 'meta_value' => 'give_user_secret_key', |
278 | 278 | 'number' => $this->per_page, |
279 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
280 | - ) ); |
|
281 | - $keys = array(); |
|
282 | - |
|
283 | - foreach ( $users as $user ) { |
|
284 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
285 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
286 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
287 | - |
|
288 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
289 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
290 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
279 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
280 | + )); |
|
281 | + $keys = array(); |
|
282 | + |
|
283 | + foreach ($users as $user) { |
|
284 | + $keys[$user->ID]['id'] = $user->ID; |
|
285 | + $keys[$user->ID]['email'] = $user->user_email; |
|
286 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
287 | + |
|
288 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
289 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
290 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $keys; |
@@ -304,13 +304,13 @@ discard block |
||
304 | 304 | public function total_items() { |
305 | 305 | global $wpdb; |
306 | 306 | |
307 | - if ( ! get_transient( 'give_total_api_keys' ) ) { |
|
308 | - $total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" ); |
|
307 | + if ( ! get_transient('give_total_api_keys')) { |
|
308 | + $total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'"); |
|
309 | 309 | |
310 | - set_transient( 'give_total_api_keys', $total_items, 60 * 60 ); |
|
310 | + set_transient('give_total_api_keys', $total_items, 60 * 60); |
|
311 | 311 | } |
312 | 312 | |
313 | - return get_transient( 'give_total_api_keys' ); |
|
313 | + return get_transient('give_total_api_keys'); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $hidden = array(); // No hidden columns |
327 | 327 | $sortable = array(); // Not sortable... for now |
328 | 328 | |
329 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
329 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
330 | 330 | |
331 | 331 | $data = $this->query(); |
332 | 332 | |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | |
335 | 335 | $this->items = $data; |
336 | 336 | |
337 | - $this->set_pagination_args( array( |
|
337 | + $this->set_pagination_args(array( |
|
338 | 338 | 'total_items' => $total_items, |
339 | 339 | 'per_page' => $this->per_page, |
340 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
340 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @since 1.5 |
21 | 21 | */ |
22 | 22 | function give_register_batch_recount_export_classes() { |
23 | - add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 ); |
|
23 | + add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1); |
|
24 | 24 | } |
25 | 25 | |
26 | -add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 ); |
|
26 | +add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10); |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | -function give_include_batch_export_class( $class ) { |
|
39 | - switch ( $class ) { |
|
38 | +function give_include_batch_export_class($class) { |
|
39 | + switch ($class) { |
|
40 | 40 | |
41 | 41 | case 'Give_Tools_Delete_Test_Transactions': |
42 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php'; |
|
42 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php'; |
|
43 | 43 | break; |
44 | 44 | |
45 | 45 | case 'Give_Tools_Recount_Customer_Stats': |
46 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php'; |
|
46 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php'; |
|
47 | 47 | break; |
48 | 48 | |
49 | 49 | case 'Give_Tools_Reset_Stats': |
50 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php'; |
|
50 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php'; |
|
51 | 51 | break; |
52 | 52 | |
53 | 53 | case 'Give_Tools_Recount_All_Stats': |
54 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php'; |
|
54 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php'; |
|
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'Give_Tools_Recount_Form_Stats': |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php'; |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | case 'Give_Tools_Recount_Income': |
62 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php'; |
|
62 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php'; |
|
63 | 63 | break; |
64 | 64 | } |
65 | 65 | } |