@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,45 +56,45 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | // Set user. |
77 | 77 | $user = wp_get_current_user(); |
78 | 78 | |
79 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
82 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
83 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
84 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
85 | - $message = str_replace( '{amount}', $price, $message ); |
|
86 | - $message = str_replace( '{price}', $price, $message ); |
|
87 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
88 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
89 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
90 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
91 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
92 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
93 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
94 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
95 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
96 | - |
|
97 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
79 | + $message = str_replace('{name}', $user->display_name, $message); |
|
80 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
81 | + $message = str_replace('{username}', $user->user_login, $message); |
|
82 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
83 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
84 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
85 | + $message = str_replace('{amount}', $price, $message); |
|
86 | + $message = str_replace('{price}', $price, $message); |
|
87 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
88 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
89 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
90 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
91 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
92 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
93 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
94 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
95 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
96 | + |
|
97 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | * @since 1.0 |
107 | 107 | * @return array|bool |
108 | 108 | */ |
109 | -function give_email_template_preview( $array ) { |
|
109 | +function give_email_template_preview($array) { |
|
110 | 110 | |
111 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
111 | + if ( ! current_user_can('manage_give_settings')) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | $custom_field = array( |
115 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
116 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
115 | + 'name' => esc_html__('Preview Email', 'give'), |
|
116 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
117 | 117 | 'id' => 'give_email_preview_buttons', |
118 | 118 | 'type' => 'email_preview_buttons', |
119 | 119 | ); |
120 | 120 | |
121 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
121 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
125 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Output Email Template Preview Buttons. |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | function give_email_preview_buttons_callback() { |
135 | 135 | ob_start(); |
136 | 136 | ?> |
137 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" |
|
138 | - target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
139 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
137 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" |
|
138 | + target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
139 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
140 | 140 | 'give_action' => 'send_test_email', |
141 | 141 | 'give-message' => 'sent-test-email', |
142 | 142 | 'tag' => 'emails', |
143 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" |
|
144 | - class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
143 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" |
|
144 | + class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
145 | 145 | <?php |
146 | 146 | echo ob_get_clean(); |
147 | 147 | } |
@@ -154,46 +154,46 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function give_display_email_template_preview() { |
156 | 156 | |
157 | - if ( empty( $_GET['give_action'] ) ) { |
|
157 | + if (empty($_GET['give_action'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
161 | + if ('preview_email' !== $_GET['give_action']) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
165 | + if ( ! current_user_can('manage_give_settings')) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
170 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
171 | 171 | |
172 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
172 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
173 | 173 | |
174 | 174 | echo give_get_preview_email_header(); |
175 | 175 | |
176 | 176 | //Are we previewing an actual payment? |
177 | - if ( ! empty( $payment_id ) ) { |
|
177 | + if ( ! empty($payment_id)) { |
|
178 | 178 | |
179 | - $content = give_get_email_body_content( $payment_id ); |
|
179 | + $content = give_get_email_body_content($payment_id); |
|
180 | 180 | |
181 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
181 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
182 | 182 | |
183 | 183 | } else { |
184 | 184 | |
185 | 185 | //No payment ID, use sample preview content |
186 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
186 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | - echo Give()->emails->build_email( $preview_content ); |
|
190 | + echo Give()->emails->build_email($preview_content); |
|
191 | 191 | |
192 | 192 | exit; |
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
196 | +add_action('init', 'give_display_email_template_preview'); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Email Template Body. |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $email_body Body of the email |
207 | 207 | */ |
208 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
208 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
209 | 209 | |
210 | 210 | $default_email_body = give_get_default_donation_receipt_email(); |
211 | 211 | |
212 | - $email_content = give_get_option( 'donation_receipt' ); |
|
213 | - $email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
212 | + $email_content = give_get_option('donation_receipt'); |
|
213 | + $email_content = ($email_content) ? stripslashes($email_content) : $default_email_body; |
|
214 | 214 | |
215 | - $email_body = wpautop( $email_content ); |
|
215 | + $email_body = wpautop($email_content); |
|
216 | 216 | |
217 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
217 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
218 | 218 | |
219 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
219 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -229,35 +229,35 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string $email_body Body of the email |
231 | 231 | */ |
232 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
232 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
233 | 233 | |
234 | - $payment = new Give_Payment( $payment_id ); |
|
234 | + $payment = new Give_Payment($payment_id); |
|
235 | 235 | |
236 | - if ( $payment->user_id > 0 ) { |
|
237 | - $user_data = get_userdata( $payment->user_id ); |
|
236 | + if ($payment->user_id > 0) { |
|
237 | + $user_data = get_userdata($payment->user_id); |
|
238 | 238 | $name = $user_data->display_name; |
239 | - } elseif ( ! empty( $payment->first_name ) && ! empty( $payment->last_name ) ) { |
|
240 | - $name = $payment->first_name . ' ' . $payment->last_name; |
|
239 | + } elseif ( ! empty($payment->first_name) && ! empty($payment->last_name)) { |
|
240 | + $name = $payment->first_name.' '.$payment->last_name; |
|
241 | 241 | } else { |
242 | 242 | $name = $payment->email; |
243 | 243 | } |
244 | 244 | |
245 | - $gateway = give_get_gateway_admin_label( $payment->gateway ); |
|
245 | + $gateway = give_get_gateway_admin_label($payment->gateway); |
|
246 | 246 | |
247 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
248 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
250 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
251 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
252 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
253 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
247 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
248 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
250 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
251 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount($payment->total, array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n"; |
|
252 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
253 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
254 | 254 | |
255 | - $message = give_get_option( 'donation_notification' ); |
|
256 | - $message = isset( $message ) ? stripslashes( $message ) : $default_email_body; |
|
255 | + $message = give_get_option('donation_notification'); |
|
256 | + $message = isset($message) ? stripslashes($message) : $default_email_body; |
|
257 | 257 | |
258 | - $email_body = give_do_email_tags( $message, $payment_id ); |
|
258 | + $email_body = give_do_email_tags($message, $payment_id); |
|
259 | 259 | |
260 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
260 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -270,19 +270,19 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | */ |
272 | 272 | function give_render_receipt_in_browser() { |
273 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
274 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
273 | + if ( ! isset($_GET['payment_key'])) { |
|
274 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
275 | 275 | } |
276 | 276 | |
277 | - $key = urlencode( $_GET['payment_key'] ); |
|
277 | + $key = urlencode($_GET['payment_key']); |
|
278 | 278 | |
279 | 279 | ob_start(); |
280 | 280 | //Disallows caching of the page |
281 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
282 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
283 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
284 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
285 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
281 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
282 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
283 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
284 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
285 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
286 | 286 | ?> |
287 | 287 | <!DOCTYPE html> |
288 | 288 | <html lang="en"> |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @since 1.0 |
295 | 295 | */ |
296 | - do_action( 'give_receipt_head' ); |
|
296 | + do_action('give_receipt_head'); |
|
297 | 297 | ?> |
298 | 298 | </head> |
299 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
299 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
300 | 300 | |
301 | 301 | <div id="give_receipt_wrapper"> |
302 | 302 | <?php |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @since 1.0 |
307 | 307 | */ |
308 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
308 | + do_action('give_render_receipt_in_browser_before'); |
|
309 | 309 | |
310 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
310 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
311 | 311 | |
312 | 312 | /** |
313 | 313 | * Fires in the receipt template after the content. |
314 | 314 | * |
315 | 315 | * @since 1.0 |
316 | 316 | */ |
317 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
317 | + do_action('give_render_receipt_in_browser_after'); |
|
318 | 318 | ?> |
319 | 319 | </div> |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 1.0 |
326 | 326 | */ |
327 | - do_action( 'give_receipt_footer' ); |
|
327 | + do_action('give_receipt_footer'); |
|
328 | 328 | ?> |
329 | 329 | </body> |
330 | 330 | </html> |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | die(); |
334 | 334 | } |
335 | 335 | |
336 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
336 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
337 | 337 | |
338 | 338 | |
339 | 339 | /** |
@@ -348,29 +348,29 @@ discard block |
||
348 | 348 | |
349 | 349 | //Payment receipt switcher |
350 | 350 | $payment_count = give_count_payments()->publish; |
351 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
351 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
352 | 352 | |
353 | - if ( $payment_count <= 0 ) { |
|
353 | + if ($payment_count <= 0) { |
|
354 | 354 | return false; |
355 | 355 | } |
356 | 356 | |
357 | 357 | //Get payments. |
358 | - $payments = new Give_Payments_Query( array( |
|
358 | + $payments = new Give_Payments_Query(array( |
|
359 | 359 | 'number' => 100, |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | $payments = $payments->get_payments(); |
362 | 362 | $options = array(); |
363 | 363 | |
364 | 364 | //Provide nice human readable options. |
365 | - if ( $payments ) { |
|
366 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
367 | - foreach ( $payments as $payment ) { |
|
365 | + if ($payments) { |
|
366 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
367 | + foreach ($payments as $payment) { |
|
368 | 368 | |
369 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
369 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | } else { |
373 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
373 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | //Start constructing HTML output. |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | var selected_trans = transactions.options[transactions.selectedIndex]; |
384 | 384 | console.log(selected_trans); |
385 | 385 | if (selected_trans){ |
386 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
386 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
387 | 387 | window.location = url_string; |
388 | 388 | } |
389 | 389 | } |
390 | 390 | </script>'; |
391 | 391 | |
392 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
392 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
393 | 393 | |
394 | 394 | //The select field with 100 latest transactions |
395 | - $transaction_header .= Give()->html->select( array( |
|
395 | + $transaction_header .= Give()->html->select(array( |
|
396 | 396 | 'name' => 'preview_email_payment_id', |
397 | 397 | 'selected' => $payment_id, |
398 | 398 | 'id' => 'give_preview_email_payment_id', |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | 'select_atts' => 'onchange="change_preview()">', |
403 | 403 | 'show_option_all' => false, |
404 | 404 | 'show_option_none' => false, |
405 | - ) ); |
|
405 | + )); |
|
406 | 406 | |
407 | 407 | //Closing tag |
408 | 408 | $transaction_header .= '</div>'; |
409 | 409 | |
410 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
410 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
411 | 411 | |
412 | 412 | } |
413 | 413 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | function give_receipt_head_content() { |
422 | 422 | |
423 | 423 | //Title. |
424 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
424 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
425 | 425 | |
426 | 426 | //Meta. |
427 | 427 | $output .= '<meta charset="utf-8"/> |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | <meta name="robots" content="noindex, nofollow"/>'; |
436 | 436 | |
437 | 437 | //CSS |
438 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
438 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
439 | 439 | |
440 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
440 | + echo apply_filters('give_receipt_head_content', $output); |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
445 | 444 | \ No newline at end of file |
445 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
446 | 446 | \ No newline at end of file |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) { |
|
23 | +if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | Give()->roles->remove_caps(); |
74 | 74 | |
75 | 75 | // Delete the Roles. |
76 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' ); |
|
77 | - foreach ( $give_roles as $role ) { |
|
78 | - remove_role( $role ); |
|
76 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor'); |
|
77 | + foreach ($give_roles as $role) { |
|
78 | + remove_role($role); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Remove all database tables. |
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
84 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
84 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
85 | 85 | |
86 | 86 | // Cleanup Cron Events. |
87 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_scheduled_events' ); |
|
89 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
90 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
87 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_scheduled_events'); |
|
89 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
90 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
91 | 91 | |
92 | 92 | // Get all options. |
93 | 93 | $give_option_names = $wpdb->get_col( |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | |
100 | - if ( ! empty( $give_option_names ) ) { |
|
100 | + if ( ! empty($give_option_names)) { |
|
101 | 101 | // Convert option name to transient or option name. |
102 | 102 | $new_give_option_names = array(); |
103 | 103 | |
104 | 104 | // Delete all the Plugin Options. |
105 | - foreach ( $give_option_names as $option ) { |
|
106 | - if ( false !== strpos( $option, 'give_cache' ) ) { |
|
107 | - Give_Cache::delete( $option ); |
|
105 | + foreach ($give_option_names as $option) { |
|
106 | + if (false !== strpos($option, 'give_cache')) { |
|
107 | + Give_Cache::delete($option); |
|
108 | 108 | } else { |
109 | - delete_option( $option ); |
|
109 | + delete_option($option); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -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 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | global $status, $page; |
57 | 57 | |
58 | 58 | // Set parent defaults |
59 | - parent::__construct( array( |
|
60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
59 | + parent::__construct(array( |
|
60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
62 | 62 | 'ajax' => false // Does this table support ajax? |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
66 | 66 | $this->query(); |
67 | 67 | |
68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Column Name |
80 | 80 | */ |
81 | - public function column_default( $item, $column_name ) { |
|
82 | - switch ( $column_name ) { |
|
81 | + public function column_default($item, $column_name) { |
|
82 | + switch ($column_name) { |
|
83 | 83 | case 'title': |
84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
85 | 85 | |
86 | 86 | return sprintf( |
87 | 87 | '<a href="%s">%s</a>', |
88 | - get_edit_post_link( $item['ID'] ), |
|
88 | + get_edit_post_link($item['ID']), |
|
89 | 89 | $title |
90 | 90 | ); |
91 | 91 | case 'sales': |
92 | 92 | return sprintf( |
93 | 93 | '<a href="%s">%s</a>', |
94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
95 | 95 | $item['sales'] |
96 | 96 | ); |
97 | 97 | case 'earnings' : |
98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
99 | 99 | case 'average_sales' : |
100 | - return round( $item[ $column_name ] ); |
|
100 | + return round($item[$column_name]); |
|
101 | 101 | case 'average_earnings' : |
102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
103 | 103 | case 'details' : |
104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
105 | 105 | default: |
106 | - return $item[ $column_name ]; |
|
106 | + return $item[$column_name]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_columns() { |
119 | 119 | $columns = array( |
120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
120 | + 'title' => esc_html__('Form', 'give'), |
|
121 | + 'sales' => esc_html__('Donations', 'give'), |
|
122 | + 'earnings' => esc_html__('Income', 'give'), |
|
123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_sortable_columns() { |
140 | 140 | return array( |
141 | - 'title' => array( 'title', true ), |
|
142 | - 'sales' => array( 'sales', false ), |
|
143 | - 'earnings' => array( 'earnings', false ), |
|
141 | + 'title' => array('title', true), |
|
142 | + 'sales' => array('sales', false), |
|
143 | + 'earnings' => array('earnings', false), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int Current page number |
154 | 154 | */ |
155 | 155 | public function get_paged() { |
156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return int Category ID |
166 | 166 | */ |
167 | 167 | public function get_category() { |
168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function bulk_actions( $which = '' ) { |
|
179 | + public function bulk_actions($which = '') { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param string $which |
190 | 190 | */ |
191 | - protected function display_tablenav( $which ) { |
|
191 | + protected function display_tablenav($which) { |
|
192 | 192 | |
193 | - if ( 'top' === $which ) { |
|
194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
193 | + if ('top' === $which) { |
|
194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
198 | 198 | |
199 | - <?php if ( 'top' === $which ) { ?> |
|
199 | + <?php if ('top' === $which) { ?> |
|
200 | 200 | <h2 class="alignleft reports-earnings-title"> |
201 | - <?php esc_html_e( 'Donation Forms Report', 'give' ); ?> |
|
201 | + <?php esc_html_e('Donation Forms Report', 'give'); ?> |
|
202 | 202 | </h2> |
203 | 203 | <?php } ?> |
204 | 204 | |
205 | 205 | <div class="alignright tablenav-right"> |
206 | 206 | <div class="actions bulkactions"> |
207 | - <?php $this->bulk_actions( $which ); ?> |
|
207 | + <?php $this->bulk_actions($which); ?> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | - $this->extra_tablenav( $which ); |
|
211 | - $this->pagination( $which ); |
|
210 | + $this->extra_tablenav($which); |
|
211 | + $this->pagination($which); |
|
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function category_filter() { |
230 | 230 | |
231 | - $categories = get_terms( 'form_category' ); |
|
232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
231 | + $categories = get_terms('form_category'); |
|
232 | + if ($categories && ! is_wp_error($categories)) { |
|
233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function query() { |
246 | 246 | |
247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
249 | 249 | $category = $this->get_category(); |
250 | 250 | |
251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'suppress_filters' => true |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $category ) ) { |
|
261 | + if ( ! empty($category)) { |
|
262 | 262 | $args['tax_query'] = array( |
263 | 263 | array( |
264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - switch ( $orderby ) : |
|
270 | + switch ($orderby) : |
|
271 | 271 | case 'title' : |
272 | 272 | $args['orderby'] = 'title'; |
273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
287 | 287 | |
288 | - $this->donation_forms = new WP_Query( $args ); |
|
288 | + $this->donation_forms = new WP_Query($args); |
|
289 | 289 | |
290 | 290 | // Store total number of donation forms count. |
291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | $give_forms = $this->donation_forms->posts; |
307 | 307 | |
308 | - if ( $give_forms ) { |
|
309 | - foreach ( $give_forms as $form ) { |
|
308 | + if ($give_forms) { |
|
309 | + foreach ($give_forms as $form) { |
|
310 | 310 | $reports_data[] = array( |
311 | 311 | 'ID' => $form, |
312 | - 'title' => get_the_title( $form ), |
|
313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
312 | + 'title' => get_the_title($form), |
|
313 | + 'sales' => give_get_form_sales_stats($form), |
|
314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $columns = $this->get_columns(); |
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = $this->get_sortable_columns(); |
341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
342 | 342 | $this->items = $this->reports_data(); |
343 | 343 | $total_items = $this->count; |
344 | 344 | |
345 | - $this->set_pagination_args( array( |
|
345 | + $this->set_pagination_args(array( |
|
346 | 346 | 'total_items' => $total_items, |
347 | 347 | 'per_page' => $this->per_page, |
348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function get_sortable_columns() { |
101 | 101 | return array( |
102 | - 'total_donations' => array( 'total_donations', false ) |
|
102 | + 'total_donations' => array('total_donations', false) |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return int Current page number |
113 | 113 | */ |
114 | 114 | public function get_paged() { |
115 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
115 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @since 1.0 |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - public function bulk_actions( $which = '' ) { |
|
126 | + public function bulk_actions($which = '') { |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
@@ -135,27 +135,27 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param string $which |
137 | 137 | */ |
138 | - protected function display_tablenav( $which ) { |
|
138 | + protected function display_tablenav($which) { |
|
139 | 139 | |
140 | - if ( 'top' === $which ) { |
|
141 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
140 | + if ('top' === $which) { |
|
141 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
142 | 142 | } |
143 | 143 | ?> |
144 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
144 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
145 | 145 | |
146 | - <?php if ( 'top' === $which ) { ?> |
|
146 | + <?php if ('top' === $which) { ?> |
|
147 | 147 | <h2 class="alignleft reports-earnings-title"> |
148 | - <?php esc_html_e( 'Donation Methods Report', 'give' ); ?> |
|
148 | + <?php esc_html_e('Donation Methods Report', 'give'); ?> |
|
149 | 149 | </h2> |
150 | 150 | <?php } ?> |
151 | 151 | |
152 | 152 | <div class="alignright tablenav-right"> |
153 | 153 | <div class="actions bulkactions"> |
154 | - <?php $this->bulk_actions( $which ); ?> |
|
154 | + <?php $this->bulk_actions($which); ?> |
|
155 | 155 | </div> |
156 | 156 | <?php |
157 | - $this->extra_tablenav( $which ); |
|
158 | - $this->pagination( $which ); |
|
157 | + $this->extra_tablenav($which); |
|
158 | + $this->pagination($which); |
|
159 | 159 | ?> |
160 | 160 | </div> |
161 | 161 | |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return int |
179 | 179 | */ |
180 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
180 | + public function give_sort_total_donations($old_value, $new_value) { |
|
181 | 181 | // If no sort, default to label. |
182 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
182 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
183 | 183 | |
184 | 184 | //If no order, default to asc. |
185 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
185 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
186 | 186 | |
187 | 187 | //Determine sort order. |
188 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
188 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
189 | 189 | |
190 | - return ( $order === 'asc' ) ? $result : -$result; |
|
190 | + return ($order === 'asc') ? $result : -$result; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $gateways = give_get_payment_gateways(); |
205 | 205 | $stats = new Give_Payment_Stats(); |
206 | 206 | |
207 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
207 | + foreach ($gateways as $gateway_id => $gateway) { |
|
208 | 208 | |
209 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
210 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
209 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
210 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
211 | 211 | |
212 | 212 | $reports_data[] = array( |
213 | 213 | 'ID' => $gateway_id, |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'complete_sales' => $complete_count, |
216 | 216 | 'pending_sales' => $pending_count, |
217 | 217 | 'total_sales' => $complete_count + $pending_count, |
218 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
218 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | $columns = $this->get_columns(); |
237 | 237 | $hidden = array(); // No hidden columns |
238 | 238 | $sortable = $this->get_sortable_columns(); |
239 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
239 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
240 | 240 | $this->items = $this->reports_data(); |
241 | 241 | |
242 | 242 | // Sort Array when we are sorting data in array. |
243 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
243 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
244 | 244 | |
245 | 245 | } |
246 | 246 | } |
@@ -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 | |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | * @param array $_data |
82 | 82 | * @param array $options |
83 | 83 | */ |
84 | - public function __construct( $_data, $options = array() ) { |
|
84 | + public function __construct($_data, $options = array()) { |
|
85 | 85 | |
86 | - $this->data = $_data; |
|
86 | + $this->data = $_data; |
|
87 | 87 | |
88 | 88 | // Generate unique ID |
89 | - $this->id = md5( rand() ); |
|
89 | + $this->id = md5(rand()); |
|
90 | 90 | |
91 | 91 | // Setup default options; |
92 | - $this->options = apply_filters( 'give_graph_args', array( |
|
92 | + $this->options = apply_filters('give_graph_args', array( |
|
93 | 93 | 'y_mode' => null, |
94 | 94 | 'x_mode' => null, |
95 | 95 | 'y_decimals' => 0, |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | 'lines' => false, |
108 | 108 | 'points' => true, |
109 | 109 | 'dataType' => array() |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | |
112 | - $this->options = wp_parse_args( $options, $this->options ); |
|
112 | + $this->options = wp_parse_args($options, $this->options); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.0 |
122 | 122 | */ |
123 | - public function set( $key, $value ) { |
|
124 | - $this->options[ $key ] = $value; |
|
123 | + public function set($key, $value) { |
|
124 | + $this->options[$key] = $value; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @since 1.0 |
133 | 133 | */ |
134 | - public function get( $key ) { |
|
135 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
134 | + public function get($key) { |
|
135 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 1.0 |
142 | 142 | */ |
143 | 143 | public function get_data() { |
144 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
144 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function load_scripts() { |
153 | 153 | // Use minified libraries if SCRIPT_DEBUG is turned off |
154 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
154 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
155 | 155 | |
156 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
157 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
156 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
157 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
158 | 158 | |
159 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
160 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
159 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
160 | + wp_enqueue_script('jquery-flot-time'); |
|
161 | 161 | |
162 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
163 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
162 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
163 | + wp_enqueue_script('jquery-flot-resize'); |
|
164 | 164 | |
165 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
166 | - wp_enqueue_script( 'jquery-flot' ); |
|
165 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
166 | + wp_enqueue_script('jquery-flot'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | [ |
191 | 191 | <?php |
192 | 192 | $order = 0; |
193 | - foreach( $this->get_data() as $label => $data ) : |
|
193 | + foreach ($this->get_data() as $label => $data) : |
|
194 | 194 | ?> |
195 | 195 | { |
196 | - label : "<?php echo esc_attr( $label ); ?>", |
|
197 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
198 | - dataType : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>', |
|
196 | + label : "<?php echo esc_attr($label); ?>", |
|
197 | + id : "<?php echo sanitize_key($label); ?>", |
|
198 | + dataType : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>', |
|
199 | 199 | // data format is: [ point on x, value on y ] |
200 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
200 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
201 | 201 | points: { |
202 | 202 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
203 | 203 | }, |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | fill : true, |
213 | 213 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
214 | 214 | }, |
215 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
215 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
216 | 216 | yaxis : <?php echo $yaxis_count; ?> |
217 | 217 | <?php endif; ?> |
218 | 218 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | grid: { |
227 | 227 | show : true, |
228 | 228 | aboveData : false, |
229 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
230 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
231 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
232 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
229 | + color : "<?php echo $this->options['color']; ?>", |
|
230 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
231 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
232 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
233 | 233 | clickable : false, |
234 | 234 | hoverable : true |
235 | 235 | }, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | mode : "<?php echo $this->options['x_mode']; ?>", |
241 | 241 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
242 | 242 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
243 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
243 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
244 | 244 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
245 | 245 | <?php endif; ?> |
246 | 246 | }, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | min : 0, |
250 | 250 | mode : "<?php echo $this->options['y_mode']; ?>", |
251 | 251 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
252 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
252 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
253 | 253 | tickDecimals: <?php echo $this->options['y_decimals']; ?>, |
254 | 254 | <?php endif; ?> |
255 | 255 | tickFormatter: function(val) { |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Graph $this Graph object. |
325 | 325 | */ |
326 | - do_action( 'give_before_graph', $this ); |
|
326 | + do_action('give_before_graph', $this); |
|
327 | 327 | |
328 | 328 | // Build the graph. |
329 | 329 | echo $this->build_graph(); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param Give_Graph $this Graph object. |
337 | 337 | */ |
338 | - do_action( 'give_after_graph', $this ); |
|
338 | + do_action('give_after_graph', $this); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = esc_html__( 'General', 'give' ); |
|
30 | + $this->label = esc_html__('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'access-control': |
49 | 49 | $settings = array( |
50 | 50 | // Section 3: Access control. |
@@ -54,47 +54,47 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'session_lifetime', |
57 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
58 | - 'desc' => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
57 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
58 | + 'desc' => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => array( |
61 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
62 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
63 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
64 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
61 | + '86400' => esc_html__('24 Hours', 'give'), |
|
62 | + '172800' => esc_html__('48 Hours', 'give'), |
|
63 | + '259200' => esc_html__('72 Hours', 'give'), |
|
64 | + '604800' => esc_html__('1 Week', 'give'), |
|
65 | 65 | ) |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
69 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
68 | + 'name' => esc_html__('Email Access', 'give'), |
|
69 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
70 | 70 | 'id' => 'email_access', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | 79 | 'id' => 'recaptcha_key', |
80 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
80 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
81 | 81 | /* translators: %s: https://www.google.com/recaptcha/ */ |
82 | - 'desc' => sprintf( __( 'Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
82 | + 'desc' => sprintf(__('Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
83 | 83 | 'default' => '', |
84 | 84 | 'type' => 'text' |
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'recaptcha_secret', |
88 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
89 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
88 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
89 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | 93 | array( |
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
94 | + 'name' => esc_html__('Access Control Docs Link', 'give'), |
|
95 | 95 | 'id' => 'access_control_docs_link', |
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
96 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
97 | + 'title' => __('Access Control', 'give'), |
|
98 | 98 | 'type' => 'give_docs_link', |
99 | 99 | ), |
100 | 100 | array( |
@@ -112,61 +112,61 @@ discard block |
||
112 | 112 | 'id' => 'give_title_general_settings_2' |
113 | 113 | ), |
114 | 114 | array( |
115 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
115 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
116 | 116 | 'desc' => '', |
117 | 117 | 'type' => 'give_title', |
118 | 118 | 'id' => 'give_title_general_settings_2' |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
122 | - 'desc' => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
121 | + 'name' => esc_html__('Currency', 'give'), |
|
122 | + 'desc' => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
123 | 123 | 'id' => 'currency', |
124 | 124 | 'type' => 'select', |
125 | 125 | 'options' => give_get_currencies(), |
126 | 126 | 'default' => 'USD', |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
130 | - 'desc' => esc_html__( 'The position of the currency symbol.', 'give' ), |
|
129 | + 'name' => esc_html__('Currency Position', 'give'), |
|
130 | + 'desc' => esc_html__('The position of the currency symbol.', 'give'), |
|
131 | 131 | 'id' => 'currency_position', |
132 | 132 | 'type' => 'select', |
133 | 133 | 'options' => array( |
134 | 134 | /* translators: %s: currency symbol */ |
135 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
135 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
136 | 136 | /* translators: %s: currency symbol */ |
137 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
137 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
138 | 138 | ), |
139 | 139 | 'default' => 'before', |
140 | 140 | ), |
141 | 141 | array( |
142 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
143 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
142 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
143 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
144 | 144 | 'id' => 'thousands_separator', |
145 | 145 | 'type' => 'text', |
146 | 146 | 'default' => ',', |
147 | 147 | 'css' => 'width:12em;', |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
150 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
151 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
152 | 152 | 'id' => 'decimal_separator', |
153 | 153 | 'type' => 'text', |
154 | 154 | 'default' => '.', |
155 | 155 | 'css' => 'width:12em;', |
156 | 156 | ), |
157 | 157 | array( |
158 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
159 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
158 | + 'name' => __('Number of Decimals', 'give'), |
|
159 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
160 | 160 | 'id' => 'number_decimals', |
161 | 161 | 'type' => 'text', |
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | 165 | array( |
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
166 | + 'name' => esc_html__('Currency Options Docs Link', 'give'), |
|
167 | 167 | 'id' => 'currency_settings_docs_link', |
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
168 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
169 | + 'title' => __('Currency Settings', 'give'), |
|
170 | 170 | 'type' => 'give_docs_link', |
171 | 171 | ), |
172 | 172 | array( |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $country = give_get_country(); |
182 | 182 | |
183 | 183 | // get the list of the states of which defalut country is selected |
184 | - $states = give_get_states( $country ); |
|
184 | + $states = give_get_states($country); |
|
185 | 185 | |
186 | 186 | // Get the country list that does not have any states init. |
187 | 187 | $no_states_country = give_no_states_country_list(); |
@@ -193,46 +193,46 @@ discard block |
||
193 | 193 | 'id' => 'give_title_general_settings_1' |
194 | 194 | ), |
195 | 195 | array( |
196 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
196 | + 'name' => esc_html__('General Settings', 'give'), |
|
197 | 197 | 'desc' => '', |
198 | 198 | 'type' => 'give_title', |
199 | 199 | 'id' => 'give_title_general_settings_1' |
200 | 200 | ), |
201 | 201 | array( |
202 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
202 | + 'name' => esc_html__('Success Page', 'give'), |
|
203 | 203 | /* translators: %s: [give_receipt] */ |
204 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
204 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
205 | 205 | 'id' => 'success_page', |
206 | 206 | 'type' => 'select', |
207 | - 'options' => give_cmb2_get_post_options( array( |
|
207 | + 'options' => give_cmb2_get_post_options(array( |
|
208 | 208 | 'post_type' => 'page', |
209 | - 'numberposts' => - 1 |
|
210 | - ) ), |
|
209 | + 'numberposts' => -1 |
|
210 | + )), |
|
211 | 211 | ), |
212 | 212 | array( |
213 | - 'name' => esc_html__( 'Failed Donation Page', 'give' ), |
|
214 | - 'desc' => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
213 | + 'name' => esc_html__('Failed Donation Page', 'give'), |
|
214 | + 'desc' => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
215 | 215 | 'id' => 'failure_page', |
216 | 216 | 'type' => 'select', |
217 | - 'options' => give_cmb2_get_post_options( array( |
|
217 | + 'options' => give_cmb2_get_post_options(array( |
|
218 | 218 | 'post_type' => 'page', |
219 | - 'numberposts' => - 1 |
|
220 | - ) ), |
|
219 | + 'numberposts' => -1 |
|
220 | + )), |
|
221 | 221 | ), |
222 | 222 | array( |
223 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
223 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
224 | 224 | /* translators: %s: [donation_history] */ |
225 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
225 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
226 | 226 | 'id' => 'history_page', |
227 | 227 | 'type' => 'select', |
228 | - 'options' => give_cmb2_get_post_options( array( |
|
228 | + 'options' => give_cmb2_get_post_options(array( |
|
229 | 229 | 'post_type' => 'page', |
230 | - 'numberposts' => - 1 |
|
231 | - ) ), |
|
230 | + 'numberposts' => -1 |
|
231 | + )), |
|
232 | 232 | ), |
233 | 233 | array( |
234 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
235 | - 'desc' => esc_html__( 'The country your site operates from.', 'give' ), |
|
234 | + 'name' => esc_html__('Base Country', 'give'), |
|
235 | + 'desc' => esc_html__('The country your site operates from.', 'give'), |
|
236 | 236 | 'id' => 'base_country', |
237 | 237 | 'type' => 'select', |
238 | 238 | 'options' => give_get_country_list(), |
@@ -243,18 +243,18 @@ discard block |
||
243 | 243 | * @since 1.8.14 |
244 | 244 | */ |
245 | 245 | array( |
246 | - 'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ), |
|
247 | - 'name' => __( 'Base State/Province', 'give' ), |
|
248 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
246 | + 'wrapper_class' => (array_key_exists($country, $no_states_country) ? 'give-hidden' : ''), |
|
247 | + 'name' => __('Base State/Province', 'give'), |
|
248 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
249 | 249 | 'id' => 'base_state', |
250 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
250 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
251 | 251 | 'options' => $states, |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
254 | + 'name' => esc_html__('General Options Docs Link', 'give'), |
|
255 | 255 | 'id' => 'general_options_docs_link', |
256 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
257 | - 'title' => __( 'General Options', 'give' ), |
|
256 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
257 | + 'title' => __('General Options', 'give'), |
|
258 | 258 | 'type' => 'give_docs_link', |
259 | 259 | ), |
260 | 260 | array( |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * Filter the general settings. |
270 | 270 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
271 | 271 | */ |
272 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
272 | + $settings = apply_filters('give_settings_general', $settings); |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Filter the settings. |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param array $settings |
280 | 280 | */ |
281 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
281 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
282 | 282 | |
283 | 283 | // Output. |
284 | 284 | return $settings; |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function get_sections() { |
294 | 294 | $sections = array( |
295 | - 'general-settings' => esc_html__( 'General', 'give' ), |
|
296 | - 'currency-settings' => esc_html__( 'Currency', 'give' ), |
|
297 | - 'access-control' => esc_html__( 'Access Control', 'give' ) |
|
295 | + 'general-settings' => esc_html__('General', 'give'), |
|
296 | + 'currency-settings' => esc_html__('Currency', 'give'), |
|
297 | + 'access-control' => esc_html__('Access Control', 'give') |
|
298 | 298 | ); |
299 | 299 | |
300 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
300 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 |
@@ -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 | |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | function give_test_ajax_works() { |
27 | 27 | |
28 | 28 | // Check if the Airplane Mode plugin is installed. |
29 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
29 | + if (class_exists('Airplane_Mode_Core')) { |
|
30 | 30 | |
31 | 31 | $airplane = Airplane_Mode_Core::getInstance(); |
32 | 32 | |
33 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
33 | + if (method_exists($airplane, 'enabled')) { |
|
34 | 34 | |
35 | - if ( $airplane->enabled() ) { |
|
35 | + if ($airplane->enabled()) { |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } else { |
39 | 39 | |
40 | - if ( 'on' === $airplane->check_status() ) { |
|
40 | + if ('on' === $airplane->check_status()) { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - add_filter( 'block_local_requests', '__return_false' ); |
|
46 | + add_filter('block_local_requests', '__return_false'); |
|
47 | 47 | |
48 | - if ( Give_Cache::get( '_give_ajax_works', true ) ) { |
|
48 | + if (Give_Cache::get('_give_ajax_works', true)) { |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
@@ -57,35 +57,35 @@ discard block |
||
57 | 57 | ), |
58 | 58 | ); |
59 | 59 | |
60 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
60 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
61 | 61 | |
62 | 62 | $works = true; |
63 | 63 | |
64 | - if ( is_wp_error( $ajax ) ) { |
|
64 | + if (is_wp_error($ajax)) { |
|
65 | 65 | |
66 | 66 | $works = false; |
67 | 67 | |
68 | 68 | } else { |
69 | 69 | |
70 | - if ( empty( $ajax['response'] ) ) { |
|
70 | + if (empty($ajax['response'])) { |
|
71 | 71 | $works = false; |
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
74 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
75 | 75 | $works = false; |
76 | 76 | } |
77 | 77 | |
78 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
78 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
79 | 79 | $works = false; |
80 | 80 | } |
81 | 81 | |
82 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
82 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
83 | 83 | $works = false; |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - if ( $works ) { |
|
88 | - Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true ); |
|
87 | + if ($works) { |
|
88 | + Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $works; |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * @return string |
101 | 101 | */ |
102 | 102 | function give_get_ajax_url() { |
103 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
103 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
104 | 104 | |
105 | 105 | $current_url = give_get_current_page_url(); |
106 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
106 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
107 | 107 | |
108 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
109 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
108 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
109 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
110 | 110 | } |
111 | 111 | |
112 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
112 | + return apply_filters('give_ajax_url', $ajax_url); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @since 1.7 |
127 | 127 | */ |
128 | - do_action( 'give_donation_form_login_fields' ); |
|
128 | + do_action('give_donation_form_login_fields'); |
|
129 | 129 | |
130 | 130 | give_die(); |
131 | 131 | } |
132 | 132 | |
133 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
133 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Load Checkout Fields |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return void |
141 | 141 | */ |
142 | 142 | function give_load_checkout_fields() { |
143 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
143 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
144 | 144 | |
145 | 145 | ob_start(); |
146 | 146 | |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @since 1.7 |
151 | 151 | */ |
152 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
152 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
153 | 153 | |
154 | 154 | $fields = ob_get_clean(); |
155 | 155 | |
156 | - wp_send_json( array( |
|
157 | - 'fields' => wp_json_encode( $fields ), |
|
158 | - 'submit' => wp_json_encode( give_get_donation_form_submit_button( $form_id ) ), |
|
159 | - ) ); |
|
156 | + wp_send_json(array( |
|
157 | + 'fields' => wp_json_encode($fields), |
|
158 | + 'submit' => wp_json_encode(give_get_donation_form_submit_button($form_id)), |
|
159 | + )); |
|
160 | 160 | } |
161 | 161 | |
162 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
163 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
162 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
163 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * @return void |
171 | 171 | */ |
172 | 172 | function give_ajax_get_form_title() { |
173 | - if ( isset( $_POST['form_id'] ) ) { |
|
174 | - $title = get_the_title( $_POST['form_id'] ); |
|
175 | - if ( $title ) { |
|
173 | + if (isset($_POST['form_id'])) { |
|
174 | + $title = get_the_title($_POST['form_id']); |
|
175 | + if ($title) { |
|
176 | 176 | echo $title; |
177 | 177 | } else { |
178 | 178 | echo 'fail'; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | give_die(); |
182 | 182 | } |
183 | 183 | |
184 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
185 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
184 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
185 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Retrieve a states drop down |
@@ -196,41 +196,41 @@ discard block |
||
196 | 196 | $show_field = true; |
197 | 197 | $states_require = true; |
198 | 198 | // Get the Country code from the $_POST. |
199 | - $country = sanitize_text_field( $_POST['country'] ); |
|
199 | + $country = sanitize_text_field($_POST['country']); |
|
200 | 200 | |
201 | 201 | // Get the field name from the $_POST. |
202 | - $field_name = sanitize_text_field( $_POST['field_name'] ); |
|
202 | + $field_name = sanitize_text_field($_POST['field_name']); |
|
203 | 203 | |
204 | - $label = __( 'State', 'give' ); |
|
204 | + $label = __('State', 'give'); |
|
205 | 205 | $states_label = give_get_states_label(); |
206 | 206 | |
207 | 207 | $default_state = ''; |
208 | - if ( $country === give_get_country() ) { |
|
208 | + if ($country === give_get_country()) { |
|
209 | 209 | $default_state = give_get_state(); |
210 | 210 | } |
211 | 211 | |
212 | 212 | // Check if $country code exists in the array key for states label. |
213 | - if ( array_key_exists( $country, $states_label ) ) { |
|
214 | - $label = $states_label[ $country ]; |
|
213 | + if (array_key_exists($country, $states_label)) { |
|
214 | + $label = $states_label[$country]; |
|
215 | 215 | } |
216 | 216 | |
217 | - if ( empty( $country ) ) { |
|
217 | + if (empty($country)) { |
|
218 | 218 | $country = give_get_country(); |
219 | 219 | } |
220 | 220 | |
221 | - $states = give_get_states( $country ); |
|
222 | - if ( ! empty( $states ) ) { |
|
221 | + $states = give_get_states($country); |
|
222 | + if ( ! empty($states)) { |
|
223 | 223 | $args = array( |
224 | 224 | 'name' => $field_name, |
225 | 225 | 'id' => $field_name, |
226 | - 'class' => $field_name . ' give-select', |
|
226 | + 'class' => $field_name.' give-select', |
|
227 | 227 | 'options' => $states, |
228 | 228 | 'show_option_all' => false, |
229 | 229 | 'show_option_none' => false, |
230 | 230 | 'placeholder' => $label, |
231 | 231 | 'selected' => $default_state, |
232 | 232 | ); |
233 | - $data = Give()->html->select( $args ); |
|
233 | + $data = Give()->html->select($args); |
|
234 | 234 | $states_found = true; |
235 | 235 | } else { |
236 | 236 | $data = 'nostates'; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $no_states_country = give_no_states_country_list(); |
240 | 240 | |
241 | 241 | // Check if $country code exists in the array key. |
242 | - if ( array_key_exists( $country, $no_states_country ) ) { |
|
242 | + if (array_key_exists($country, $no_states_country)) { |
|
243 | 243 | $show_field = false; |
244 | 244 | } |
245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $states_not_required_country_list = give_states_not_required_country_list(); |
248 | 248 | |
249 | 249 | // Check if $country code exists in the array key. |
250 | - if ( array_key_exists( $country, $states_not_required_country_list ) ) { |
|
250 | + if (array_key_exists($country, $states_not_required_country_list)) { |
|
251 | 251 | $states_require = false; |
252 | 252 | } |
253 | 253 | } |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | 'data' => $data, |
261 | 261 | 'default_state' => $default_state, |
262 | 262 | ); |
263 | - wp_send_json( $response ); |
|
263 | + wp_send_json($response); |
|
264 | 264 | } |
265 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
266 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
265 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
266 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Retrieve donation forms via AJAX for chosen dropdown search field. |
@@ -275,19 +275,19 @@ discard block |
||
275 | 275 | function give_ajax_form_search() { |
276 | 276 | global $wpdb; |
277 | 277 | |
278 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
279 | - $excludes = ( isset( $_GET['current_id'] ) ? (array) $_GET['current_id'] : array() ); |
|
278 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
279 | + $excludes = (isset($_GET['current_id']) ? (array) $_GET['current_id'] : array()); |
|
280 | 280 | |
281 | 281 | $results = array(); |
282 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
283 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
282 | + if (current_user_can('edit_give_forms')) { |
|
283 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
284 | 284 | } else { |
285 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
285 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
286 | 286 | } |
287 | 287 | |
288 | - if ( $items ) { |
|
288 | + if ($items) { |
|
289 | 289 | |
290 | - foreach ( $items as $item ) { |
|
290 | + foreach ($items as $item) { |
|
291 | 291 | |
292 | 292 | $results[] = array( |
293 | 293 | 'id' => $item->ID, |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | |
299 | 299 | $items[] = array( |
300 | 300 | 'id' => 0, |
301 | - 'name' => __( 'No forms found.', 'give' ), |
|
301 | + 'name' => __('No forms found.', 'give'), |
|
302 | 302 | ); |
303 | 303 | |
304 | 304 | } |
305 | 305 | |
306 | - echo json_encode( $results ); |
|
306 | + echo json_encode($results); |
|
307 | 307 | |
308 | 308 | give_die(); |
309 | 309 | } |
310 | 310 | |
311 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
312 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
311 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
312 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Search the donors database via Ajax |
@@ -321,38 +321,38 @@ discard block |
||
321 | 321 | function give_ajax_donor_search() { |
322 | 322 | global $wpdb; |
323 | 323 | |
324 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
324 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
325 | 325 | $results = array(); |
326 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
326 | + if ( ! current_user_can('view_give_reports')) { |
|
327 | 327 | $donors = array(); |
328 | 328 | } else { |
329 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
329 | + $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
330 | 330 | } |
331 | 331 | |
332 | - if ( $donors ) { |
|
332 | + if ($donors) { |
|
333 | 333 | |
334 | - foreach ( $donors as $donor ) { |
|
334 | + foreach ($donors as $donor) { |
|
335 | 335 | |
336 | 336 | $results[] = array( |
337 | 337 | 'id' => $donor->id, |
338 | - 'name' => $donor->name . ' (' . $donor->email . ')', |
|
338 | + 'name' => $donor->name.' ('.$donor->email.')', |
|
339 | 339 | ); |
340 | 340 | } |
341 | 341 | } else { |
342 | 342 | |
343 | 343 | $donors[] = array( |
344 | 344 | 'id' => 0, |
345 | - 'name' => __( 'No donors found.', 'give' ), |
|
345 | + 'name' => __('No donors found.', 'give'), |
|
346 | 346 | ); |
347 | 347 | |
348 | 348 | } |
349 | 349 | |
350 | - echo json_encode( $results ); |
|
350 | + echo json_encode($results); |
|
351 | 351 | |
352 | 352 | give_die(); |
353 | 353 | } |
354 | 354 | |
355 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
355 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
356 | 356 | |
357 | 357 | |
358 | 358 | /** |
@@ -364,39 +364,39 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function give_ajax_search_users() { |
366 | 366 | |
367 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
367 | + if (current_user_can('manage_give_settings')) { |
|
368 | 368 | |
369 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
369 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
370 | 370 | |
371 | 371 | $get_users_args = array( |
372 | 372 | 'number' => 9999, |
373 | - 'search' => $search . '*', |
|
373 | + 'search' => $search.'*', |
|
374 | 374 | ); |
375 | 375 | |
376 | - $get_users_args = apply_filters( 'give_search_users_args', $get_users_args ); |
|
376 | + $get_users_args = apply_filters('give_search_users_args', $get_users_args); |
|
377 | 377 | |
378 | - $found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search ); |
|
378 | + $found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search); |
|
379 | 379 | $results = array(); |
380 | 380 | |
381 | - if ( $found_users ) { |
|
381 | + if ($found_users) { |
|
382 | 382 | |
383 | - foreach ( $found_users as $user ) { |
|
383 | + foreach ($found_users as $user) { |
|
384 | 384 | |
385 | 385 | $results[] = array( |
386 | 386 | 'id' => $user->ID, |
387 | - 'name' => esc_html( $user->user_login . ' (' . $user->user_email . ')' ), |
|
387 | + 'name' => esc_html($user->user_login.' ('.$user->user_email.')'), |
|
388 | 388 | ); |
389 | 389 | } |
390 | 390 | } else { |
391 | 391 | |
392 | 392 | $results[] = array( |
393 | 393 | 'id' => 0, |
394 | - 'name' => __( 'No users found.', 'give' ), |
|
394 | + 'name' => __('No users found.', 'give'), |
|
395 | 395 | ); |
396 | 396 | |
397 | 397 | } |
398 | 398 | |
399 | - echo json_encode( $results ); |
|
399 | + echo json_encode($results); |
|
400 | 400 | |
401 | 401 | }// End if(). |
402 | 402 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | } |
406 | 406 | |
407 | -add_action( 'wp_ajax_give_user_search', 'give_ajax_search_users' ); |
|
407 | +add_action('wp_ajax_give_user_search', 'give_ajax_search_users'); |
|
408 | 408 | |
409 | 409 | |
410 | 410 | /** |
@@ -416,32 +416,32 @@ discard block |
||
416 | 416 | */ |
417 | 417 | function give_check_for_form_price_variations() { |
418 | 418 | |
419 | - if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
420 | - die( '-1' ); |
|
419 | + if ( ! current_user_can('edit_give_forms', get_current_user_id())) { |
|
420 | + die('-1'); |
|
421 | 421 | } |
422 | 422 | |
423 | - $form_id = intval( $_POST['form_id'] ); |
|
424 | - $form = get_post( $form_id ); |
|
423 | + $form_id = intval($_POST['form_id']); |
|
424 | + $form = get_post($form_id); |
|
425 | 425 | |
426 | - if ( 'give_forms' != $form->post_type ) { |
|
427 | - die( '-2' ); |
|
426 | + if ('give_forms' != $form->post_type) { |
|
427 | + die('-2'); |
|
428 | 428 | } |
429 | 429 | |
430 | - if ( give_has_variable_prices( $form_id ) ) { |
|
431 | - $variable_prices = give_get_variable_prices( $form_id ); |
|
430 | + if (give_has_variable_prices($form_id)) { |
|
431 | + $variable_prices = give_get_variable_prices($form_id); |
|
432 | 432 | |
433 | - if ( $variable_prices ) { |
|
433 | + if ($variable_prices) { |
|
434 | 434 | $ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">'; |
435 | 435 | |
436 | - if ( isset( $_POST['all_prices'] ) ) { |
|
437 | - $ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>'; |
|
436 | + if (isset($_POST['all_prices'])) { |
|
437 | + $ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>'; |
|
438 | 438 | } |
439 | 439 | |
440 | - foreach ( $variable_prices as $key => $price ) { |
|
440 | + foreach ($variable_prices as $key => $price) { |
|
441 | 441 | |
442 | - $level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ); |
|
442 | + $level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))); |
|
443 | 443 | |
444 | - $ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>'; |
|
444 | + $ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>'; |
|
445 | 445 | } |
446 | 446 | $ajax_response .= '</select>'; |
447 | 447 | echo $ajax_response; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | give_die(); |
452 | 452 | } |
453 | 453 | |
454 | -add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' ); |
|
454 | +add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations'); |
|
455 | 455 | |
456 | 456 | |
457 | 457 | /** |
@@ -462,25 +462,25 @@ discard block |
||
462 | 462 | * @return void |
463 | 463 | */ |
464 | 464 | function give_check_for_form_price_variations_html() { |
465 | - if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) { |
|
465 | + if ( ! current_user_can('edit_give_payments', get_current_user_id())) { |
|
466 | 466 | wp_die(); |
467 | 467 | } |
468 | 468 | |
469 | - $form_id = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0; |
|
470 | - $payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : 0; |
|
471 | - $form = get_post( $form_id ); |
|
469 | + $form_id = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : 0; |
|
470 | + $payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : 0; |
|
471 | + $form = get_post($form_id); |
|
472 | 472 | |
473 | - if ( 'give_forms' != $form->post_type ) { |
|
473 | + if ('give_forms' != $form->post_type) { |
|
474 | 474 | wp_die(); |
475 | 475 | } |
476 | 476 | |
477 | - if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) { |
|
478 | - esc_html_e( 'n/a', 'give' ); |
|
477 | + if ( ! give_has_variable_prices($form_id) || ! $form_id) { |
|
478 | + esc_html_e('n/a', 'give'); |
|
479 | 479 | } else { |
480 | 480 | $prices_atts = ''; |
481 | - if ( $variable_prices = give_get_variable_prices( $form_id ) ) { |
|
482 | - foreach ( $variable_prices as $variable_price ) { |
|
483 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
481 | + if ($variable_prices = give_get_variable_prices($form_id)) { |
|
482 | + foreach ($variable_prices as $variable_price) { |
|
483 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | 'chosen' => true, |
492 | 492 | 'show_option_all' => '', |
493 | 493 | 'show_option_none' => '', |
494 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
494 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
495 | 495 | ); |
496 | 496 | |
497 | - if ( $payment_id ) { |
|
497 | + if ($payment_id) { |
|
498 | 498 | // Payment object. |
499 | - $payment = new Give_Payment( $payment_id ); |
|
499 | + $payment = new Give_Payment($payment_id); |
|
500 | 500 | |
501 | 501 | // Payment meta. |
502 | 502 | $payment_meta = $payment->get_meta(); |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // Render variable prices select tag html. |
507 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
507 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | give_die(); |
511 | 511 | } |
512 | 512 | |
513 | -add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' ); |
|
513 | +add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html'); |
@@ -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 | |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
33 | 33 | |
34 | 34 | //Payments |
35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
36 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
37 | 37 | |
38 | 38 | //Donors |
39 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
39 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
40 | 40 | |
41 | 41 | //Reports` |
42 | 42 | $give_reports_page = add_submenu_page( |
43 | 43 | 'edit.php?post_type=give_forms', |
44 | - esc_html__( 'Donation Reports', 'give' ), |
|
45 | - esc_html__( 'Reports', 'give' ), |
|
44 | + esc_html__('Donation Reports', 'give'), |
|
45 | + esc_html__('Reports', 'give'), |
|
46 | 46 | 'view_give_reports', |
47 | 47 | 'give-reports', |
48 | 48 | array( |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | //Settings |
55 | 55 | $give_settings_page = add_submenu_page( |
56 | 56 | 'edit.php?post_type=give_forms', |
57 | - esc_html__( 'Give Settings', 'give' ), |
|
58 | - esc_html__( 'Settings', 'give' ), |
|
57 | + esc_html__('Give Settings', 'give'), |
|
58 | + esc_html__('Settings', 'give'), |
|
59 | 59 | 'manage_give_settings', |
60 | 60 | 'give-settings', |
61 | 61 | array( |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | //Tools. |
68 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
68 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
69 | 69 | Give()->give_settings, |
70 | 70 | 'output' |
71 | - ) ); |
|
71 | + )); |
|
72 | 72 | |
73 | 73 | //Add-ons |
74 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
74 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
75 | 75 | } |
76 | 76 | |
77 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
77 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Determines whether the current admin page is a Give admin page. |
@@ -89,224 +89,224 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return bool True if Give admin page. |
91 | 91 | */ |
92 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
92 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
93 | 93 | |
94 | 94 | global $pagenow, $typenow; |
95 | 95 | |
96 | 96 | $found = false; |
97 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
98 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
99 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
100 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
101 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
102 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
103 | - |
|
104 | - switch ( $passed_page ) { |
|
97 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
98 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
99 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
100 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
101 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
102 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
103 | + |
|
104 | + switch ($passed_page) { |
|
105 | 105 | case 'give_forms': |
106 | - switch ( $passed_view ) { |
|
106 | + switch ($passed_view) { |
|
107 | 107 | case 'list-table': |
108 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
108 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
109 | 109 | $found = true; |
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'edit': |
113 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
113 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
114 | 114 | $found = true; |
115 | 115 | } |
116 | 116 | break; |
117 | 117 | case 'new': |
118 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
118 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
119 | 119 | $found = true; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | default: |
123 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
123 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
124 | 124 | $found = true; |
125 | 125 | } |
126 | 126 | break; |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | case 'categories': |
130 | - switch ( $passed_view ) { |
|
130 | + switch ($passed_view) { |
|
131 | 131 | case 'list-table': |
132 | 132 | case 'new': |
133 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
133 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
134 | 134 | $found = true; |
135 | 135 | } |
136 | 136 | break; |
137 | 137 | case 'edit': |
138 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
138 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
139 | 139 | $found = true; |
140 | 140 | } |
141 | 141 | break; |
142 | 142 | default: |
143 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
143 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
144 | 144 | $found = true; |
145 | 145 | } |
146 | 146 | break; |
147 | 147 | } |
148 | 148 | break; |
149 | 149 | case 'tags': |
150 | - switch ( $passed_view ) { |
|
150 | + switch ($passed_view) { |
|
151 | 151 | case 'list-table': |
152 | 152 | case 'new': |
153 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
153 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
154 | 154 | $found = true; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case 'edit': |
158 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
158 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
159 | 159 | $found = true; |
160 | 160 | } |
161 | 161 | break; |
162 | 162 | default: |
163 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
163 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
164 | 164 | $found = true; |
165 | 165 | } |
166 | 166 | break; |
167 | 167 | } |
168 | 168 | break; |
169 | 169 | case 'payments': |
170 | - switch ( $passed_view ) { |
|
170 | + switch ($passed_view) { |
|
171 | 171 | case 'list-table': |
172 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
172 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
173 | 173 | $found = true; |
174 | 174 | } |
175 | 175 | break; |
176 | 176 | case 'edit': |
177 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
177 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
178 | 178 | $found = true; |
179 | 179 | } |
180 | 180 | break; |
181 | 181 | default: |
182 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
182 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
183 | 183 | $found = true; |
184 | 184 | } |
185 | 185 | break; |
186 | 186 | } |
187 | 187 | break; |
188 | 188 | case 'reports': |
189 | - switch ( $passed_view ) { |
|
189 | + switch ($passed_view) { |
|
190 | 190 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
191 | 191 | case 'earnings': |
192 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
192 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
193 | 193 | $found = true; |
194 | 194 | } |
195 | 195 | break; |
196 | 196 | case 'donors': |
197 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
197 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
198 | 198 | $found = true; |
199 | 199 | } |
200 | 200 | break; |
201 | 201 | case 'gateways': |
202 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
202 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
203 | 203 | $found = true; |
204 | 204 | } |
205 | 205 | break; |
206 | 206 | case 'export': |
207 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
207 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
208 | 208 | $found = true; |
209 | 209 | } |
210 | 210 | break; |
211 | 211 | case 'logs': |
212 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
212 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
213 | 213 | $found = true; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | default: |
217 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
217 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
218 | 218 | $found = true; |
219 | 219 | } |
220 | 220 | break; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'settings': |
224 | - switch ( $passed_view ) { |
|
224 | + switch ($passed_view) { |
|
225 | 225 | case 'general': |
226 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
226 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
227 | 227 | $found = true; |
228 | 228 | } |
229 | 229 | break; |
230 | 230 | case 'gateways': |
231 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
231 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
232 | 232 | $found = true; |
233 | 233 | } |
234 | 234 | break; |
235 | 235 | case 'emails': |
236 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
236 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
237 | 237 | $found = true; |
238 | 238 | } |
239 | 239 | break; |
240 | 240 | case 'display': |
241 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
241 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
242 | 242 | $found = true; |
243 | 243 | } |
244 | 244 | break; |
245 | 245 | case 'licenses': |
246 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
246 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
247 | 247 | $found = true; |
248 | 248 | } |
249 | 249 | break; |
250 | 250 | case 'api': |
251 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
251 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
252 | 252 | $found = true; |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'advanced': |
256 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
256 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
257 | 257 | $found = true; |
258 | 258 | } |
259 | 259 | break; |
260 | 260 | case 'system_info': |
261 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
261 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
262 | 262 | $found = true; |
263 | 263 | } |
264 | 264 | break; |
265 | 265 | default: |
266 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
266 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
267 | 267 | $found = true; |
268 | 268 | } |
269 | 269 | break; |
270 | 270 | } |
271 | 271 | break; |
272 | 272 | case 'addons': |
273 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
273 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
274 | 274 | $found = true; |
275 | 275 | } |
276 | 276 | break; |
277 | 277 | case 'donors': |
278 | - switch ( $passed_view ) { |
|
278 | + switch ($passed_view) { |
|
279 | 279 | case 'list-table': |
280 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
280 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
281 | 281 | $found = true; |
282 | 282 | } |
283 | 283 | break; |
284 | 284 | case 'overview': |
285 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
285 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
286 | 286 | $found = true; |
287 | 287 | } |
288 | 288 | break; |
289 | 289 | case 'notes': |
290 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
290 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
291 | 291 | $found = true; |
292 | 292 | } |
293 | 293 | break; |
294 | 294 | default: |
295 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
295 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
296 | 296 | $found = true; |
297 | 297 | } |
298 | 298 | break; |
299 | 299 | } |
300 | 300 | break; |
301 | 301 | case 'reports': |
302 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
302 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
303 | 303 | $found = true; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | default: |
307 | 307 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
308 | 308 | |
309 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
309 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
310 | 310 | $give_payments_page, |
311 | 311 | $give_settings_page, |
312 | 312 | $give_reports_page, |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | $give_donors_page, |
317 | 317 | $give_tools_page, |
318 | 318 | 'widgets.php' |
319 | - ) ); |
|
320 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
319 | + )); |
|
320 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
321 | 321 | $found = true; |
322 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
322 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
323 | 323 | $found = true; |
324 | 324 | } |
325 | 325 | break; |
326 | 326 | } |
327 | 327 | |
328 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
328 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
@@ -337,37 +337,37 @@ discard block |
||
337 | 337 | * @param array $settings |
338 | 338 | * @return array |
339 | 339 | */ |
340 | -function give_settings_page_pages( $settings ) { |
|
341 | - include( 'abstract-admin-settings-page.php' ); |
|
342 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
340 | +function give_settings_page_pages($settings) { |
|
341 | + include('abstract-admin-settings-page.php'); |
|
342 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
343 | 343 | |
344 | 344 | $settings = array( |
345 | 345 | // General settings. |
346 | - include( 'settings/class-settings-general.php' ), |
|
346 | + include('settings/class-settings-general.php'), |
|
347 | 347 | |
348 | 348 | // Payment Gateways Settings. |
349 | - include( 'settings/class-settings-gateways.php' ), |
|
349 | + include('settings/class-settings-gateways.php'), |
|
350 | 350 | |
351 | 351 | // Display settings. |
352 | - include( 'settings/class-settings-display.php' ), |
|
352 | + include('settings/class-settings-display.php'), |
|
353 | 353 | |
354 | 354 | // Emails settings. |
355 | - include( 'settings/class-settings-email.php' ), |
|
355 | + include('settings/class-settings-email.php'), |
|
356 | 356 | |
357 | 357 | // Addons settings. |
358 | - include( 'settings/class-settings-addon.php' ), |
|
358 | + include('settings/class-settings-addon.php'), |
|
359 | 359 | |
360 | 360 | // License settings. |
361 | - include( 'settings/class-settings-license.php' ), |
|
361 | + include('settings/class-settings-license.php'), |
|
362 | 362 | |
363 | 363 | // Advanced settings. |
364 | - include( 'settings/class-settings-advanced.php' ) |
|
364 | + include('settings/class-settings-advanced.php') |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | // Output. |
368 | 368 | return $settings; |
369 | 369 | } |
370 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
370 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -377,25 +377,25 @@ discard block |
||
377 | 377 | * @param array $settings |
378 | 378 | * @return array |
379 | 379 | */ |
380 | -function give_reports_page_pages( $settings ) { |
|
381 | - include( 'abstract-admin-settings-page.php' ); |
|
380 | +function give_reports_page_pages($settings) { |
|
381 | + include('abstract-admin-settings-page.php'); |
|
382 | 382 | |
383 | 383 | $settings = array( |
384 | 384 | // Earnings. |
385 | - include( 'reports/class-earnings-report.php' ), |
|
385 | + include('reports/class-earnings-report.php'), |
|
386 | 386 | |
387 | 387 | // Forms. |
388 | - include( 'reports/class-forms-report.php' ), |
|
388 | + include('reports/class-forms-report.php'), |
|
389 | 389 | |
390 | 390 | // Gateways. |
391 | - include( 'reports/class-gateways-report.php' ), |
|
391 | + include('reports/class-gateways-report.php'), |
|
392 | 392 | |
393 | 393 | ); |
394 | 394 | |
395 | 395 | // Output. |
396 | 396 | return $settings; |
397 | 397 | } |
398 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
398 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Add setting tab to give-settings page |
@@ -404,34 +404,34 @@ discard block |
||
404 | 404 | * @param array $settings |
405 | 405 | * @return array |
406 | 406 | */ |
407 | -function give_tools_page_pages( $settings ) { |
|
408 | - include( 'abstract-admin-settings-page.php' ); |
|
407 | +function give_tools_page_pages($settings) { |
|
408 | + include('abstract-admin-settings-page.php'); |
|
409 | 409 | |
410 | 410 | $settings = array( |
411 | 411 | // System Info. |
412 | - include( 'tools/class-settings-system-info.php' ), |
|
412 | + include('tools/class-settings-system-info.php'), |
|
413 | 413 | |
414 | 414 | // Logs. |
415 | - include( 'tools/class-settings-logs.php' ), |
|
415 | + include('tools/class-settings-logs.php'), |
|
416 | 416 | |
417 | 417 | // API. |
418 | - include( 'tools/class-settings-api.php' ), |
|
418 | + include('tools/class-settings-api.php'), |
|
419 | 419 | |
420 | 420 | // Data. |
421 | - include( 'tools/class-settings-data.php' ), |
|
421 | + include('tools/class-settings-data.php'), |
|
422 | 422 | |
423 | 423 | // Export. |
424 | - include( 'tools/class-settings-export.php' ), |
|
424 | + include('tools/class-settings-export.php'), |
|
425 | 425 | |
426 | 426 | // Import |
427 | - include_once( 'tools/class-settings-import.php' ), |
|
427 | + include_once('tools/class-settings-import.php'), |
|
428 | 428 | |
429 | 429 | ); |
430 | 430 | |
431 | 431 | // Output. |
432 | 432 | return $settings; |
433 | 433 | } |
434 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
434 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Set default tools page tab. |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | * @param string $default_tab Default tab name. |
441 | 441 | * @return string |
442 | 442 | */ |
443 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
443 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
444 | 444 | return 'system-info'; |
445 | 445 | } |
446 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
446 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
447 | 447 | |
448 | 448 | |
449 | 449 | /** |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param string $default_tab Default tab name. |
454 | 454 | * @return string |
455 | 455 | */ |
456 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
456 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
457 | 457 | return 'earnings'; |
458 | 458 | } |
459 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
460 | 459 | \ No newline at end of file |
460 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
461 | 461 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * |
65 | 65 | * @param string $value |
66 | 66 | * |
67 | - * @return mixed |
|
67 | + * @return string |
|
68 | 68 | */ |
69 | 69 | function __give_validate_decimal_separator_setting_field( $value ) { |
70 | 70 | $thousand_separator = give_clean( $_POST['thousands_separator'] ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return mixed |
29 | 29 | */ |
30 | -function __give_sanitize_number_decimals_setting_field( $value ) { |
|
30 | +function __give_sanitize_number_decimals_setting_field($value) { |
|
31 | 31 | $value_changed = false; |
32 | 32 | $old_value = $value; |
33 | 33 | |
34 | - if ( isset( $_POST['decimal_separator'] ) ) { |
|
35 | - $value = ! empty( $_POST['decimal_separator'] ) ? $value : 0; |
|
34 | + if (isset($_POST['decimal_separator'])) { |
|
35 | + $value = ! empty($_POST['decimal_separator']) ? $value : 0; |
|
36 | 36 | $value_changed = true; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $value_changed && ( $old_value != $value ) ) { |
|
40 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) ); |
|
39 | + if ($value_changed && ($old_value != $value)) { |
|
40 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give')); |
|
41 | 41 | } |
42 | 42 | |
43 | - $value = absint( $value ); |
|
43 | + $value = absint($value); |
|
44 | 44 | |
45 | - if( 6 <= $value ) { |
|
45 | + if (6 <= $value) { |
|
46 | 46 | $value = 5; |
47 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) ); |
|
47 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give')); |
|
48 | 48 | } |
49 | 49 | |
50 | - return absint( $value ); |
|
50 | + return absint($value); |
|
51 | 51 | } |
52 | 52 | |
53 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 ); |
|
53 | +add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | -function __give_validate_decimal_separator_setting_field( $value ) { |
|
70 | - $thousand_separator = give_clean( $_POST['thousands_separator'] ); |
|
71 | - $decimal_separator = give_clean( $_POST['decimal_separator'] ); |
|
69 | +function __give_validate_decimal_separator_setting_field($value) { |
|
70 | + $thousand_separator = give_clean($_POST['thousands_separator']); |
|
71 | + $decimal_separator = give_clean($_POST['decimal_separator']); |
|
72 | 72 | |
73 | - if ( $decimal_separator === $thousand_separator ) { |
|
73 | + if ($decimal_separator === $thousand_separator) { |
|
74 | 74 | $value = ''; |
75 | 75 | $_POST['number_decimals'] = 0; |
76 | - Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) ); |
|
76 | + Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give')); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $value; |
80 | 80 | } |
81 | 81 | |
82 | -add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 ); |
|
82 | +add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Change $delimiter text to symbol. |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return string $delimiter. |
92 | 92 | */ |
93 | -function __give_import_delimiter_set_callback( $delimiter ) { |
|
93 | +function __give_import_delimiter_set_callback($delimiter) { |
|
94 | 94 | $delimite_type = array( |
95 | 95 | 'csv' => ",", |
96 | 96 | 'tab-separated-values' => "\t", |
97 | 97 | ); |
98 | 98 | |
99 | - return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : "," ); |
|
99 | + return (array_key_exists($delimiter, $delimite_type) ? $delimite_type[$delimiter] : ","); |
|
100 | 100 | } |
101 | 101 | |
102 | -add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 ); |
|
103 | 102 | \ No newline at end of file |
103 | +add_filter('give_import_delimiter_set', '__give_import_delimiter_set_callback', 10); |
|
104 | 104 | \ No newline at end of file |