@@ -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'); |
@@ -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,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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => esc_html__( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => esc_html__( 'Email', 'give' ), |
|
45 | - 'first' => esc_html__( 'First Name', 'give' ), |
|
46 | - 'last' => esc_html__( 'Last Name', 'give' ), |
|
47 | - 'address1' => esc_html__( 'Address 1', 'give' ), |
|
48 | - 'address2' => esc_html__( 'Address 2', 'give' ), |
|
49 | - 'city' => esc_html__( 'City', 'give' ), |
|
50 | - 'state' => esc_html__( 'State', 'give' ), |
|
51 | - 'country' => esc_html__( 'Country', 'give' ), |
|
52 | - 'zip' => esc_html__( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => esc_html__( 'Form ID', 'give' ), |
|
54 | - 'form_name' => esc_html__( 'Form Name', 'give' ), |
|
55 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
56 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
58 | - 'key' => esc_html__( 'Key', 'give' ), |
|
59 | - 'date' => esc_html__( 'Date', 'give' ), |
|
60 | - 'user' => esc_html__( 'User', 'give' ), |
|
61 | - 'status' => esc_html__( 'Status', 'give' ) |
|
42 | + 'id' => esc_html__('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => esc_html__('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => esc_html__('Email', 'give'), |
|
45 | + 'first' => esc_html__('First Name', 'give'), |
|
46 | + 'last' => esc_html__('Last Name', 'give'), |
|
47 | + 'address1' => esc_html__('Address 1', 'give'), |
|
48 | + 'address2' => esc_html__('Address 2', 'give'), |
|
49 | + 'city' => esc_html__('City', 'give'), |
|
50 | + 'state' => esc_html__('State', 'give'), |
|
51 | + 'country' => esc_html__('Country', 'give'), |
|
52 | + 'zip' => esc_html__('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => esc_html__('Form ID', 'give'), |
|
54 | + 'form_name' => esc_html__('Form Name', 'give'), |
|
55 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
56 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
57 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
58 | + 'key' => esc_html__('Key', 'give'), |
|
59 | + 'date' => esc_html__('Date', 'give'), |
|
60 | + 'user' => esc_html__('User', 'give'), |
|
61 | + 'status' => esc_html__('Status', 'give') |
|
62 | 62 | ); |
63 | 63 | |
64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
65 | - unset( $cols['seq_id'] ); |
|
64 | + if ( ! give_get_option('enable_sequential')) { |
|
65 | + unset($cols['seq_id']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // Add category or tag to payment query if any. |
103 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
103 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
104 | 104 | $form_args = array( |
105 | 105 | 'post_type' => 'give_forms', |
106 | 106 | 'post_status' => 'publish', |
107 | - 'posts_per_page' => - 1, |
|
107 | + 'posts_per_page' => -1, |
|
108 | 108 | 'fields' => 'ids', |
109 | 109 | 'tax_query' => array( |
110 | 110 | 'relation' => 'AND', |
@@ -112,75 +112,75 @@ discard block |
||
112 | 112 | ); |
113 | 113 | |
114 | 114 | |
115 | - if ( ! empty( $this->categories ) ) { |
|
115 | + if ( ! empty($this->categories)) { |
|
116 | 116 | $form_args['tax_query'][] = array( |
117 | 117 | 'taxonomy' => 'give_forms_category', |
118 | 118 | 'terms' => $this->categories, |
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - if ( ! empty( $this->tags ) ) { |
|
122 | + if ( ! empty($this->tags)) { |
|
123 | 123 | $form_args['tax_query'][] = array( |
124 | 124 | 'taxonomy' => 'give_forms_tag', |
125 | 125 | 'terms' => $this->tags, |
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - $forms = new WP_Query( $form_args ); |
|
129 | + $forms = new WP_Query($form_args); |
|
130 | 130 | |
131 | - if ( empty( $forms->posts ) ) { |
|
131 | + if (empty($forms->posts)) { |
|
132 | 132 | return array(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | $args['give_forms'] = $forms->posts; |
136 | 136 | } |
137 | 137 | |
138 | - $payments = give_get_payments( $args ); |
|
138 | + $payments = give_get_payments($args); |
|
139 | 139 | |
140 | - if ( $payments ) { |
|
140 | + if ($payments) { |
|
141 | 141 | |
142 | - foreach ( $payments as $payment ) { |
|
143 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
144 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
145 | - $total = give_get_payment_amount( $payment->ID ); |
|
146 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
142 | + foreach ($payments as $payment) { |
|
143 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
144 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
145 | + $total = give_get_payment_amount($payment->ID); |
|
146 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
147 | 147 | $products = ''; |
148 | 148 | $skus = ''; |
149 | 149 | |
150 | - if ( is_numeric( $user_id ) ) { |
|
151 | - $user = get_userdata( $user_id ); |
|
150 | + if (is_numeric($user_id)) { |
|
151 | + $user = get_userdata($user_id); |
|
152 | 152 | } else { |
153 | 153 | $user = false; |
154 | 154 | } |
155 | 155 | |
156 | 156 | $data[] = array( |
157 | 157 | 'id' => $payment->ID, |
158 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
158 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
159 | 159 | 'email' => $payment_meta['email'], |
160 | 160 | 'first' => $user_info['first_name'], |
161 | 161 | 'last' => $user_info['last_name'], |
162 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
163 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
164 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
165 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
166 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
167 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
168 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
169 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
162 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
163 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
164 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
165 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
166 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
167 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
168 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
169 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
170 | 170 | 'skus' => $skus, |
171 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
172 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
173 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
171 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
172 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
173 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
174 | 174 | 'key' => $payment_meta['key'], |
175 | 175 | 'date' => $payment->post_date, |
176 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
177 | - 'status' => give_get_payment_status( $payment, true ) |
|
176 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
177 | + 'status' => give_get_payment_status($payment, true) |
|
178 | 178 | ); |
179 | 179 | |
180 | 180 | } |
181 | 181 | |
182 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
183 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
182 | + $data = apply_filters('give_export_get_data', $data); |
|
183 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
184 | 184 | |
185 | 185 | return $data; |
186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | |
201 | 201 | $status = $this->status; |
202 | 202 | $args = array( |
203 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
204 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
203 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
204 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
205 | 205 | ); |
206 | 206 | |
207 | - if ( 'any' == $status ) { |
|
207 | + if ('any' == $status) { |
|
208 | 208 | |
209 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
209 | + $total = array_sum((array) give_count_payments($args)); |
|
210 | 210 | |
211 | 211 | } else { |
212 | 212 | |
213 | - $total = give_count_payments( $args )->$status; |
|
213 | + $total = give_count_payments($args)->$status; |
|
214 | 214 | |
215 | 215 | } |
216 | 216 | |
217 | 217 | $percentage = 100; |
218 | 218 | |
219 | - if ( $total > 0 ) { |
|
220 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
219 | + if ($total > 0) { |
|
220 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
221 | 221 | } |
222 | 222 | |
223 | - if ( $percentage > 100 ) { |
|
223 | + if ($percentage > 100) { |
|
224 | 224 | $percentage = 100; |
225 | 225 | } |
226 | 226 | |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param array $request The Form Data passed into the batch processing. |
236 | 236 | */ |
237 | - public function set_properties( $request ) { |
|
238 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
239 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
240 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
241 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
242 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
237 | + public function set_properties($request) { |
|
238 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
239 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
240 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
241 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
242 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
243 | 243 | } |
244 | 244 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_logs_view_sales() { |
26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
27 | 27 | |
28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | function give_logs_view_gateway_errors() { |
46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
47 | 47 | |
48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
49 | 49 | $logs_table->prepare_items(); |
50 | 50 | $logs_table->display(); |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return void |
63 | 63 | */ |
64 | 64 | function give_logs_view_api_requests() { |
65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
66 | 66 | |
67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_logs_api_requests_top' ); |
|
78 | + do_action('give_logs_api_requests_top'); |
|
79 | 79 | ?> |
80 | 80 | |
81 | 81 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
82 | 82 | <?php |
83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
84 | 84 | $logs_table->display(); |
85 | 85 | ?> |
86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
96 | + do_action('give_logs_api_requests_bottom'); |
|
97 | 97 | ?> |
98 | 98 | |
99 | 99 | </div> |
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | |
103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Renders the Reports page views drop down |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $current_section = give_get_current_setting_section(); |
113 | 113 | |
114 | 114 | // If there are not any event attach to action then do not show form. |
115 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
115 | + if ( ! has_action('give_log_view_actions')) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | ?> |
119 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
119 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
120 | 120 | <?php |
121 | 121 | /** |
122 | 122 | * Fires after displaying the reports page views drop down. |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @since 1.0 |
127 | 127 | */ |
128 | - do_action( 'give_log_view_actions' ); |
|
128 | + do_action('give_log_view_actions'); |
|
129 | 129 | ?> |
130 | 130 | |
131 | 131 | <input type="hidden" name="post_type" value="give_forms"/> |
132 | 132 | <input type="hidden" name="page" value="give-tools"/> |
133 | 133 | <input type="hidden" name="tab" value="logs"/> |
134 | 134 | |
135 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
135 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
136 | 136 | </form> |
137 | 137 | <?php |
138 | 138 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return bool $ret True if guest checkout is enabled, false otherwise |
29 | 29 | */ |
30 | -function give_no_guest_checkout( $form_id ) { |
|
30 | +function give_no_guest_checkout($form_id) { |
|
31 | 31 | |
32 | 32 | $backtrace = debug_backtrace(); |
33 | 33 | |
34 | - _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace ); |
|
34 | + _give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace); |
|
35 | 35 | |
36 | - $ret = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
36 | + $ret = get_post_meta($form_id, '_give_logged_in_only', true); |
|
37 | 37 | |
38 | - return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) ); |
|
38 | + return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | |
51 | 51 | $backtrace = debug_backtrace(); |
52 | 52 | |
53 | - _give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace ); |
|
53 | + _give_deprecated_function(__FUNCTION__, '1.8', null, $backtrace); |
|
54 | 54 | |
55 | 55 | $views = array( |
56 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
57 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
58 | - 'api_requests' => esc_html__( 'API Requests', 'give' ), |
|
56 | + 'sales' => esc_html__('Donations', 'give'), |
|
57 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
58 | + 'api_requests' => esc_html__('API Requests', 'give'), |
|
59 | 59 | ); |
60 | 60 | |
61 | - $views = apply_filters( 'give_log_views', $views ); |
|
61 | + $views = apply_filters('give_log_views', $views); |
|
62 | 62 | |
63 | 63 | return $views; |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | $give_map_deprecated_filters = give_deprecated_filters(); |
6 | 6 | |
7 | -foreach ( $give_map_deprecated_filters as $new => $old ) { |
|
8 | - add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 ); |
|
7 | +foreach ($give_map_deprecated_filters as $new => $old) { |
|
8 | + add_filter($new, 'give_deprecated_filter_mapping', 10, 4); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | -function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
44 | +function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
45 | 45 | $give_map_deprecated_filters = give_deprecated_filters(); |
46 | 46 | $filter = current_filter(); |
47 | 47 | |
48 | - if ( isset( $give_map_deprecated_filters[ $filter ] ) ) { |
|
49 | - if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) { |
|
50 | - $data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); |
|
48 | + if (isset($give_map_deprecated_filters[$filter])) { |
|
49 | + if (has_filter($give_map_deprecated_filters[$filter])) { |
|
50 | + $data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3); |
|
51 | 51 | |
52 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
52 | + if ( ! defined('DOING_AJAX')) { |
|
53 | 53 | _give_deprecated_function( |
54 | 54 | sprintf( |
55 | 55 | /* translators: %s: filter name */ |
56 | - __( 'The %s filter' ), |
|
57 | - $give_map_deprecated_filters[ $filter ] |
|
56 | + __('The %s filter'), |
|
57 | + $give_map_deprecated_filters[$filter] |
|
58 | 58 | ), |
59 | 59 | '1.7', |
60 | 60 | $filter |