@@ -186,7 +186,8 @@ discard block |
||
186 | 186 | __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
187 | 187 | ); |
188 | 188 | |
189 | - else : |
|
189 | + else { |
|
190 | + : |
|
190 | 191 | echo sprintf( |
191 | 192 | '<a href="%1$s">%2$s</a>', |
192 | 193 | esc_url( |
@@ -198,6 +199,7 @@ discard block |
||
198 | 199 | ), |
199 | 200 | __( 'View Receipt »', 'give' ) |
200 | 201 | ); |
202 | + } |
|
201 | 203 | |
202 | 204 | endif; |
203 | 205 | ?> |
@@ -242,6 +244,9 @@ discard block |
||
242 | 244 | </div> |
243 | 245 | </div> |
244 | 246 | <?php wp_reset_postdata(); ?> |
245 | -<?php else : ?> |
|
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
247 | +<?php else { |
|
248 | + : ?> |
|
249 | + <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); |
|
250 | +} |
|
251 | +?> |
|
247 | 252 | <?php endif; |
248 | 253 | \ No newline at end of file |
@@ -4,56 +4,56 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $donations = array(); |
7 | -$donation_history_args = Give()->session->get( 'give_donation_history_args' ); |
|
7 | +$donation_history_args = Give()->session->get('give_donation_history_args'); |
|
8 | 8 | |
9 | 9 | // User's Donations. |
10 | -if ( is_user_logged_in() ) { |
|
11 | - $donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' ); |
|
12 | -} elseif ( Give()->email_access->token_exists ) { |
|
10 | +if (is_user_logged_in()) { |
|
11 | + $donations = give_get_users_donations(get_current_user_id(), 20, true, 'any'); |
|
12 | +} elseif (Give()->email_access->token_exists) { |
|
13 | 13 | // Email Access Token? |
14 | - $donations = give_get_users_donations( 0, 20, true, 'any' ); |
|
14 | + $donations = give_get_users_donations(0, 20, true, 'any'); |
|
15 | 15 | } elseif ( |
16 | 16 | false !== Give()->session->get_session_expiration() || |
17 | 17 | true === give_get_history_session() |
18 | 18 | ) { |
19 | 19 | // Session active? |
20 | - $email = Give()->session->get( 'give_email' ); |
|
21 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
22 | - $donations_count = count( explode( ',', $donor->payment_ids ) ); |
|
20 | + $email = Give()->session->get('give_email'); |
|
21 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
22 | + $donations_count = count(explode(',', $donor->payment_ids)); |
|
23 | 23 | |
24 | - if( $donations_count > give_get_limit_display_donations() ) { |
|
24 | + if ($donations_count > give_get_limit_display_donations()) { |
|
25 | 25 | |
26 | 26 | // Restrict Security Email Access option, if donation count of a donor is less than or equal to limit. |
27 | - if( true !== Give_Cache::get( "give_cache_email_throttle_limit_exhausted_{$donor->id}" ) ) { |
|
28 | - add_action( 'give_donation_history_table_end', 'give_donation_history_table_end' ); |
|
27 | + if (true !== Give_Cache::get("give_cache_email_throttle_limit_exhausted_{$donor->id}")) { |
|
28 | + add_action('give_donation_history_table_end', 'give_donation_history_table_end'); |
|
29 | 29 | } else { |
30 | 30 | $value = Give()->email_access->verify_throttle / 60; |
31 | 31 | |
32 | - give_set_error( 'give-limited-throttle', sprintf( |
|
33 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
34 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
35 | - ) ); |
|
32 | + give_set_error('give-limited-throttle', sprintf( |
|
33 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
34 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
35 | + )); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - $donations = give_get_users_donations( $email, give_get_limit_display_donations(), true, 'any' ); |
|
39 | + $donations = give_get_users_donations($email, give_get_limit_display_donations(), true, 'any'); |
|
40 | 40 | } else { |
41 | - $donations = give_get_users_donations( $email, 20, true, 'any' ); |
|
41 | + $donations = give_get_users_donations($email, 20, true, 'any'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | -Give()->notices->render_frontend_notices( 0 ); |
|
45 | +Give()->notices->render_frontend_notices(0); |
|
46 | 46 | |
47 | -if ( $donations ) : ?> |
|
47 | +if ($donations) : ?> |
|
48 | 48 | <?php |
49 | 49 | $table_headings = array( |
50 | - 'id' => __( 'ID', 'give' ), |
|
51 | - 'date' => __( 'Date', 'give' ), |
|
52 | - 'donor' => __( 'Donor', 'give' ), |
|
53 | - 'amount' => __( 'Amount', 'give' ), |
|
54 | - 'status' => __( 'Status', 'give' ), |
|
55 | - 'payment_method' => __( 'Payment Method', 'give' ), |
|
56 | - 'details' => __( 'Details', 'give' ), |
|
50 | + 'id' => __('ID', 'give'), |
|
51 | + 'date' => __('Date', 'give'), |
|
52 | + 'donor' => __('Donor', 'give'), |
|
53 | + 'amount' => __('Amount', 'give'), |
|
54 | + 'status' => __('Status', 'give'), |
|
55 | + 'payment_method' => __('Payment Method', 'give'), |
|
56 | + 'details' => __('Details', 'give'), |
|
57 | 57 | ); |
58 | 58 | ?> |
59 | 59 | <div class="give_user_history_main" > |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.7 |
71 | 71 | */ |
72 | - do_action( 'give_donation_history_header_before' ); |
|
72 | + do_action('give_donation_history_header_before'); |
|
73 | 73 | |
74 | - foreach ( $donation_history_args as $index => $value ) { |
|
75 | - if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) : |
|
74 | + foreach ($donation_history_args as $index => $value) { |
|
75 | + if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) : |
|
76 | 76 | echo sprintf( |
77 | 77 | '<th scope="col" class="give-donation-%1$s>">%2$s</th>', |
78 | 78 | $index, |
79 | - $table_headings[ $index ] |
|
79 | + $table_headings[$index] |
|
80 | 80 | ); |
81 | 81 | endif; |
82 | 82 | } |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @since 1.7 |
90 | 90 | */ |
91 | - do_action( 'give_donation_history_header_after' ); |
|
91 | + do_action('give_donation_history_header_after'); |
|
92 | 92 | ?> |
93 | 93 | </tr> |
94 | 94 | </thead> |
95 | - <?php foreach ( $donations as $post ) : |
|
96 | - setup_postdata( $post ); |
|
97 | - $donation_data = give_get_payment_meta( $post->ID ); ?> |
|
95 | + <?php foreach ($donations as $post) : |
|
96 | + setup_postdata($post); |
|
97 | + $donation_data = give_get_payment_meta($post->ID); ?> |
|
98 | 98 | <tr class="give-donation-row"> |
99 | 99 | <?php |
100 | 100 | /** |
@@ -107,36 +107,36 @@ discard block |
||
107 | 107 | * @param int $post_id The ID of the post. |
108 | 108 | * @param mixed $donation_data Payment meta data. |
109 | 109 | */ |
110 | - do_action( 'give_donation_history_row_start', $post->ID, $donation_data ); |
|
110 | + do_action('give_donation_history_row_start', $post->ID, $donation_data); |
|
111 | 111 | |
112 | - if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
112 | + if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) : |
|
113 | 113 | echo sprintf( |
114 | 114 | '<td class="give-donation-id">#%1$s</td>', |
115 | - give_get_payment_number( $post->ID ) |
|
115 | + give_get_payment_number($post->ID) |
|
116 | 116 | ); |
117 | 117 | endif; |
118 | 118 | |
119 | - if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
119 | + if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) : |
|
120 | 120 | echo sprintf( |
121 | 121 | '<td class="give-donation-date">%1$s</td>', |
122 | - date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ) |
|
122 | + date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))) |
|
123 | 123 | ); |
124 | 124 | endif; |
125 | 125 | |
126 | - if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
126 | + if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) : |
|
127 | 127 | echo sprintf( |
128 | 128 | '<td class="give-donation-donor">%1$s</td>', |
129 | - give_get_donor_name_by( $post->ID ) |
|
129 | + give_get_donor_name_by($post->ID) |
|
130 | 130 | ); |
131 | 131 | endif; |
132 | 132 | ?> |
133 | 133 | |
134 | - <?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
134 | + <?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
135 | 135 | <td class="give-donation-amount"> |
136 | 136 | <span class="give-donation-amount"> |
137 | 137 | <?php |
138 | - $currency_code = give_get_payment_currency_code( $post->ID ); |
|
139 | - $donation_amount = give_donation_amount( $post->ID, true ); |
|
138 | + $currency_code = give_get_payment_currency_code($post->ID); |
|
139 | + $donation_amount = give_donation_amount($post->ID, true); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Filters the donation amount on Donation History Page. |
@@ -148,42 +148,42 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return int |
150 | 150 | */ |
151 | - echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID ); |
|
151 | + echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID); |
|
152 | 152 | ?> |
153 | 153 | </span> |
154 | 154 | </td> |
155 | 155 | <?php endif; ?> |
156 | 156 | |
157 | 157 | <?php |
158 | - if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
158 | + if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) : |
|
159 | 159 | echo sprintf( |
160 | 160 | '<td class="give-donation-status">%1$s</td>', |
161 | - give_get_payment_status( $post, true ) |
|
161 | + give_get_payment_status($post, true) |
|
162 | 162 | ); |
163 | 163 | endif; |
164 | 164 | |
165 | - if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
165 | + if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) : |
|
166 | 166 | echo sprintf( |
167 | 167 | '<td class="give-donation-payment-method">%1$s</td>', |
168 | - give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) ) |
|
168 | + give_get_gateway_checkout_label(give_get_payment_gateway($post->ID)) |
|
169 | 169 | ); |
170 | 170 | endif; |
171 | 171 | ?> |
172 | 172 | <td class="give-donation-details"> |
173 | 173 | <?php |
174 | 174 | // Display View Receipt or. |
175 | - if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) : |
|
175 | + if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) : |
|
176 | 176 | echo sprintf( |
177 | 177 | '<a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>', |
178 | 178 | esc_url( |
179 | 179 | add_query_arg( |
180 | 180 | 'payment_key', |
181 | - give_get_payment_key( $post->ID ), |
|
181 | + give_get_payment_key($post->ID), |
|
182 | 182 | give_get_history_page_uri() |
183 | 183 | ) |
184 | 184 | ), |
185 | 185 | $post->post_status, |
186 | - __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
|
186 | + __('View', 'give').' '.give_get_payment_status($post, true).' »' |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | else : |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | esc_url( |
193 | 193 | add_query_arg( |
194 | 194 | 'payment_key', |
195 | - give_get_payment_key( $post->ID ), |
|
195 | + give_get_payment_key($post->ID), |
|
196 | 196 | give_get_history_page_uri() |
197 | 197 | ) |
198 | 198 | ), |
199 | - __( 'View Receipt »', 'give' ) |
|
199 | + __('View Receipt »', 'give') |
|
200 | 200 | ); |
201 | 201 | |
202 | 202 | endif; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param int $post_id The ID of the post. |
214 | 214 | * @param mixed $donation_data Payment meta data. |
215 | 215 | */ |
216 | - do_action( 'give_donation_history_row_end', $post->ID, $donation_data ); |
|
216 | + do_action('give_donation_history_row_end', $post->ID, $donation_data); |
|
217 | 217 | ?> |
218 | 218 | </tr> |
219 | 219 | <?php endforeach; ?> |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.8.17 |
228 | 228 | */ |
229 | - do_action( 'give_donation_history_table_end' ); |
|
229 | + do_action('give_donation_history_table_end'); |
|
230 | 230 | ?> |
231 | 231 | </table> |
232 | 232 | <div id="give-donation-history-pagination" class="give_pagination navigation"> |
233 | 233 | <?php |
234 | 234 | $big = 999999; |
235 | - echo paginate_links( array( |
|
236 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
235 | + echo paginate_links(array( |
|
236 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
237 | 237 | 'format' => '?paged=%#%', |
238 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
239 | - 'total' => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page |
|
240 | - ) ); |
|
238 | + 'current' => max(1, get_query_var('paged')), |
|
239 | + 'total' => ceil(give_count_donations_of_donor() / 20) // 20 items per page |
|
240 | + )); |
|
241 | 241 | ?> |
242 | 242 | </div> |
243 | 243 | </div> |
244 | 244 | <?php wp_reset_postdata(); ?> |
245 | 245 | <?php else : ?> |
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
246 | + <?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?> |
|
247 | 247 | <?php endif; |
248 | 248 | \ No newline at end of file |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - $donation_list_page_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + $donation_list_page_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
69 | 69 | |
70 | - switch ( $column_name ) { |
|
70 | + switch ($column_name) { |
|
71 | 71 | case 'complete_sales': |
72 | - $value = $item[ $column_name ] ? |
|
72 | + $value = $item[$column_name] ? |
|
73 | 73 | sprintf( |
74 | 74 | '<a href="%s">%s</a>', |
75 | 75 | add_query_arg( |
@@ -79,13 +79,12 @@ discard block |
||
79 | 79 | ), |
80 | 80 | $donation_list_page_url |
81 | 81 | ), |
82 | - $item[ $column_name ] |
|
83 | - ) : |
|
84 | - $item[ $column_name ]; |
|
82 | + $item[$column_name] |
|
83 | + ) : $item[$column_name]; |
|
85 | 84 | break; |
86 | 85 | |
87 | 86 | case 'pending_sales': |
88 | - $value = $item[ $column_name ] ? |
|
87 | + $value = $item[$column_name] ? |
|
89 | 88 | sprintf( |
90 | 89 | '<a href="%s">%s</a>', |
91 | 90 | add_query_arg( |
@@ -95,13 +94,12 @@ discard block |
||
95 | 94 | ), |
96 | 95 | $donation_list_page_url |
97 | 96 | ), |
98 | - $item[ $column_name ] |
|
99 | - ) : |
|
100 | - $item[ $column_name ]; |
|
97 | + $item[$column_name] |
|
98 | + ) : $item[$column_name]; |
|
101 | 99 | break; |
102 | 100 | |
103 | 101 | case 'total_sales': |
104 | - $value = $item[ $column_name ] ? |
|
102 | + $value = $item[$column_name] ? |
|
105 | 103 | sprintf( |
106 | 104 | '<a href="%s">%s</a>', |
107 | 105 | add_query_arg( |
@@ -110,14 +108,13 @@ discard block |
||
110 | 108 | ), |
111 | 109 | $donation_list_page_url |
112 | 110 | ), |
113 | - $item[ $column_name ] |
|
114 | - ) : |
|
115 | - $item[ $column_name ]; |
|
111 | + $item[$column_name] |
|
112 | + ) : $item[$column_name]; |
|
116 | 113 | |
117 | 114 | break; |
118 | 115 | |
119 | 116 | default: |
120 | - $value = $item[ $column_name ]; |
|
117 | + $value = $item[$column_name]; |
|
121 | 118 | } |
122 | 119 | |
123 | 120 | return $value; |
@@ -132,11 +129,11 @@ discard block |
||
132 | 129 | */ |
133 | 130 | public function get_columns() { |
134 | 131 | $columns = array( |
135 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
136 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
137 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
138 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
139 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
132 | + 'label' => esc_attr__('Gateway', 'give'), |
|
133 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
134 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
135 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
136 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
140 | 137 | ); |
141 | 138 | |
142 | 139 | return $columns; |
@@ -151,7 +148,7 @@ discard block |
||
151 | 148 | */ |
152 | 149 | public function get_sortable_columns() { |
153 | 150 | return array( |
154 | - 'total_donations' => array( 'total_donations', false ) |
|
151 | + 'total_donations' => array('total_donations', false) |
|
155 | 152 | ); |
156 | 153 | } |
157 | 154 | |
@@ -164,7 +161,7 @@ discard block |
||
164 | 161 | * @return int Current page number |
165 | 162 | */ |
166 | 163 | public function get_paged() { |
167 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
164 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
168 | 165 | } |
169 | 166 | |
170 | 167 | |
@@ -175,7 +172,7 @@ discard block |
||
175 | 172 | * @since 1.0 |
176 | 173 | * @return void |
177 | 174 | */ |
178 | - public function bulk_actions( $which = '' ) { |
|
175 | + public function bulk_actions($which = '') { |
|
179 | 176 | |
180 | 177 | } |
181 | 178 | |
@@ -187,27 +184,27 @@ discard block |
||
187 | 184 | * |
188 | 185 | * @param string $which |
189 | 186 | */ |
190 | - protected function display_tablenav( $which ) { |
|
187 | + protected function display_tablenav($which) { |
|
191 | 188 | |
192 | - if ( 'top' === $which ) { |
|
193 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
189 | + if ('top' === $which) { |
|
190 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
194 | 191 | } |
195 | 192 | ?> |
196 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
193 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
197 | 194 | |
198 | - <?php if ( 'top' === $which ) { ?> |
|
195 | + <?php if ('top' === $which) { ?> |
|
199 | 196 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
200 | - <?php _e( 'Donation Methods Report', 'give' ); ?> |
|
197 | + <?php _e('Donation Methods Report', 'give'); ?> |
|
201 | 198 | </h2> |
202 | 199 | <?php } ?> |
203 | 200 | |
204 | 201 | <div class="alignright tablenav-right"> |
205 | 202 | <div class="actions bulkactions"> |
206 | - <?php $this->bulk_actions( $which ); ?> |
|
203 | + <?php $this->bulk_actions($which); ?> |
|
207 | 204 | </div> |
208 | 205 | <?php |
209 | - $this->extra_tablenav( $which ); |
|
210 | - $this->pagination( $which ); |
|
206 | + $this->extra_tablenav($which); |
|
207 | + $this->pagination($which); |
|
211 | 208 | ?> |
212 | 209 | </div> |
213 | 210 | |
@@ -229,17 +226,17 @@ discard block |
||
229 | 226 | * |
230 | 227 | * @return int |
231 | 228 | */ |
232 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
229 | + public function give_sort_total_donations($old_value, $new_value) { |
|
233 | 230 | // If no sort, default to label. |
234 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
231 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
235 | 232 | |
236 | 233 | //If no order, default to asc. |
237 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
234 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
238 | 235 | |
239 | 236 | //Determine sort order. |
240 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
237 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
241 | 238 | |
242 | - return ( $order === 'asc' ) ? $result : -$result; |
|
239 | + return ($order === 'asc') ? $result : -$result; |
|
243 | 240 | } |
244 | 241 | |
245 | 242 | |
@@ -256,10 +253,10 @@ discard block |
||
256 | 253 | $gateways = give_get_payment_gateways(); |
257 | 254 | $stats = new Give_Payment_Stats(); |
258 | 255 | |
259 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
256 | + foreach ($gateways as $gateway_id => $gateway) { |
|
260 | 257 | |
261 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
262 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
258 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
259 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
263 | 260 | |
264 | 261 | $reports_data[] = array( |
265 | 262 | 'ID' => $gateway_id, |
@@ -267,7 +264,7 @@ discard block |
||
267 | 264 | 'complete_sales' => $complete_count, |
268 | 265 | 'pending_sales' => $pending_count, |
269 | 266 | 'total_sales' => $complete_count + $pending_count, |
270 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
267 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
271 | 268 | ); |
272 | 269 | } |
273 | 270 | |
@@ -288,11 +285,11 @@ discard block |
||
288 | 285 | $columns = $this->get_columns(); |
289 | 286 | $hidden = array(); // No hidden columns |
290 | 287 | $sortable = $this->get_sortable_columns(); |
291 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
288 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
292 | 289 | $this->items = $this->reports_data(); |
293 | 290 | |
294 | 291 | // Sort Array when we are sorting data in array. |
295 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
292 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
296 | 293 | |
297 | 294 | } |
298 | 295 | } |
@@ -10,17 +10,17 @@ |
||
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 | <div class="wrap" id="poststuff"> |
18 | 18 | <div id="give-updates"> |
19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
20 | 20 | <hr class="wp-header-end"> |
21 | 21 | |
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and its add-ons.', 'give' ); ?></p> |
|
23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and its add-ons.', 'give'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | </div> |
@@ -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' => __( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => __( 'Email', 'give' ), |
|
45 | - 'first' => __( 'First Name', 'give' ), |
|
46 | - 'last' => __( 'Last Name', 'give' ), |
|
47 | - 'address1' => __( 'Address 1', 'give' ), |
|
48 | - 'address2' => __( 'Address 2', 'give' ), |
|
49 | - 'city' => __( 'City', 'give' ), |
|
50 | - 'state' => __( 'State', 'give' ), |
|
51 | - 'country' => __( 'Country', 'give' ), |
|
52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => __( 'Form ID', 'give' ), |
|
54 | - 'form_name' => __( 'Form Name', 'give' ), |
|
55 | - 'amount' => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')', |
|
56 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
58 | - 'key' => __( 'Key', 'give' ), |
|
59 | - 'date' => __( 'Date', 'give' ), |
|
60 | - 'user' => __( 'User', 'give' ), |
|
61 | - 'status' => __( 'Status', 'give' ) |
|
42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => __('Email', 'give'), |
|
45 | + 'first' => __('First Name', 'give'), |
|
46 | + 'last' => __('Last Name', 'give'), |
|
47 | + 'address1' => __('Address 1', 'give'), |
|
48 | + 'address2' => __('Address 2', 'give'), |
|
49 | + 'city' => __('City', 'give'), |
|
50 | + 'state' => __('State', 'give'), |
|
51 | + 'country' => __('Country', 'give'), |
|
52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => __('Form ID', 'give'), |
|
54 | + 'form_name' => __('Form Name', 'give'), |
|
55 | + 'amount' => __('Amount', 'give').' ('.give_currency_symbol('', true).')', |
|
56 | + 'gateway' => __('Payment Method', 'give'), |
|
57 | + 'trans_id' => __('Transaction ID', 'give'), |
|
58 | + 'key' => __('Key', 'give'), |
|
59 | + 'date' => __('Date', 'give'), |
|
60 | + 'user' => __('User', 'give'), |
|
61 | + 'status' => __('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; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | 'status' => $this->status |
87 | 87 | ); |
88 | 88 | |
89 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
89 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
90 | 90 | |
91 | 91 | $args['date_query'] = array( |
92 | 92 | array( |
93 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
94 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
93 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
94 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
95 | 95 | 'inclusive' => true |
96 | 96 | ) |
97 | 97 | ); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Add category or tag to payment query if any. |
102 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
102 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
103 | 103 | $form_args = array( |
104 | 104 | 'post_type' => 'give_forms', |
105 | 105 | 'post_status' => 'publish', |
106 | - 'posts_per_page' => - 1, |
|
106 | + 'posts_per_page' => -1, |
|
107 | 107 | 'fields' => 'ids', |
108 | 108 | 'tax_query' => array( |
109 | 109 | 'relation' => 'AND', |
@@ -111,72 +111,72 @@ discard block |
||
111 | 111 | ); |
112 | 112 | |
113 | 113 | |
114 | - if ( ! empty( $this->categories ) ) { |
|
114 | + if ( ! empty($this->categories)) { |
|
115 | 115 | $form_args['tax_query'][] = array( |
116 | 116 | 'taxonomy' => 'give_forms_category', |
117 | 117 | 'terms' => $this->categories, |
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
121 | - if ( ! empty( $this->tags ) ) { |
|
121 | + if ( ! empty($this->tags)) { |
|
122 | 122 | $form_args['tax_query'][] = array( |
123 | 123 | 'taxonomy' => 'give_forms_tag', |
124 | 124 | 'terms' => $this->tags, |
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
128 | - $forms = new WP_Query( $form_args ); |
|
128 | + $forms = new WP_Query($form_args); |
|
129 | 129 | |
130 | - if ( empty( $forms->posts ) ) { |
|
130 | + if (empty($forms->posts)) { |
|
131 | 131 | return array(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | $args['give_forms'] = $forms->posts; |
135 | 135 | } |
136 | 136 | |
137 | - $payments = give_get_payments( $args ); |
|
137 | + $payments = give_get_payments($args); |
|
138 | 138 | |
139 | - if ( $payments ) { |
|
139 | + if ($payments) { |
|
140 | 140 | |
141 | - foreach ( $payments as $payment ) { |
|
142 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
143 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
144 | - $total = give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
145 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
141 | + foreach ($payments as $payment) { |
|
142 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
143 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
144 | + $total = give_donation_amount($payment->ID, array('type' => 'stats')); |
|
145 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
146 | 146 | |
147 | - if ( is_numeric( $user_id ) ) { |
|
148 | - $user = get_userdata( $user_id ); |
|
147 | + if (is_numeric($user_id)) { |
|
148 | + $user = get_userdata($user_id); |
|
149 | 149 | } else { |
150 | 150 | $user = false; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $data[] = array( |
154 | 154 | 'id' => $payment->ID, |
155 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
155 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
156 | 156 | 'email' => $payment_meta['email'], |
157 | 157 | 'first' => $user_info['first_name'], |
158 | 158 | 'last' => $user_info['last_name'], |
159 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
160 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
161 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
162 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
163 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
164 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
165 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
166 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
167 | - 'amount' => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ), |
|
168 | - 'gateway' => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
169 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
159 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
160 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
161 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
162 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
163 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
164 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
165 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
166 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
167 | + 'amount' => html_entity_decode(give_format_amount($total, array('sanitize' => false))), |
|
168 | + 'gateway' => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)), |
|
169 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
170 | 170 | 'key' => $payment_meta['key'], |
171 | 171 | 'date' => $payment->post_date, |
172 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
173 | - 'status' => give_get_payment_status( $payment, true ) |
|
172 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
173 | + 'status' => give_get_payment_status($payment, true) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
179 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
178 | + $data = apply_filters('give_export_get_data', $data); |
|
179 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
180 | 180 | |
181 | 181 | return $data; |
182 | 182 | |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | |
197 | 197 | $status = $this->status; |
198 | 198 | $args = array( |
199 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
200 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
199 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
200 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
201 | 201 | ); |
202 | 202 | |
203 | - if ( 'any' == $status ) { |
|
203 | + if ('any' == $status) { |
|
204 | 204 | |
205 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
205 | + $total = array_sum((array) give_count_payments($args)); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | |
209 | - $total = give_count_payments( $args )->$status; |
|
209 | + $total = give_count_payments($args)->$status; |
|
210 | 210 | |
211 | 211 | } |
212 | 212 | |
213 | 213 | $percentage = 100; |
214 | 214 | |
215 | - if ( $total > 0 ) { |
|
216 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
215 | + if ($total > 0) { |
|
216 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( $percentage > 100 ) { |
|
219 | + if ($percentage > 100) { |
|
220 | 220 | $percentage = 100; |
221 | 221 | } |
222 | 222 | |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param array $request The Form Data passed into the batch processing. |
232 | 232 | */ |
233 | - public function set_properties( $request ) { |
|
234 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
235 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
236 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
237 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
238 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
233 | + public function set_properties($request) { |
|
234 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
235 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
236 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
237 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
238 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
239 | 239 | } |
240 | 240 | } |
@@ -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 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | give_ignore_user_abort(); |
43 | 43 | |
44 | 44 | nocache_headers(); |
45 | - header( 'Content-Type: application/json; charset=utf-8' ); |
|
46 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' ); |
|
47 | - header( 'Expires: 0' ); |
|
45 | + header('Content-Type: application/json; charset=utf-8'); |
|
46 | + header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json'); |
|
47 | + header('Expires: 0'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @since 1.8.17 |
55 | 55 | */ |
56 | 56 | public function json_core_settings_export() { |
57 | - echo wp_json_encode( get_option( 'give_settings' ) ); |
|
57 | + echo wp_json_encode(get_option('give_settings')); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @since 1.8.17 |
65 | 65 | */ |
66 | 66 | public function export() { |
67 | - if ( ! $this->can_export() ) { |
|
68 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
67 | + if ( ! $this->can_export()) { |
|
68 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Set headers. |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | give_ignore_user_abort(); |
52 | 52 | |
53 | 53 | nocache_headers(); |
54 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
55 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
56 | - header( "Expires: 0" ); |
|
54 | + header('Content-Type: text/csv; charset=utf-8'); |
|
55 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
56 | + header("Expires: 0"); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function csv_cols() { |
67 | 67 | $cols = array( |
68 | - 'id' => __( 'ID', 'give' ), |
|
69 | - 'date' => __( 'Date', 'give' ) |
|
68 | + 'id' => __('ID', 'give'), |
|
69 | + 'date' => __('Date', 'give') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | return $cols; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function get_csv_cols() { |
83 | 83 | $cols = $this->csv_cols(); |
84 | 84 | |
85 | - return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols ); |
|
85 | + return apply_filters("give_export_csv_cols_{$this->export_type}", $cols); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | public function csv_cols_out() { |
97 | 97 | $cols = $this->get_csv_cols(); |
98 | 98 | $i = 1; |
99 | - foreach ( $cols as $col_id => $column ) { |
|
100 | - echo '"' . addslashes( $column ) . '"'; |
|
101 | - echo $i == count( $cols ) ? '' : ','; |
|
102 | - $i ++; |
|
99 | + foreach ($cols as $col_id => $column) { |
|
100 | + echo '"'.addslashes($column).'"'; |
|
101 | + echo $i == count($cols) ? '' : ','; |
|
102 | + $i++; |
|
103 | 103 | } |
104 | 104 | echo "\r\n"; |
105 | 105 | } |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | $data = array( |
117 | 117 | 0 => array( |
118 | 118 | 'id' => '', |
119 | - 'data' => date( 'F j, Y' ) |
|
119 | + 'data' => date('F j, Y') |
|
120 | 120 | ), |
121 | 121 | 1 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
127 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
128 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
127 | + $data = apply_filters('give_export_get_data', $data); |
|
128 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
129 | 129 | |
130 | 130 | return $data; |
131 | 131 | } |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | $cols = $this->get_csv_cols(); |
144 | 144 | |
145 | 145 | // Output each row |
146 | - foreach ( $data as $row ) { |
|
146 | + foreach ($data as $row) { |
|
147 | 147 | $i = 1; |
148 | - foreach ( $row as $col_id => $column ) { |
|
148 | + foreach ($row as $col_id => $column) { |
|
149 | 149 | // Make sure the column is valid |
150 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
151 | - echo '"' . addslashes( $column ) . '"'; |
|
152 | - echo $i == count( $cols ) ? '' : ','; |
|
153 | - $i ++; |
|
150 | + if (array_key_exists($col_id, $cols)) { |
|
151 | + echo '"'.addslashes($column).'"'; |
|
152 | + echo $i == count($cols) ? '' : ','; |
|
153 | + $i++; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | echo "\r\n"; |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @return void |
170 | 170 | */ |
171 | 171 | public function export() { |
172 | - if ( ! $this->can_export() ) { |
|
173 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
172 | + if ( ! $this->can_export()) { |
|
173 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // Set headers |
@@ -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 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | give_ignore_user_abort(); |
42 | 42 | |
43 | 43 | nocache_headers(); |
44 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
45 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
46 | - header( "Expires: 0" ); |
|
44 | + header('Content-Type: text/csv; charset=utf-8'); |
|
45 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
46 | + header("Expires: 0"); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public function csv_cols() { |
58 | 58 | |
59 | 59 | $cols = array( |
60 | - 'date' => __( 'Date', 'give' ), |
|
61 | - 'donations' => __( 'Donations', 'give' ), |
|
60 | + 'date' => __('Date', 'give'), |
|
61 | + 'donations' => __('Donations', 'give'), |
|
62 | 62 | /* translators: %s: currency */ |
63 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) ) |
|
63 | + 'earnings' => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true)) |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | return $cols; |
@@ -75,28 +75,28 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function get_data() { |
77 | 77 | |
78 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
79 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
80 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
81 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
78 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
79 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
80 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
81 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
82 | 82 | |
83 | 83 | $data = array(); |
84 | 84 | $year = $start_year; |
85 | 85 | $stats = new Give_Payment_Stats; |
86 | 86 | |
87 | - while ( $year <= $end_year ) { |
|
87 | + while ($year <= $end_year) { |
|
88 | 88 | |
89 | - if ( $year == $start_year && $year == $end_year ) { |
|
89 | + if ($year == $start_year && $year == $end_year) { |
|
90 | 90 | |
91 | 91 | $m1 = $start_month; |
92 | 92 | $m2 = $end_month; |
93 | 93 | |
94 | - } elseif ( $year == $start_year ) { |
|
94 | + } elseif ($year == $start_year) { |
|
95 | 95 | |
96 | 96 | $m1 = $start_month; |
97 | 97 | $m2 = 12; |
98 | 98 | |
99 | - } elseif ( $year == $end_year ) { |
|
99 | + } elseif ($year == $end_year) { |
|
100 | 100 | |
101 | 101 | $m1 = 1; |
102 | 102 | $m2 = $end_month; |
@@ -108,28 +108,28 @@ discard block |
||
108 | 108 | |
109 | 109 | } |
110 | 110 | |
111 | - while ( $m1 <= $m2 ) { |
|
111 | + while ($m1 <= $m2) { |
|
112 | 112 | |
113 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
114 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
113 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
114 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
115 | 115 | |
116 | 116 | $data[] = array( |
117 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
118 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
119 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ), |
|
117 | + 'date' => date_i18n('F Y', $date1), |
|
118 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
119 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)), |
|
120 | 120 | ); |
121 | 121 | |
122 | - $m1 ++; |
|
122 | + $m1++; |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | - $year ++; |
|
127 | + $year++; |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -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 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
39 | - add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10, 1 ); |
|
40 | - add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard' ), 10 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | + add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10, 1); |
|
40 | + add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | public function add_roles() { |
54 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
54 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
55 | 55 | 'read' => true, |
56 | 56 | 'edit_posts' => true, |
57 | 57 | 'delete_posts' => true, |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | 'publish_posts' => true, |
81 | 81 | 'read_private_pages' => true, |
82 | 82 | 'read_private_posts' => true, |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
85 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
86 | 86 | 'read' => true, |
87 | 87 | 'edit_posts' => false, |
88 | 88 | 'delete_posts' => false, |
89 | - ) ); |
|
89 | + )); |
|
90 | 90 | |
91 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
91 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
92 | 92 | 'read' => true, |
93 | 93 | 'edit_posts' => true, |
94 | 94 | 'edit_pages' => true, |
95 | 95 | 'upload_files' => true, |
96 | 96 | 'delete_posts' => false, |
97 | - ) ); |
|
97 | + )); |
|
98 | 98 | |
99 | - add_role( 'give_donor', __( 'Give Donor', 'give' ), array( |
|
99 | + add_role('give_donor', __('Give Donor', 'give'), array( |
|
100 | 100 | 'read' => true, |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
@@ -117,53 +117,53 @@ discard block |
||
117 | 117 | public function add_caps() { |
118 | 118 | global $wp_roles; |
119 | 119 | |
120 | - if ( class_exists( 'WP_Roles' ) ) { |
|
121 | - if ( ! isset( $wp_roles ) ) { |
|
120 | + if (class_exists('WP_Roles')) { |
|
121 | + if ( ! isset($wp_roles)) { |
|
122 | 122 | $wp_roles = new WP_Roles(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if ( is_object( $wp_roles ) ) { |
|
127 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
129 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
130 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
126 | + if (is_object($wp_roles)) { |
|
127 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
128 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
129 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
130 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
131 | 131 | |
132 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
133 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
134 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
135 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
136 | - $wp_roles->add_cap( 'administrator', 'view_give_payments' ); |
|
132 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
133 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
134 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
135 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
136 | + $wp_roles->add_cap('administrator', 'view_give_payments'); |
|
137 | 137 | |
138 | 138 | // Add the main post type capabilities. |
139 | 139 | $capabilities = $this->get_core_caps(); |
140 | - foreach ( $capabilities as $cap_group ) { |
|
141 | - foreach ( $cap_group as $cap ) { |
|
142 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
143 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
140 | + foreach ($capabilities as $cap_group) { |
|
141 | + foreach ($cap_group as $cap) { |
|
142 | + $wp_roles->add_cap('administrator', $cap); |
|
143 | + $wp_roles->add_cap('give_manager', $cap); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Add Capabilities to Give Workers User Role. |
148 | - $wp_roles->add_cap( 'give_worker', 'edit_give_payments' ); |
|
149 | - $wp_roles->add_cap( 'give_worker', 'delete_give_forms' ); |
|
150 | - $wp_roles->add_cap( 'give_worker', 'delete_others_give_forms' ); |
|
151 | - $wp_roles->add_cap( 'give_worker', 'delete_private_give_forms' ); |
|
152 | - $wp_roles->add_cap( 'give_worker', 'delete_published_give_forms' ); |
|
153 | - $wp_roles->add_cap( 'give_worker', 'edit_give_forms' ); |
|
154 | - $wp_roles->add_cap( 'give_worker', 'edit_others_give_forms' ); |
|
155 | - $wp_roles->add_cap( 'give_worker', 'edit_private_give_forms' ); |
|
156 | - $wp_roles->add_cap( 'give_worker', 'edit_published_give_forms' ); |
|
157 | - $wp_roles->add_cap( 'give_worker', 'publish_give_forms' ); |
|
158 | - $wp_roles->add_cap( 'give_worker', 'read_private_give_forms' ); |
|
148 | + $wp_roles->add_cap('give_worker', 'edit_give_payments'); |
|
149 | + $wp_roles->add_cap('give_worker', 'delete_give_forms'); |
|
150 | + $wp_roles->add_cap('give_worker', 'delete_others_give_forms'); |
|
151 | + $wp_roles->add_cap('give_worker', 'delete_private_give_forms'); |
|
152 | + $wp_roles->add_cap('give_worker', 'delete_published_give_forms'); |
|
153 | + $wp_roles->add_cap('give_worker', 'edit_give_forms'); |
|
154 | + $wp_roles->add_cap('give_worker', 'edit_others_give_forms'); |
|
155 | + $wp_roles->add_cap('give_worker', 'edit_private_give_forms'); |
|
156 | + $wp_roles->add_cap('give_worker', 'edit_published_give_forms'); |
|
157 | + $wp_roles->add_cap('give_worker', 'publish_give_forms'); |
|
158 | + $wp_roles->add_cap('give_worker', 'read_private_give_forms'); |
|
159 | 159 | |
160 | 160 | // Add Capabilities to Give Accountant User Role. |
161 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
162 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
163 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
164 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
165 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
166 | - $wp_roles->add_cap( 'give_accountant', 'view_give_payments' ); |
|
161 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
162 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
163 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
164 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
165 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
166 | + $wp_roles->add_cap('give_accountant', 'view_give_payments'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | } |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | public function get_core_caps() { |
182 | 182 | $capabilities = array(); |
183 | 183 | |
184 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
184 | + $capability_types = array('give_form', 'give_payment'); |
|
185 | 185 | |
186 | - foreach ( $capability_types as $capability_type ) { |
|
187 | - $capabilities[ $capability_type ] = array( |
|
186 | + foreach ($capability_types as $capability_type) { |
|
187 | + $capabilities[$capability_type] = array( |
|
188 | 188 | // Post type. |
189 | 189 | "edit_{$capability_type}", |
190 | 190 | "read_{$capability_type}", |
@@ -230,22 +230,22 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return array $caps Meta capabilities. |
232 | 232 | */ |
233 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
233 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
234 | 234 | |
235 | - switch ( $cap ) { |
|
235 | + switch ($cap) { |
|
236 | 236 | |
237 | 237 | case 'view_give_form_stats' : |
238 | 238 | |
239 | - if ( empty( $args[0] ) ) { |
|
239 | + if (empty($args[0])) { |
|
240 | 240 | break; |
241 | 241 | } |
242 | 242 | |
243 | - $form = get_post( $args[0] ); |
|
244 | - if ( empty( $form ) ) { |
|
243 | + $form = get_post($args[0]); |
|
244 | + if (empty($form)) { |
|
245 | 245 | break; |
246 | 246 | } |
247 | 247 | |
248 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
248 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
249 | 249 | $caps = array(); |
250 | 250 | } |
251 | 251 | |
@@ -272,57 +272,57 @@ discard block |
||
272 | 272 | |
273 | 273 | global $wp_roles; |
274 | 274 | |
275 | - if ( class_exists( 'WP_Roles' ) ) { |
|
276 | - if ( ! isset( $wp_roles ) ) { |
|
275 | + if (class_exists('WP_Roles')) { |
|
276 | + if ( ! isset($wp_roles)) { |
|
277 | 277 | $wp_roles = new WP_Roles(); |
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | - if ( is_object( $wp_roles ) ) { |
|
281 | + if (is_object($wp_roles)) { |
|
282 | 282 | // Give Manager Capabilities. |
283 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
284 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
285 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
286 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
283 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
284 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
285 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
286 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
287 | 287 | |
288 | 288 | // Site Administrator Capabilities. |
289 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
290 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
291 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
292 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
293 | - $wp_roles->remove_cap( 'administrator', 'view_give_payments' ); |
|
289 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
290 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
291 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
292 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
293 | + $wp_roles->remove_cap('administrator', 'view_give_payments'); |
|
294 | 294 | |
295 | 295 | // Remove the Main Post Type Capabilities. |
296 | 296 | $capabilities = $this->get_core_caps(); |
297 | 297 | |
298 | - foreach ( $capabilities as $cap_group ) { |
|
299 | - foreach ( $cap_group as $cap ) { |
|
300 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
301 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
298 | + foreach ($capabilities as $cap_group) { |
|
299 | + foreach ($cap_group as $cap) { |
|
300 | + $wp_roles->remove_cap('give_manager', $cap); |
|
301 | + $wp_roles->remove_cap('administrator', $cap); |
|
302 | 302 | |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | 306 | // Remove capabilities from the Give Worker role. |
307 | - $wp_roles->remove_cap( 'give_worker', 'edit_give_payments' ); |
|
308 | - $wp_roles->remove_cap( 'give_worker', 'delete_give_forms' ); |
|
309 | - $wp_roles->remove_cap( 'give_worker', 'delete_others_give_forms' ); |
|
310 | - $wp_roles->remove_cap( 'give_worker', 'delete_private_give_forms' ); |
|
311 | - $wp_roles->remove_cap( 'give_worker', 'delete_published_give_forms' ); |
|
312 | - $wp_roles->remove_cap( 'give_worker', 'edit_give_forms' ); |
|
313 | - $wp_roles->remove_cap( 'give_worker', 'edit_others_give_forms' ); |
|
314 | - $wp_roles->remove_cap( 'give_worker', 'edit_private_give_forms' ); |
|
315 | - $wp_roles->remove_cap( 'give_worker', 'edit_published_give_forms' ); |
|
316 | - $wp_roles->remove_cap( 'give_worker', 'publish_give_forms' ); |
|
317 | - $wp_roles->remove_cap( 'give_worker', 'read_private_give_forms' ); |
|
307 | + $wp_roles->remove_cap('give_worker', 'edit_give_payments'); |
|
308 | + $wp_roles->remove_cap('give_worker', 'delete_give_forms'); |
|
309 | + $wp_roles->remove_cap('give_worker', 'delete_others_give_forms'); |
|
310 | + $wp_roles->remove_cap('give_worker', 'delete_private_give_forms'); |
|
311 | + $wp_roles->remove_cap('give_worker', 'delete_published_give_forms'); |
|
312 | + $wp_roles->remove_cap('give_worker', 'edit_give_forms'); |
|
313 | + $wp_roles->remove_cap('give_worker', 'edit_others_give_forms'); |
|
314 | + $wp_roles->remove_cap('give_worker', 'edit_private_give_forms'); |
|
315 | + $wp_roles->remove_cap('give_worker', 'edit_published_give_forms'); |
|
316 | + $wp_roles->remove_cap('give_worker', 'publish_give_forms'); |
|
317 | + $wp_roles->remove_cap('give_worker', 'read_private_give_forms'); |
|
318 | 318 | |
319 | 319 | // Remove Capabilities from Give Accountant User Role. |
320 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
321 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
322 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
323 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
324 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_payments' ); |
|
325 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_payments' ); |
|
320 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
321 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
322 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
323 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
324 | + $wp_roles->remove_cap('give_accountant', 'edit_give_payments'); |
|
325 | + $wp_roles->remove_cap('give_accountant', 'view_give_payments'); |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $current_user = wp_get_current_user(); |
346 | 346 | |
347 | 347 | // If user with "Give Accountant" user role is logged-in . |
348 | - if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) { |
|
348 | + if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) { |
|
349 | 349 | |
350 | 350 | // Return false, means no prevention. |
351 | 351 | return false; |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string The currency code |
22 | 22 | */ |
23 | -function give_get_currency( $donation_or_form_id = null, $args = array() ) { |
|
23 | +function give_get_currency($donation_or_form_id = null, $args = array()) { |
|
24 | 24 | |
25 | 25 | // Get currency from donation |
26 | - if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) { |
|
27 | - $donation_meta = give_get_meta( $donation_or_form_id, '_give_payment_meta', true ); |
|
26 | + if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) { |
|
27 | + $donation_meta = give_get_meta($donation_or_form_id, '_give_payment_meta', true); |
|
28 | 28 | |
29 | - if ( ! empty( $donation_meta['currency'] ) ) { |
|
29 | + if ( ! empty($donation_meta['currency'])) { |
|
30 | 30 | $currency = $donation_meta['currency']; |
31 | 31 | } else { |
32 | - $currency = give_get_option( 'currency', 'USD' ); |
|
32 | + $currency = give_get_option('currency', 'USD'); |
|
33 | 33 | } |
34 | 34 | } else { |
35 | - $currency = give_get_option( 'currency', 'USD' ); |
|
35 | + $currency = give_get_option('currency', 'USD'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
43 | + return apply_filters('give_currency', $currency, $donation_or_form_id, $args); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function give_get_currency_position() { |
54 | 54 | |
55 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
55 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
56 | 56 | |
57 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
57 | + return apply_filters('give_currency_position', $currency_pos); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | function give_get_currencies_list() { |
68 | 68 | $currencies = array( |
69 | 69 | 'USD' => array( |
70 | - 'admin_label' => __( 'US Dollars ($)', 'give' ), |
|
70 | + 'admin_label' => __('US Dollars ($)', 'give'), |
|
71 | 71 | 'symbol' => '$', |
72 | 72 | 'setting' => array( |
73 | 73 | 'currency_position' => 'before', |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ), |
78 | 78 | ), |
79 | 79 | 'EUR' => array( |
80 | - 'admin_label' => __( 'Euros (€)', 'give' ), |
|
80 | + 'admin_label' => __('Euros (€)', 'give'), |
|
81 | 81 | 'symbol' => '€', |
82 | 82 | 'setting' => array( |
83 | 83 | 'currency_position' => 'before', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | 'GBP' => array( |
90 | - 'admin_label' => __( 'Pounds Sterling (£)', 'give' ), |
|
90 | + 'admin_label' => __('Pounds Sterling (£)', 'give'), |
|
91 | 91 | 'symbol' => '£', |
92 | 92 | 'setting' => array( |
93 | 93 | 'currency_position' => 'before', |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | 'AUD' => array( |
100 | - 'admin_label' => __( 'Australian Dollars ($)', 'give' ), |
|
100 | + 'admin_label' => __('Australian Dollars ($)', 'give'), |
|
101 | 101 | 'symbol' => '$', |
102 | 102 | 'setting' => array( |
103 | 103 | 'currency_position' => 'before', |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | 'BRL' => array( |
110 | - 'admin_label' => __( 'Brazilian Real (R$)', 'give' ), |
|
110 | + 'admin_label' => __('Brazilian Real (R$)', 'give'), |
|
111 | 111 | 'symbol' => 'R$', |
112 | 112 | 'setting' => array( |
113 | 113 | 'currency_position' => 'before', |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ), |
118 | 118 | ), |
119 | 119 | 'CAD' => array( |
120 | - 'admin_label' => __( 'Canadian Dollars ($)', 'give' ), |
|
120 | + 'admin_label' => __('Canadian Dollars ($)', 'give'), |
|
121 | 121 | 'symbol' => '$', |
122 | 122 | 'setting' => array( |
123 | 123 | 'currency_position' => 'before', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ), |
128 | 128 | ), |
129 | 129 | 'CZK' => array( |
130 | - 'admin_label' => __( 'Czech Koruna (Kč)', 'give' ), |
|
130 | + 'admin_label' => __('Czech Koruna (Kč)', 'give'), |
|
131 | 131 | 'symbol' => 'Kč', |
132 | 132 | 'setting' => array( |
133 | 133 | 'currency_position' => 'after', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ), |
138 | 138 | ), |
139 | 139 | 'DKK' => array( |
140 | - 'admin_label' => __( 'Danish Krone (kr.)', 'give' ), |
|
140 | + 'admin_label' => __('Danish Krone (kr.)', 'give'), |
|
141 | 141 | 'symbol' => ' kr. ', |
142 | 142 | 'setting' => array( |
143 | 143 | 'currency_position' => 'before', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | 'HKD' => array( |
150 | - 'admin_label' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
150 | + 'admin_label' => __('Hong Kong Dollar ($)', 'give'), |
|
151 | 151 | 'symbol' => '$', |
152 | 152 | 'setting' => array( |
153 | 153 | 'currency_position' => 'before', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | 'HUF' => array( |
160 | - 'admin_label' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
160 | + 'admin_label' => __('Hungarian Forint (Ft)', 'give'), |
|
161 | 161 | 'symbol' => 'Ft', |
162 | 162 | 'setting' => array( |
163 | 163 | 'currency_position' => 'after', |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | 'ILS' => array( |
170 | - 'admin_label' => __( 'Israeli Shekel (₪)', 'give' ), |
|
170 | + 'admin_label' => __('Israeli Shekel (₪)', 'give'), |
|
171 | 171 | 'symbol' => '₪', |
172 | 172 | 'setting' => array( |
173 | 173 | 'currency_position' => 'after', |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | ), |
178 | 178 | ), |
179 | 179 | 'JPY' => array( |
180 | - 'admin_label' => __( 'Japanese Yen (¥)', 'give' ), |
|
180 | + 'admin_label' => __('Japanese Yen (¥)', 'give'), |
|
181 | 181 | 'symbol' => '¥', |
182 | 182 | 'setting' => array( |
183 | 183 | 'currency_position' => 'before', |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ), |
188 | 188 | ), |
189 | 189 | 'MYR' => array( |
190 | - 'admin_label' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
190 | + 'admin_label' => __('Malaysian Ringgits (RM)', 'give'), |
|
191 | 191 | 'symbol' => 'RM', |
192 | 192 | 'setting' => array( |
193 | 193 | 'currency_position' => 'before', |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ), |
198 | 198 | ), |
199 | 199 | 'MXN' => array( |
200 | - 'admin_label' => __( 'Mexican Peso ($)', 'give' ), |
|
200 | + 'admin_label' => __('Mexican Peso ($)', 'give'), |
|
201 | 201 | 'symbol' => '$', |
202 | 202 | 'setting' => array( |
203 | 203 | 'currency_position' => 'before', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | 'MAD' => array( |
210 | - 'admin_label' => __( 'Moroccan Dirham (.د.م)', 'give' ), |
|
210 | + 'admin_label' => __('Moroccan Dirham (.د.م)', 'give'), |
|
211 | 211 | 'symbol' => '.د.م', |
212 | 212 | 'setting' => array( |
213 | 213 | 'currency_position' => 'before', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | 'NZD' => array( |
220 | - 'admin_label' => __( 'New Zealand Dollar ($)', 'give' ), |
|
220 | + 'admin_label' => __('New Zealand Dollar ($)', 'give'), |
|
221 | 221 | 'symbol' => '$', |
222 | 222 | 'setting' => array( |
223 | 223 | 'currency_position' => 'before', |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ), |
228 | 228 | ), |
229 | 229 | 'NOK' => array( |
230 | - 'admin_label' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
230 | + 'admin_label' => __('Norwegian Krone (Kr.)', 'give'), |
|
231 | 231 | 'symbol' => 'kr.', |
232 | 232 | 'setting' => array( |
233 | 233 | 'currency_position' => 'before', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ), |
238 | 238 | ), |
239 | 239 | 'PHP' => array( |
240 | - 'admin_label' => __( 'Philippine Pesos (₱)', 'give' ), |
|
240 | + 'admin_label' => __('Philippine Pesos (₱)', 'give'), |
|
241 | 241 | 'symbol' => '₱', |
242 | 242 | 'setting' => array( |
243 | 243 | 'currency_position' => 'before', |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ), |
248 | 248 | ), |
249 | 249 | 'PLN' => array( |
250 | - 'admin_label' => __( 'Polish Zloty (zł)', 'give' ), |
|
250 | + 'admin_label' => __('Polish Zloty (zł)', 'give'), |
|
251 | 251 | 'symbol' => 'zł', |
252 | 252 | 'setting' => array( |
253 | 253 | 'currency_position' => 'after', |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | ), |
258 | 258 | ), |
259 | 259 | 'SGD' => array( |
260 | - 'admin_label' => __( 'Singapore Dollar ($)', 'give' ), |
|
260 | + 'admin_label' => __('Singapore Dollar ($)', 'give'), |
|
261 | 261 | 'symbol' => '$', |
262 | 262 | 'setting' => array( |
263 | 263 | 'currency_position' => 'before', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ), |
268 | 268 | ), |
269 | 269 | 'KRW' => array( |
270 | - 'admin_label' => __( 'South Korean Won (₩)', 'give' ), |
|
270 | + 'admin_label' => __('South Korean Won (₩)', 'give'), |
|
271 | 271 | 'symbol' => '₩', |
272 | 272 | 'setting' => array( |
273 | 273 | 'currency_position' => 'before', |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ), |
278 | 278 | ), |
279 | 279 | 'ZAR' => array( |
280 | - 'admin_label' => __( 'South African Rand (R)', 'give' ), |
|
280 | + 'admin_label' => __('South African Rand (R)', 'give'), |
|
281 | 281 | 'symbol' => 'R', |
282 | 282 | 'setting' => array( |
283 | 283 | 'currency_position' => 'before', |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | ), |
288 | 288 | ), |
289 | 289 | 'SEK' => array( |
290 | - 'admin_label' => __( 'Swedish Krona (kr)', 'give' ), |
|
290 | + 'admin_label' => __('Swedish Krona (kr)', 'give'), |
|
291 | 291 | 'symbol' => ' kr. ', |
292 | 292 | 'setting' => array( |
293 | 293 | 'currency_position' => 'before', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | ), |
298 | 298 | ), |
299 | 299 | 'CHF' => array( |
300 | - 'admin_label' => __( 'Swiss Franc (Fr)', 'give' ), |
|
300 | + 'admin_label' => __('Swiss Franc (Fr)', 'give'), |
|
301 | 301 | 'symbol' => 'Fr', |
302 | 302 | 'setting' => array( |
303 | 303 | 'currency_position' => 'before', |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | ), |
308 | 308 | ), |
309 | 309 | 'TWD' => array( |
310 | - 'admin_label' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
310 | + 'admin_label' => __('Taiwan New Dollars (NT$)', 'give'), |
|
311 | 311 | 'symbol' => 'NT$', |
312 | 312 | 'setting' => array( |
313 | 313 | 'currency_position' => 'before', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | ), |
318 | 318 | ), |
319 | 319 | 'THB' => array( |
320 | - 'admin_label' => __( 'Thai Baht (฿)', 'give' ), |
|
320 | + 'admin_label' => __('Thai Baht (฿)', 'give'), |
|
321 | 321 | 'symbol' => '฿', |
322 | 322 | 'setting' => array( |
323 | 323 | 'currency_position' => 'before', |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | 'INR' => array( |
330 | - 'admin_label' => __( 'Indian Rupee (₹)', 'give' ), |
|
330 | + 'admin_label' => __('Indian Rupee (₹)', 'give'), |
|
331 | 331 | 'symbol' => '₹', |
332 | 332 | 'setting' => array( |
333 | 333 | 'currency_position' => 'before', |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ), |
338 | 338 | ), |
339 | 339 | 'TRY' => array( |
340 | - 'admin_label' => __( 'Turkish Lira (₺)', 'give' ), |
|
340 | + 'admin_label' => __('Turkish Lira (₺)', 'give'), |
|
341 | 341 | 'symbol' => '₺', |
342 | 342 | 'setting' => array( |
343 | 343 | 'currency_position' => 'after', |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | ), |
348 | 348 | ), |
349 | 349 | 'IRR' => array( |
350 | - 'admin_label' => __( 'Iranian Rial (﷼)', 'give' ), |
|
350 | + 'admin_label' => __('Iranian Rial (﷼)', 'give'), |
|
351 | 351 | 'symbol' => '﷼', |
352 | 352 | 'setting' => array( |
353 | 353 | 'currency_position' => 'after', |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | ), |
358 | 358 | ), |
359 | 359 | 'RUB' => array( |
360 | - 'admin_label' => __( 'Russian Rubles (руб)', 'give' ), |
|
360 | + 'admin_label' => __('Russian Rubles (руб)', 'give'), |
|
361 | 361 | 'symbol' => '₽', |
362 | 362 | 'setting' => array( |
363 | 363 | 'currency_position' => 'before', |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ), |
368 | 368 | ), |
369 | 369 | 'AED' => array( |
370 | - 'admin_label' => __( 'United Arab Emirates dirham (د.إ)', 'give' ), |
|
370 | + 'admin_label' => __('United Arab Emirates dirham (د.إ)', 'give'), |
|
371 | 371 | 'symbol' => 'د.إ', |
372 | 372 | 'setting' => array( |
373 | 373 | 'currency_position' => 'before', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ), |
378 | 378 | ), |
379 | 379 | 'AMD' => array( |
380 | - 'admin_label' => __( 'Armenian dram (AMD)', 'give' ), |
|
380 | + 'admin_label' => __('Armenian dram (AMD)', 'give'), |
|
381 | 381 | 'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
382 | 382 | 'setting' => array( |
383 | 383 | 'currency_position' => 'before', |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | 'ANG' => array( |
390 | - 'admin_label' => __( 'Netherlands Antillean guilder (ƒ)', 'give' ), |
|
390 | + 'admin_label' => __('Netherlands Antillean guilder (ƒ)', 'give'), |
|
391 | 391 | 'symbol' => 'ƒ', |
392 | 392 | 'setting' => array( |
393 | 393 | 'currency_position' => 'before', |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | ), |
398 | 398 | ), |
399 | 399 | 'ARS' => array( |
400 | - 'admin_label' => __( 'Argentine peso ($)', 'give' ), |
|
400 | + 'admin_label' => __('Argentine peso ($)', 'give'), |
|
401 | 401 | 'symbol' => '$', |
402 | 402 | 'setting' => array( |
403 | 403 | 'currency_position' => 'before', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | ), |
408 | 408 | ), |
409 | 409 | 'AWG' => array( |
410 | - 'admin_label' => __( 'Aruban florin (ƒ)', 'give' ), |
|
410 | + 'admin_label' => __('Aruban florin (ƒ)', 'give'), |
|
411 | 411 | 'symbol' => 'ƒ', |
412 | 412 | 'setting' => array( |
413 | 413 | 'currency_position' => 'before', |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ), |
418 | 418 | ), |
419 | 419 | 'BAM' => array( |
420 | - 'admin_label' => __( 'Bosnia and Herzegovina convertible mark (KM)', 'give' ), |
|
420 | + 'admin_label' => __('Bosnia and Herzegovina convertible mark (KM)', 'give'), |
|
421 | 421 | 'symbol' => 'KM', |
422 | 422 | 'setting' => array( |
423 | 423 | 'currency_position' => 'before', |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ), |
428 | 428 | ), |
429 | 429 | 'BDT' => array( |
430 | - 'admin_label' => __( 'Bangladeshi taka (৳)', 'give' ), |
|
430 | + 'admin_label' => __('Bangladeshi taka (৳)', 'give'), |
|
431 | 431 | 'symbol' => '৳', |
432 | 432 | 'setting' => array( |
433 | 433 | 'currency_position' => 'before', |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | ), |
438 | 438 | ), |
439 | 439 | 'BHD' => array( |
440 | - 'admin_label' => __( 'Bahraini dinar (.د.ب)', 'give' ), |
|
440 | + 'admin_label' => __('Bahraini dinar (.د.ب)', 'give'), |
|
441 | 441 | 'symbol' => '.د.ب', |
442 | 442 | 'setting' => array( |
443 | 443 | 'currency_position' => 'before', |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | ), |
448 | 448 | ), |
449 | 449 | 'BMD' => array( |
450 | - 'admin_label' => __( 'Bermudian dollar (BD$)', 'give' ), |
|
450 | + 'admin_label' => __('Bermudian dollar (BD$)', 'give'), |
|
451 | 451 | 'symbol' => 'BD$', |
452 | 452 | 'setting' => array( |
453 | 453 | 'currency_position' => 'before', |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ), |
458 | 458 | ), |
459 | 459 | 'BND' => array( |
460 | - 'admin_label' => __( 'Brunei dollar (B$)', 'give' ), |
|
460 | + 'admin_label' => __('Brunei dollar (B$)', 'give'), |
|
461 | 461 | 'symbol' => 'B$', |
462 | 462 | 'setting' => array( |
463 | 463 | 'currency_position' => 'before', |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | ), |
468 | 468 | ), |
469 | 469 | 'BOB' => array( |
470 | - 'admin_label' => __( 'Bolivian boliviano (Bs.)', 'give' ), |
|
470 | + 'admin_label' => __('Bolivian boliviano (Bs.)', 'give'), |
|
471 | 471 | 'symbol' => 'Bs.', |
472 | 472 | 'setting' => array( |
473 | 473 | 'currency_position' => 'before', |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ), |
478 | 478 | ), |
479 | 479 | 'BSD' => array( |
480 | - 'admin_label' => __( 'Bahamian dollar (B$)', 'give' ), |
|
480 | + 'admin_label' => __('Bahamian dollar (B$)', 'give'), |
|
481 | 481 | 'symbol' => 'B$', |
482 | 482 | 'setting' => array( |
483 | 483 | 'currency_position' => 'before', |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | ), |
488 | 488 | ), |
489 | 489 | 'BWP' => array( |
490 | - 'admin_label' => __( 'Botswana pula (P)', 'give' ), |
|
490 | + 'admin_label' => __('Botswana pula (P)', 'give'), |
|
491 | 491 | 'symbol' => 'P', |
492 | 492 | 'setting' => array( |
493 | 493 | 'currency_position' => 'before', |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | ), |
498 | 498 | ), |
499 | 499 | 'BZD' => array( |
500 | - 'admin_label' => __( 'Belizean dollar (BZ$)', 'give' ), |
|
500 | + 'admin_label' => __('Belizean dollar (BZ$)', 'give'), |
|
501 | 501 | 'symbol' => 'BZ$', |
502 | 502 | 'setting' => array( |
503 | 503 | 'currency_position' => 'before', |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | ), |
508 | 508 | ), |
509 | 509 | 'CLP' => array( |
510 | - 'admin_label' => __( 'Chilean peso ($)', 'give' ), |
|
510 | + 'admin_label' => __('Chilean peso ($)', 'give'), |
|
511 | 511 | 'symbol' => '$', |
512 | 512 | 'setting' => array( |
513 | 513 | 'currency_position' => 'before', |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | ), |
518 | 518 | ), |
519 | 519 | 'CNY' => array( |
520 | - 'admin_label' => __( 'Chinese yuan (¥)', 'give' ), |
|
520 | + 'admin_label' => __('Chinese yuan (¥)', 'give'), |
|
521 | 521 | 'symbol' => '¥', |
522 | 522 | 'setting' => array( |
523 | 523 | 'currency_position' => 'before', |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ), |
528 | 528 | ), |
529 | 529 | 'COP' => array( |
530 | - 'admin_label' => __( 'Colombian peso ($)', 'give' ), |
|
530 | + 'admin_label' => __('Colombian peso ($)', 'give'), |
|
531 | 531 | 'symbol' => '$', |
532 | 532 | 'setting' => array( |
533 | 533 | 'currency_position' => 'before', |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | ), |
538 | 538 | ), |
539 | 539 | 'CRC' => array( |
540 | - 'admin_label' => __( 'Costa Rican colón (₡)', 'give' ), |
|
540 | + 'admin_label' => __('Costa Rican colón (₡)', 'give'), |
|
541 | 541 | 'symbol' => '₡', |
542 | 542 | 'setting' => array( |
543 | 543 | 'currency_position' => 'before', |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | ), |
548 | 548 | ), |
549 | 549 | 'CUC' => array( |
550 | - 'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ), |
|
550 | + 'admin_label' => __('Cuban convertible peso (₱)', 'give'), |
|
551 | 551 | 'symbol' => '₱', |
552 | 552 | 'setting' => array( |
553 | 553 | 'currency_position' => 'before', |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | ), |
558 | 558 | ), |
559 | 559 | 'CUP' => array( |
560 | - 'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ), |
|
560 | + 'admin_label' => __('Cuban convertible peso (₱)', 'give'), |
|
561 | 561 | 'symbol' => '₱', |
562 | 562 | 'setting' => array( |
563 | 563 | 'currency_position' => 'before', |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | ), |
568 | 568 | ), |
569 | 569 | 'DOP' => array( |
570 | - 'admin_label' => __( 'Dominican peso (RD$)', 'give' ), |
|
570 | + 'admin_label' => __('Dominican peso (RD$)', 'give'), |
|
571 | 571 | 'symbol' => 'RD$', |
572 | 572 | 'setting' => array( |
573 | 573 | 'currency_position' => 'before', |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | ), |
578 | 578 | ), |
579 | 579 | 'EGP' => array( |
580 | - 'admin_label' => __( 'Egyptian pound (E£)', 'give' ), |
|
580 | + 'admin_label' => __('Egyptian pound (E£)', 'give'), |
|
581 | 581 | 'symbol' => 'E£', |
582 | 582 | 'setting' => array( |
583 | 583 | 'currency_position' => 'before', |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | ), |
588 | 588 | ), |
589 | 589 | 'GIP' => array( |
590 | - 'admin_label' => __( 'Gibraltar pound (£)', 'give' ), |
|
590 | + 'admin_label' => __('Gibraltar pound (£)', 'give'), |
|
591 | 591 | 'symbol' => '£', |
592 | 592 | 'setting' => array( |
593 | 593 | 'currency_position' => 'before', |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | ), |
598 | 598 | ), |
599 | 599 | 'GTQ' => array( |
600 | - 'admin_label' => __( 'Guatemalan quetzal (Q)', 'give' ), |
|
600 | + 'admin_label' => __('Guatemalan quetzal (Q)', 'give'), |
|
601 | 601 | 'symbol' => 'Q', |
602 | 602 | 'setting' => array( |
603 | 603 | 'currency_position' => 'before', |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | ), |
608 | 608 | ), |
609 | 609 | 'HNL' => array( |
610 | - 'admin_label' => __( 'Honduran lempira (L)', 'give' ), |
|
610 | + 'admin_label' => __('Honduran lempira (L)', 'give'), |
|
611 | 611 | 'symbol' => 'L', |
612 | 612 | 'setting' => array( |
613 | 613 | 'currency_position' => 'before', |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | ), |
618 | 618 | ), |
619 | 619 | 'HRK' => array( |
620 | - 'admin_label' => __( 'Croatian kuna (kn)', 'give' ), |
|
620 | + 'admin_label' => __('Croatian kuna (kn)', 'give'), |
|
621 | 621 | 'symbol' => 'kn', |
622 | 622 | 'setting' => array( |
623 | 623 | 'currency_position' => 'after', |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ), |
628 | 628 | ), |
629 | 629 | 'IDR' => array( |
630 | - 'admin_label' => __( 'Indonesian rupiah (Rp)', 'give' ), |
|
630 | + 'admin_label' => __('Indonesian rupiah (Rp)', 'give'), |
|
631 | 631 | 'symbol' => 'Rp', |
632 | 632 | 'setting' => array( |
633 | 633 | 'currency_position' => 'before', |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | ), |
638 | 638 | ), |
639 | 639 | 'ISK' => array( |
640 | - 'admin_label' => __( 'Icelandic króna (kr)', 'give' ), |
|
640 | + 'admin_label' => __('Icelandic króna (kr)', 'give'), |
|
641 | 641 | 'symbol' => 'kr', |
642 | 642 | 'setting' => array( |
643 | 643 | 'currency_position' => 'after', |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | ), |
648 | 648 | ), |
649 | 649 | 'JMD' => array( |
650 | - 'admin_label' => __( 'Jamaican dollar (J$)', 'give' ), |
|
650 | + 'admin_label' => __('Jamaican dollar (J$)', 'give'), |
|
651 | 651 | 'symbol' => 'j$', |
652 | 652 | 'setting' => array( |
653 | 653 | 'currency_position' => 'before', |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | ), |
658 | 658 | ), |
659 | 659 | 'JOD' => array( |
660 | - 'admin_label' => __( 'Jordanian dinar (د.ا)', 'give' ), |
|
660 | + 'admin_label' => __('Jordanian dinar (د.ا)', 'give'), |
|
661 | 661 | 'symbol' => 'د.ا', |
662 | 662 | 'setting' => array( |
663 | 663 | 'currency_position' => 'before', |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | ), |
668 | 668 | ), |
669 | 669 | 'KES' => array( |
670 | - 'admin_label' => __( 'Kenyan shilling (KSh)', 'give' ), |
|
670 | + 'admin_label' => __('Kenyan shilling (KSh)', 'give'), |
|
671 | 671 | 'symbol' => 'KSh', |
672 | 672 | 'setting' => array( |
673 | 673 | 'currency_position' => 'before', |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | ), |
678 | 678 | ), |
679 | 679 | 'KWD' => array( |
680 | - 'admin_label' => __( 'Kuwaiti dinar (د.ك)', 'give' ), |
|
680 | + 'admin_label' => __('Kuwaiti dinar (د.ك)', 'give'), |
|
681 | 681 | 'symbol' => 'د.ك', |
682 | 682 | 'setting' => array( |
683 | 683 | 'currency_position' => 'before', |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | ), |
688 | 688 | ), |
689 | 689 | 'KYD' => array( |
690 | - 'admin_label' => __( 'Cayman Islands dollar (KY$)', 'give' ), |
|
690 | + 'admin_label' => __('Cayman Islands dollar (KY$)', 'give'), |
|
691 | 691 | 'symbol' => 'KY$', |
692 | 692 | 'setting' => array( |
693 | 693 | 'currency_position' => 'before', |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ), |
698 | 698 | ), |
699 | 699 | 'MKD' => array( |
700 | - 'admin_label' => __( 'Macedonian denar (ден)', 'give' ), |
|
700 | + 'admin_label' => __('Macedonian denar (ден)', 'give'), |
|
701 | 701 | 'symbol' => 'ден', |
702 | 702 | 'setting' => array( |
703 | 703 | 'currency_position' => 'before', |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | ), |
708 | 708 | ), |
709 | 709 | 'NPR' => array( |
710 | - 'admin_label' => __( 'Nepalese rupee (NɌs)', 'give' ), |
|
710 | + 'admin_label' => __('Nepalese rupee (NɌs)', 'give'), |
|
711 | 711 | 'symbol' => '₨', |
712 | 712 | 'setting' => array( |
713 | 713 | 'currency_position' => 'before', |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | ), |
718 | 718 | ), |
719 | 719 | 'OMR' => array( |
720 | - 'admin_label' => __( 'Omani rial (ر.ع.)', 'give' ), |
|
720 | + 'admin_label' => __('Omani rial (ر.ع.)', 'give'), |
|
721 | 721 | 'symbol' => 'ر.ع.', |
722 | 722 | 'setting' => array( |
723 | 723 | 'currency_position' => 'before', |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | ), |
728 | 728 | ), |
729 | 729 | 'PEN' => array( |
730 | - 'admin_label' => __( 'Peruvian nuevo sol (S/.)', 'give' ), |
|
730 | + 'admin_label' => __('Peruvian nuevo sol (S/.)', 'give'), |
|
731 | 731 | 'symbol' => 'S/.', |
732 | 732 | 'setting' => array( |
733 | 733 | 'currency_position' => 'before', |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | ), |
738 | 738 | ), |
739 | 739 | 'PKR' => array( |
740 | - 'admin_label' => __( 'Pakistani rupee (Ɍs)', 'give' ), |
|
740 | + 'admin_label' => __('Pakistani rupee (Ɍs)', 'give'), |
|
741 | 741 | 'symbol' => '₨', |
742 | 742 | 'setting' => array( |
743 | 743 | 'currency_position' => 'before', |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | ), |
748 | 748 | ), |
749 | 749 | 'RON' => array( |
750 | - 'admin_label' => __( 'Romanian leu (L)', 'give' ), |
|
750 | + 'admin_label' => __('Romanian leu (L)', 'give'), |
|
751 | 751 | 'symbol' => 'L', |
752 | 752 | 'setting' => array( |
753 | 753 | 'currency_position' => 'after', |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | ), |
758 | 758 | ), |
759 | 759 | 'SAR' => array( |
760 | - 'admin_label' => __( 'Saudi riyal (ر.س)', 'give' ), |
|
760 | + 'admin_label' => __('Saudi riyal (ر.س)', 'give'), |
|
761 | 761 | 'symbol' => 'ر.س', |
762 | 762 | 'setting' => array( |
763 | 763 | 'currency_position' => 'before', |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ), |
768 | 768 | ), |
769 | 769 | 'SZL' => array( |
770 | - 'admin_label' => __( 'Swazi lilangeni (L)', 'give' ), |
|
770 | + 'admin_label' => __('Swazi lilangeni (L)', 'give'), |
|
771 | 771 | 'symbol' => 'L', |
772 | 772 | 'setting' => array( |
773 | 773 | 'currency_position' => 'before', |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | ), |
778 | 778 | ), |
779 | 779 | 'TOP' => array( |
780 | - 'admin_label' => __( 'Tongan paʻanga (T$)', 'give' ), |
|
780 | + 'admin_label' => __('Tongan paʻanga (T$)', 'give'), |
|
781 | 781 | 'symbol' => 'T$', |
782 | 782 | 'setting' => array( |
783 | 783 | 'currency_position' => 'before', |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | ), |
788 | 788 | ), |
789 | 789 | 'TZS' => array( |
790 | - 'admin_label' => __( 'Tanzanian shilling (TSh)', 'give' ), |
|
790 | + 'admin_label' => __('Tanzanian shilling (TSh)', 'give'), |
|
791 | 791 | 'symbol' => 'TSh', |
792 | 792 | 'setting' => array( |
793 | 793 | 'currency_position' => 'before', |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | ), |
798 | 798 | ), |
799 | 799 | 'UAH' => array( |
800 | - 'admin_label' => __( 'Ukrainian hryvnia (₴)', 'give' ), |
|
800 | + 'admin_label' => __('Ukrainian hryvnia (₴)', 'give'), |
|
801 | 801 | 'symbol' => '₴', |
802 | 802 | 'setting' => array( |
803 | 803 | 'currency_position' => 'before', |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | ), |
808 | 808 | ), |
809 | 809 | 'UYU' => array( |
810 | - 'admin_label' => __( 'Uruguayan peso ($U)', 'give' ), |
|
810 | + 'admin_label' => __('Uruguayan peso ($U)', 'give'), |
|
811 | 811 | 'symbol' => '$U', |
812 | 812 | 'setting' => array( |
813 | 813 | 'currency_position' => 'before', |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | ), |
818 | 818 | ), |
819 | 819 | 'VEF' => array( |
820 | - 'admin_label' => __( 'Venezuelan bolívar (Bs)', 'give' ), |
|
820 | + 'admin_label' => __('Venezuelan bolívar (Bs)', 'give'), |
|
821 | 821 | 'symbol' => 'Bs', |
822 | 822 | 'setting' => array( |
823 | 823 | 'currency_position' => 'before', |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | ), |
828 | 828 | ), |
829 | 829 | 'XCD' => array( |
830 | - 'admin_label' => __( 'East Caribbean dollar (EC$)', 'give' ), |
|
830 | + 'admin_label' => __('East Caribbean dollar (EC$)', 'give'), |
|
831 | 831 | 'symbol' => 'EC$', |
832 | 832 | 'setting' => array( |
833 | 833 | 'currency_position' => 'before', |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * |
853 | 853 | * @param array $currencies |
854 | 854 | */ |
855 | - return (array) apply_filters( 'give_currencies', $currencies ); |
|
855 | + return (array) apply_filters('give_currencies', $currencies); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,22 +864,22 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return array $currencies A list of the available currencies |
866 | 866 | */ |
867 | -function give_get_currencies( $info = 'admin_label' ) { |
|
867 | +function give_get_currencies($info = 'admin_label') { |
|
868 | 868 | |
869 | 869 | $currencies = give_get_currencies_list(); |
870 | 870 | |
871 | 871 | // Backward compatibility: handle old way of currency registration. |
872 | 872 | // Backward compatibility: Return desired result. |
873 | - if ( ! empty( $currencies ) ) { |
|
874 | - foreach ( $currencies as $currency_code => $currency_setting ) { |
|
875 | - if ( is_string( $currency_setting ) ) { |
|
876 | - $currencies[ $currency_code ] = array( |
|
873 | + if ( ! empty($currencies)) { |
|
874 | + foreach ($currencies as $currency_code => $currency_setting) { |
|
875 | + if (is_string($currency_setting)) { |
|
876 | + $currencies[$currency_code] = array( |
|
877 | 877 | 'admin_label' => $currency_setting, |
878 | 878 | ); |
879 | 879 | } |
880 | 880 | |
881 | - $currencies[ $currency_code ] = wp_parse_args( |
|
882 | - $currencies[ $currency_code ], |
|
881 | + $currencies[$currency_code] = wp_parse_args( |
|
882 | + $currencies[$currency_code], |
|
883 | 883 | array( |
884 | 884 | 'admin_label' => '', |
885 | 885 | 'symbol' => $currency_code, |
@@ -888,8 +888,8 @@ discard block |
||
888 | 888 | ); |
889 | 889 | } |
890 | 890 | |
891 | - if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
892 | - $currencies = wp_list_pluck( $currencies, $info ); |
|
891 | + if ( ! empty($info) && is_string($info) && 'all' !== $info) { |
|
892 | + $currencies = wp_list_pluck($currencies, $info); |
|
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
@@ -906,12 +906,12 @@ discard block |
||
906 | 906 | * |
907 | 907 | * @return array |
908 | 908 | */ |
909 | -function give_currency_symbols( $decode_currencies = false ) { |
|
910 | - $currencies = give_get_currencies( 'symbol' ); |
|
909 | +function give_currency_symbols($decode_currencies = false) { |
|
910 | + $currencies = give_get_currencies('symbol'); |
|
911 | 911 | |
912 | - if ( $decode_currencies ) { |
|
913 | - array_walk( $currencies, function ( &$currency_symbol ) { |
|
914 | - $currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
912 | + if ($decode_currencies) { |
|
913 | + array_walk($currencies, function(&$currency_symbol) { |
|
914 | + $currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8'); |
|
915 | 915 | } ); |
916 | 916 | } |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * |
923 | 923 | * @param array $currencies |
924 | 924 | */ |
925 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
925 | + return apply_filters('give_currency_symbols', $currencies); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -939,14 +939,14 @@ discard block |
||
939 | 939 | * |
940 | 940 | * @return string The symbol to use for the currency |
941 | 941 | */ |
942 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
942 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
943 | 943 | |
944 | - if ( empty( $currency ) ) { |
|
944 | + if (empty($currency)) { |
|
945 | 945 | $currency = give_get_currency(); |
946 | 946 | } |
947 | 947 | |
948 | - $currencies = give_currency_symbols( $decode_currency ); |
|
949 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
948 | + $currencies = give_currency_symbols($decode_currency); |
|
949 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
950 | 950 | |
951 | 951 | /** |
952 | 952 | * Filter the currency symbol |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | * @param string $symbol |
957 | 957 | * @param string $currency |
958 | 958 | */ |
959 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
959 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | |
@@ -969,13 +969,13 @@ discard block |
||
969 | 969 | * |
970 | 970 | * @return string |
971 | 971 | */ |
972 | -function give_get_currency_name( $currency_code ) { |
|
972 | +function give_get_currency_name($currency_code) { |
|
973 | 973 | $currency_name = ''; |
974 | 974 | $currency_names = give_get_currencies(); |
975 | 975 | |
976 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
977 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
978 | - $currency_name = trim( current( $currency_name ) ); |
|
976 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
977 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
978 | + $currency_name = trim(current($currency_name)); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | /** |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | * @param string $currency_name |
987 | 987 | * @param string $currency_code |
988 | 988 | */ |
989 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
989 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
@@ -999,20 +999,20 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return mixed|string |
1001 | 1001 | */ |
1002 | -function give_currency_filter( $price = '', $args = array() ) { |
|
1002 | +function give_currency_filter($price = '', $args = array()) { |
|
1003 | 1003 | |
1004 | 1004 | // Get functions arguments. |
1005 | 1005 | $func_args = func_get_args(); |
1006 | 1006 | |
1007 | 1007 | // Backward compatibility: modify second param to array |
1008 | - if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
1008 | + if (isset($func_args[1]) && is_string($func_args[1])) { |
|
1009 | 1009 | $args = array( |
1010 | - 'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1011 | - 'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
1012 | - 'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1010 | + 'currency_code' => isset($func_args[1]) ? $func_args[1] : '', |
|
1011 | + 'decode_currency' => isset($func_args[2]) ? $func_args[2] : false, |
|
1012 | + 'form_id' => isset($func_args[3]) ? $func_args[3] : '', |
|
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
1015 | + give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | // Set default values. |
@@ -1025,22 +1025,22 @@ discard block |
||
1025 | 1025 | ) |
1026 | 1026 | ); |
1027 | 1027 | |
1028 | - if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
1029 | - $args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
1028 | + if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) { |
|
1029 | + $args['currency_code'] = give_get_currency($args['form_id']); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $args['position'] = give_get_option( 'currency_position', 'before' ); |
|
1032 | + $args['position'] = give_get_option('currency_position', 'before'); |
|
1033 | 1033 | |
1034 | 1034 | $negative = $price < 0; |
1035 | 1035 | |
1036 | - if ( $negative ) { |
|
1036 | + if ($negative) { |
|
1037 | 1037 | // Remove proceeding "-". |
1038 | - $price = substr( $price, 1 ); |
|
1038 | + $price = substr($price, 1); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | - $args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
1041 | + $args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']); |
|
1042 | 1042 | |
1043 | - switch ( $args['currency_code'] ) : |
|
1043 | + switch ($args['currency_code']) : |
|
1044 | 1044 | case 'GBP' : |
1045 | 1045 | case 'BRL' : |
1046 | 1046 | case 'EUR' : |
@@ -1070,13 +1070,13 @@ discard block |
||
1070 | 1070 | case 'MAD' : |
1071 | 1071 | case 'KRW' : |
1072 | 1072 | case 'ZAR' : |
1073 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
1073 | + $formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']); |
|
1074 | 1074 | break; |
1075 | 1075 | case 'NOK': |
1076 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1076 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1077 | 1077 | break; |
1078 | 1078 | default: |
1079 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1079 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1080 | 1080 | break; |
1081 | 1081 | endswitch; |
1082 | 1082 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * |
1086 | 1086 | * @since 1.8.17 |
1087 | 1087 | */ |
1088 | - $formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
1088 | + $formatted = apply_filters('give_currency_filter', $formatted, $args, $price); |
|
1089 | 1089 | |
1090 | 1090 | /** |
1091 | 1091 | * Filter formatted amount with currency |
@@ -1099,16 +1099,16 @@ discard block |
||
1099 | 1099 | * filter name will be give_usd_currency_filter_after |
1100 | 1100 | */ |
1101 | 1101 | $formatted = apply_filters( |
1102 | - 'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
1102 | + 'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}", |
|
1103 | 1103 | $formatted, |
1104 | 1104 | $args['currency_code'], |
1105 | 1105 | $price, |
1106 | 1106 | $args |
1107 | 1107 | ); |
1108 | 1108 | |
1109 | - if ( $negative ) { |
|
1109 | + if ($negative) { |
|
1110 | 1110 | // Prepend the minus sign before the currency sign. |
1111 | - $formatted = '-' . $formatted; |
|
1111 | + $formatted = '-'.$formatted; |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | return $formatted; |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @return bool |
1127 | 1127 | */ |
1128 | -function give_is_zero_based_currency( $currency = '' ) { |
|
1128 | +function give_is_zero_based_currency($currency = '') { |
|
1129 | 1129 | $zero_based_currency = array( |
1130 | 1130 | 'PYG', // Paraguayan Guarani. |
1131 | 1131 | 'GNF', // Guinean Franc. |
@@ -1145,12 +1145,12 @@ discard block |
||
1145 | 1145 | ); |
1146 | 1146 | |
1147 | 1147 | // Set default currency. |
1148 | - if ( empty( $currency ) ) { |
|
1148 | + if (empty($currency)) { |
|
1149 | 1149 | $currency = give_get_currency(); |
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | // Check for Zero Based Currency. |
1153 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1153 | + if (in_array($currency, $zero_based_currency)) { |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return bool |
1167 | 1167 | */ |
1168 | -function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
1168 | +function give_is_right_to_left_supported_currency($currency = '') { |
|
1169 | 1169 | $zero_based_currency = apply_filters( |
1170 | 1170 | 'give_right_to_left_supported_currency', |
1171 | 1171 | array( |
@@ -1181,12 +1181,12 @@ discard block |
||
1181 | 1181 | ); |
1182 | 1182 | |
1183 | 1183 | // Set default currency. |
1184 | - if ( empty( $currency ) ) { |
|
1184 | + if (empty($currency)) { |
|
1185 | 1185 | $currency = give_get_currency(); |
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | // Check for Zero Based Currency. |
1189 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1189 | + if (in_array($currency, $zero_based_currency)) { |
|
1190 | 1190 | return true; |
1191 | 1191 | } |
1192 | 1192 |