@@ -398,6 +398,7 @@ |
||
398 | 398 | * |
399 | 399 | * @since 1.6 |
400 | 400 | * |
401 | + * @param Give_Payment $payment |
|
401 | 402 | * @return mixed|void |
402 | 403 | */ |
403 | 404 | function get_row_actions( $payment ) { |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,37 +118,37 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
124 | 124 | 'ajax' => false // Does this table support ajax? |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function advanced_filters() { |
133 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
134 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
135 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
133 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
134 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
135 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
136 | 136 | ?> |
137 | 137 | <div id="give-payment-filters"> |
138 | 138 | <span id="give-payment-date-filters"> |
139 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
139 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
140 | 140 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
141 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
141 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
142 | 142 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
143 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
143 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
144 | 144 | </span> |
145 | - <?php if ( ! empty( $status ) ) : ?> |
|
146 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
145 | + <?php if ( ! empty($status)) : ?> |
|
146 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
147 | 147 | <?php endif; ?> |
148 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
149 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
148 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
149 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
151 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
152 | 152 | </div> |
153 | 153 | |
154 | 154 | <?php |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function search_box( $text, $input_id ) { |
|
169 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
168 | + public function search_box($text, $input_id) { |
|
169 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - $input_id = $input_id . '-search-input'; |
|
173 | + $input_id = $input_id.'-search-input'; |
|
174 | 174 | |
175 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
176 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
175 | + if ( ! empty($_REQUEST['orderby'])) { |
|
176 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
177 | 177 | } |
178 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
179 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
178 | + if ( ! empty($_REQUEST['order'])) { |
|
179 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | <p class="search-box"> |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_payment_history_search' ); |
|
191 | + do_action('give_payment_history_search'); |
|
192 | 192 | ?> |
193 | 193 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
194 | 194 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
195 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
195 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
196 | 196 | </p> |
197 | 197 | <?php |
198 | 198 | } |
@@ -206,52 +206,52 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_views() { |
208 | 208 | |
209 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
210 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
211 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
212 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
213 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
214 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
215 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
216 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
217 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
209 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
210 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
211 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
212 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
213 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
214 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
215 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
216 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
217 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
218 | 218 | |
219 | 219 | $views = array( |
220 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
220 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
221 | 221 | 'status', |
222 | 222 | 'paged' |
223 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
224 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
223 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
224 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
225 | 225 | 'status' => 'publish', |
226 | 226 | 'paged' => false |
227 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
228 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
227 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
228 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
229 | 229 | 'status' => 'pending', |
230 | 230 | 'paged' => false |
231 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
232 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
231 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
232 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
233 | 233 | 'status' => 'refunded', |
234 | 234 | 'paged' => false |
235 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
236 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
235 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
236 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
237 | 237 | 'status' => 'revoked', |
238 | 238 | 'paged' => false |
239 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
240 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
239 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
240 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
241 | 241 | 'status' => 'failed', |
242 | 242 | 'paged' => false |
243 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
244 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
243 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
244 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
245 | 245 | 'status' => 'cancelled', |
246 | 246 | 'paged' => false |
247 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
248 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
247 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
248 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
249 | 249 | 'status' => 'abandoned', |
250 | 250 | 'paged' => false |
251 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
251 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
252 | 252 | ); |
253 | 253 | |
254 | - return apply_filters( 'give_payments_table_views', $views ); |
|
254 | + return apply_filters('give_payments_table_views', $views); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | public function get_columns() { |
265 | 265 | $columns = array( |
266 | 266 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
267 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
268 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
269 | - 'status' => esc_html__( 'Status', 'give' ), |
|
270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
267 | + 'donation' => esc_html__('Donation', 'give'), |
|
268 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
269 | + 'status' => esc_html__('Status', 'give'), |
|
270 | + 'date' => esc_html__('Date', 'give'), |
|
271 | + 'amount' => esc_html__('Amount', 'give'), |
|
272 | + 'details' => esc_html__('Details', 'give'), |
|
273 | 273 | ); |
274 | 274 | |
275 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
275 | + return apply_filters('give_payments_table_columns', $columns); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_sortable_columns() { |
286 | 286 | $columns = array( |
287 | - 'donation' => array( 'ID', true ), |
|
288 | - 'amount' => array( 'amount', false ), |
|
289 | - 'date' => array( 'date', false ) |
|
287 | + 'donation' => array('ID', true), |
|
288 | + 'amount' => array('amount', false), |
|
289 | + 'date' => array('date', false) |
|
290 | 290 | ); |
291 | 291 | |
292 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
292 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -315,59 +315,59 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Column Name |
317 | 317 | */ |
318 | - public function column_default( $payment, $column_name ) { |
|
318 | + public function column_default($payment, $column_name) { |
|
319 | 319 | |
320 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
321 | - $row_actions = $this->get_row_actions( $payment ); |
|
320 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
321 | + $row_actions = $this->get_row_actions($payment); |
|
322 | 322 | |
323 | - switch ( $column_name ) { |
|
323 | + switch ($column_name) { |
|
324 | 324 | case 'donation' : |
325 | 325 | ob_start(); |
326 | 326 | ?> |
327 | - <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e( 'View details', 'give' ) ?>">#<?php echo $payment->ID; ?></a> <?php _e( 'by', 'give' ); ?> <?php echo $this->get_donor( $payment ); ?> |
|
327 | + <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e('View details', 'give') ?>">#<?php echo $payment->ID; ?></a> <?php _e('by', 'give'); ?> <?php echo $this->get_donor($payment); ?> |
|
328 | 328 | <br> |
329 | - <?php echo $this->get_donor_email( $payment ); ?> |
|
330 | - <?php echo $this->row_actions( $row_actions ); ?> |
|
329 | + <?php echo $this->get_donor_email($payment); ?> |
|
330 | + <?php echo $this->row_actions($row_actions); ?> |
|
331 | 331 | <?php |
332 | 332 | $value = ob_get_clean(); |
333 | 333 | break; |
334 | 334 | |
335 | 335 | case 'amount' : |
336 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
337 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
336 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
337 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'donation_form' : |
341 | 341 | |
342 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
343 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
342 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
343 | + $level = give_get_payment_form_title($payment->meta, true); |
|
344 | 344 | |
345 | - if ( ! empty( $level ) ) { |
|
345 | + if ( ! empty($level)) { |
|
346 | 346 | $value .= $level; |
347 | 347 | } |
348 | 348 | |
349 | 349 | break; |
350 | 350 | |
351 | 351 | case 'date' : |
352 | - $date = strtotime( $payment->date ); |
|
353 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
352 | + $date = strtotime($payment->date); |
|
353 | + $value = date_i18n(get_option('date_format'), $date); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'status' : |
357 | - $value = $this->get_payment_status( $payment ); |
|
357 | + $value = $this->get_payment_status($payment); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'details' : |
361 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_donation_url . '" data-tooltip="' . __( 'View details', 'give' ) . '" class="give-payment-details-link button button-small" title="' . __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
361 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_donation_url.'" data-tooltip="'.__('View details', 'give').'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default: |
365 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
365 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
366 | 366 | break; |
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
370 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return string Data shown in the Email column |
382 | 382 | */ |
383 | - public function get_donor_email( $payment ) { |
|
383 | + public function get_donor_email($payment) { |
|
384 | 384 | |
385 | - $email = give_get_payment_user_email( $payment->ID ); |
|
385 | + $email = give_get_payment_user_email($payment->ID); |
|
386 | 386 | |
387 | - if ( empty( $email ) ) { |
|
388 | - $email = esc_html__( '(unknown)', 'give' ); |
|
387 | + if (empty($email)) { |
|
388 | + $email = esc_html__('(unknown)', 'give'); |
|
389 | 389 | } |
390 | 390 | |
391 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
391 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
392 | 392 | |
393 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
393 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return mixed|void |
402 | 402 | */ |
403 | - function get_row_actions( $payment ) { |
|
403 | + function get_row_actions($payment) { |
|
404 | 404 | |
405 | 405 | $row_actions = array(); |
406 | - $email = give_get_payment_user_email( $payment->ID ); |
|
406 | + $email = give_get_payment_user_email($payment->ID); |
|
407 | 407 | |
408 | 408 | // Add search term string back to base URL |
409 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
410 | - if ( ! empty( $search_terms ) ) { |
|
411 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
409 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
410 | + if ( ! empty($search_terms)) { |
|
411 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
412 | 412 | } |
413 | 413 | |
414 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
415 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
414 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
415 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
416 | 416 | 'give-action' => 'email_links', |
417 | 417 | 'purchase_id' => $payment->ID |
418 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
418 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
422 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
423 | 423 | 'give-action' => 'delete_payment', |
424 | 424 | 'purchase_id' => $payment->ID |
425 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
425 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
426 | 426 | |
427 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
427 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return string Data shown in the Email column |
439 | 439 | */ |
440 | - function get_payment_status( $payment ) { |
|
441 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
442 | - if ( $payment->mode == 'test' ) { |
|
443 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
440 | + function get_payment_status($payment) { |
|
441 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
442 | + if ($payment->mode == 'test') { |
|
443 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $value; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string Displays a checkbox |
458 | 458 | */ |
459 | - public function column_cb( $payment ) { |
|
459 | + public function column_cb($payment) { |
|
460 | 460 | return sprintf( |
461 | 461 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
462 | 462 | 'payment', |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string Displays a checkbox |
476 | 476 | */ |
477 | - public function get_payment_id( $payment ) { |
|
478 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
477 | + public function get_payment_id($payment) { |
|
478 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string Data shown in the User column |
490 | 490 | */ |
491 | - public function get_donor( $payment ) { |
|
491 | + public function get_donor($payment) { |
|
492 | 492 | |
493 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
493 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
494 | 494 | |
495 | - if ( ! empty( $customer_id ) ) { |
|
496 | - $customer = new Give_Customer( $customer_id ); |
|
497 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
495 | + if ( ! empty($customer_id)) { |
|
496 | + $customer = new Give_Customer($customer_id); |
|
497 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
498 | 498 | } else { |
499 | - $email = give_get_payment_user_email( $payment->ID ); |
|
500 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
499 | + $email = give_get_payment_user_email($payment->ID); |
|
500 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
501 | 501 | } |
502 | 502 | |
503 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
503 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -512,18 +512,18 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function get_bulk_actions() { |
514 | 514 | $actions = array( |
515 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
516 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
517 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
518 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
519 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
520 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
521 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
522 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
523 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
515 | + 'delete' => esc_html__('Delete', 'give'), |
|
516 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
517 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
518 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
519 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
520 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
521 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
522 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
523 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
524 | 524 | ); |
525 | 525 | |
526 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
526 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function process_bulk_action() { |
537 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
537 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
538 | 538 | $action = $this->current_action(); |
539 | 539 | |
540 | - if ( ! is_array( $ids ) ) { |
|
541 | - $ids = array( $ids ); |
|
540 | + if ( ! is_array($ids)) { |
|
541 | + $ids = array($ids); |
|
542 | 542 | } |
543 | 543 | |
544 | - if ( empty( $action ) ) { |
|
544 | + if (empty($action)) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - foreach ( $ids as $id ) { |
|
548 | + foreach ($ids as $id) { |
|
549 | 549 | |
550 | 550 | // Detect when a bulk action is being triggered... |
551 | - switch ( $this->current_action() ) { |
|
551 | + switch ($this->current_action()) { |
|
552 | 552 | |
553 | 553 | case'delete': |
554 | - give_delete_purchase( $id ); |
|
554 | + give_delete_purchase($id); |
|
555 | 555 | break; |
556 | 556 | |
557 | 557 | case 'set-status-publish': |
558 | - give_update_payment_status( $id, 'publish' ); |
|
558 | + give_update_payment_status($id, 'publish'); |
|
559 | 559 | break; |
560 | 560 | |
561 | 561 | case 'set-status-pending': |
562 | - give_update_payment_status( $id, 'pending' ); |
|
562 | + give_update_payment_status($id, 'pending'); |
|
563 | 563 | break; |
564 | 564 | |
565 | 565 | case 'set-status-refunded': |
566 | - give_update_payment_status( $id, 'refunded' ); |
|
566 | + give_update_payment_status($id, 'refunded'); |
|
567 | 567 | break; |
568 | 568 | case 'set-status-revoked': |
569 | - give_update_payment_status( $id, 'revoked' ); |
|
569 | + give_update_payment_status($id, 'revoked'); |
|
570 | 570 | break; |
571 | 571 | |
572 | 572 | case 'set-status-failed': |
573 | - give_update_payment_status( $id, 'failed' ); |
|
573 | + give_update_payment_status($id, 'failed'); |
|
574 | 574 | break; |
575 | 575 | |
576 | 576 | case 'set-status-cancelled': |
577 | - give_update_payment_status( $id, 'cancelled' ); |
|
577 | + give_update_payment_status($id, 'cancelled'); |
|
578 | 578 | break; |
579 | 579 | |
580 | 580 | case 'set-status-abandoned': |
581 | - give_update_payment_status( $id, 'abandoned' ); |
|
581 | + give_update_payment_status($id, 'abandoned'); |
|
582 | 582 | break; |
583 | 583 | |
584 | 584 | case 'set-status-preapproval': |
585 | - give_update_payment_status( $id, 'preapproval' ); |
|
585 | + give_update_payment_status($id, 'preapproval'); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | case 'resend-receipt': |
589 | - give_email_donation_receipt( $id, false ); |
|
589 | + give_email_donation_receipt($id, false); |
|
590 | 590 | break; |
591 | 591 | } |
592 | 592 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $id The ID of the payment. |
599 | 599 | * @param string $current_action The action that is being triggered. |
600 | 600 | */ |
601 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
601 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | } |
@@ -614,27 +614,27 @@ discard block |
||
614 | 614 | |
615 | 615 | $args = array(); |
616 | 616 | |
617 | - if ( isset( $_GET['user'] ) ) { |
|
618 | - $args['user'] = urldecode( $_GET['user'] ); |
|
619 | - } elseif ( isset( $_GET['s'] ) ) { |
|
620 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
621 | - if ( $is_user ) { |
|
622 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
623 | - unset( $args['s'] ); |
|
617 | + if (isset($_GET['user'])) { |
|
618 | + $args['user'] = urldecode($_GET['user']); |
|
619 | + } elseif (isset($_GET['s'])) { |
|
620 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
621 | + if ($is_user) { |
|
622 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
623 | + unset($args['s']); |
|
624 | 624 | } else { |
625 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
625 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
630 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
629 | + if ( ! empty($_GET['start-date'])) { |
|
630 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
631 | 631 | } |
632 | 632 | |
633 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
634 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
633 | + if ( ! empty($_GET['end-date'])) { |
|
634 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
635 | 635 | } |
636 | 636 | |
637 | - $payment_count = give_count_payments( $args ); |
|
637 | + $payment_count = give_count_payments($args); |
|
638 | 638 | $this->complete_count = $payment_count->publish; |
639 | 639 | $this->pending_count = $payment_count->pending; |
640 | 640 | $this->refunded_count = $payment_count->refunded; |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $this->cancelled_count = $payment_count->cancelled; |
644 | 644 | $this->abandoned_count = $payment_count->abandoned; |
645 | 645 | |
646 | - foreach ( $payment_count as $count ) { |
|
646 | + foreach ($payment_count as $count) { |
|
647 | 647 | $this->total_count += $count; |
648 | 648 | } |
649 | 649 | } |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | public function payments_data() { |
659 | 659 | |
660 | 660 | $per_page = $this->per_page; |
661 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
662 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
663 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
664 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
666 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
667 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
668 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
669 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
670 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
671 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
672 | - |
|
673 | - if ( ! empty( $search ) ) { |
|
661 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
662 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
663 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
664 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
666 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
667 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
668 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
669 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
670 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
671 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
672 | + |
|
673 | + if ( ! empty($search)) { |
|
674 | 674 | $status = 'any'; // Force all payment statuses when searching |
675 | 675 | } |
676 | 676 | |
677 | 677 | $args = array( |
678 | 678 | 'output' => 'payments', |
679 | 679 | 'number' => $per_page, |
680 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
680 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
681 | 681 | 'orderby' => $orderby, |
682 | 682 | 'order' => $order, |
683 | 683 | 'user' => $user, |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | 'end_date' => $end_date, |
692 | 692 | ); |
693 | 693 | |
694 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
694 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
695 | 695 | |
696 | 696 | $args['search_in_notes'] = true; |
697 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
697 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
701 | - $p_query = new Give_Payments_Query( $args ); |
|
701 | + $p_query = new Give_Payments_Query($args); |
|
702 | 702 | |
703 | 703 | return $p_query->get_payments(); |
704 | 704 | |
@@ -718,17 +718,17 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function prepare_items() { |
720 | 720 | |
721 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
721 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
722 | 722 | |
723 | 723 | $columns = $this->get_columns(); |
724 | 724 | $hidden = array(); // No hidden columns |
725 | 725 | $sortable = $this->get_sortable_columns(); |
726 | 726 | $data = $this->payments_data(); |
727 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
727 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
728 | 728 | |
729 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
729 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
730 | 730 | |
731 | - switch ( $status ) { |
|
731 | + switch ($status) { |
|
732 | 732 | case 'publish': |
733 | 733 | $total_items = $this->complete_count; |
734 | 734 | break; |
@@ -755,19 +755,19 @@ discard block |
||
755 | 755 | break; |
756 | 756 | default: |
757 | 757 | // Retrieve the count of the non-default-Give status |
758 | - $count = wp_count_posts( 'give_payment' ); |
|
758 | + $count = wp_count_posts('give_payment'); |
|
759 | 759 | $total_items = $count->{$status}; |
760 | 760 | break; |
761 | 761 | } |
762 | 762 | |
763 | 763 | $this->items = $data; |
764 | 764 | |
765 | - $this->set_pagination_args( array( |
|
765 | + $this->set_pagination_args(array( |
|
766 | 766 | 'total_items' => $total_items, |
767 | 767 | // WE have to calculate the total number of items |
768 | 768 | 'per_page' => $this->per_page, |
769 | 769 | // WE have to determine how many items to show on a page |
770 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
770 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
771 | 771 | // WE have to calculate the total number of pages |
772 | 772 | ) |
773 | 773 | ); |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Give Form widget |
17 | 17 | * |
18 | 18 | * @since 1.0 |
19 | 19 | */ |
20 | -class Give_Forms_Widget extends WP_Widget{ |
|
20 | +class Give_Forms_Widget extends WP_Widget { |
|
21 | 21 | /** |
22 | 22 | * The widget class name |
23 | 23 | * |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Instantiate the class |
30 | 30 | */ |
31 | - public function __construct(){ |
|
32 | - $this->self = get_class( $this ); |
|
31 | + public function __construct() { |
|
32 | + $this->self = get_class($this); |
|
33 | 33 | |
34 | 34 | parent::__construct( |
35 | - strtolower( $this->self ), |
|
36 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
35 | + strtolower($this->self), |
|
36 | + esc_html__('Give - Donation Form', 'give'), |
|
37 | 37 | array( |
38 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
38 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
39 | 39 | ) |
40 | 40 | ); |
41 | 41 | |
42 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
43 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
42 | + add_action('widgets_init', array($this, 'widget_init')); |
|
43 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,23 +50,23 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function admin_widget_scripts( $hook ){ |
|
53 | + public function admin_widget_scripts($hook) { |
|
54 | 54 | // Directories of assets |
55 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
56 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
57 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
55 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
56 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
57 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
58 | 58 | |
59 | 59 | // Use minified libraries if SCRIPT_DEBUG is turned off |
60 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
60 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
61 | 61 | |
62 | 62 | // Widget Script |
63 | - if ( $hook == 'widgets.php' ) { |
|
63 | + if ($hook == 'widgets.php') { |
|
64 | 64 | |
65 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
65 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
66 | 66 | |
67 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
67 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
68 | 68 | |
69 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
69 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | * before_widget, and after_widget. |
78 | 78 | * @param array $instance The settings for the particular instance of the widget. |
79 | 79 | */ |
80 | - public function widget( $args, $instance ){ |
|
81 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
82 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
80 | + public function widget($args, $instance) { |
|
81 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
82 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
83 | 83 | |
84 | 84 | echo $args['before_widget']; |
85 | 85 | |
86 | - do_action( 'give_before_forms_widget' ); |
|
86 | + do_action('give_before_forms_widget'); |
|
87 | 87 | |
88 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
88 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
89 | 89 | |
90 | - give_get_donation_form( $instance ); |
|
90 | + give_get_donation_form($instance); |
|
91 | 91 | |
92 | 92 | echo $args['after_widget']; |
93 | 93 | |
94 | - do_action( 'give_after_forms_widget' ); |
|
94 | + do_action('give_after_forms_widget'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -101,65 +101,65 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function form( $instance ){ |
|
104 | + public function form($instance) { |
|
105 | 105 | $defaults = array( |
106 | 106 | 'title' => '', |
107 | 107 | 'id' => '', |
108 | 108 | 'float_labels' => '', |
109 | 109 | ); |
110 | 110 | |
111 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
111 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
112 | 112 | |
113 | 113 | // Query Give Forms |
114 | 114 | $args = array( |
115 | 115 | 'post_type' => 'give_forms', |
116 | - 'posts_per_page' => - 1, |
|
116 | + 'posts_per_page' => -1, |
|
117 | 117 | 'post_status' => 'publish', |
118 | 118 | ); |
119 | 119 | |
120 | - $give_forms = get_posts( $args ); |
|
120 | + $give_forms = get_posts($args); |
|
121 | 121 | |
122 | 122 | // Widget: Title |
123 | 123 | |
124 | 124 | ?><p> |
125 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
126 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
127 | - <small><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
125 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
126 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
127 | + <small><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
128 | 128 | </p><?php |
129 | 129 | |
130 | 130 | // Widget: Give Form |
131 | 131 | |
132 | 132 | ?><p> |
133 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php |
|
133 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php |
|
134 | 134 | printf( |
135 | 135 | /* translators: %s: form singular label */ |
136 | - esc_html__( 'Give %s:', 'give' ), |
|
136 | + esc_html__('Give %s:', 'give'), |
|
137 | 137 | give_get_forms_label_singular() |
138 | 138 | ); |
139 | 139 | ?></label> |
140 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
141 | - <option value="current"><?php esc_html_e( '— Select —', 'give' ); ?></option> |
|
142 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
143 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option> |
|
140 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
141 | + <option value="current"><?php esc_html_e('— Select —', 'give'); ?></option> |
|
142 | + <?php foreach ($give_forms as $give_form) { ?> |
|
143 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option> |
|
144 | 144 | <?php } ?> |
145 | 145 | </select><br> |
146 | - <small><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
146 | + <small><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
147 | 147 | </p><?php |
148 | 148 | |
149 | 149 | // Widget: Floating Labels |
150 | 150 | |
151 | 151 | ?><p> |
152 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label> |
|
153 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"> |
|
154 | - <option value="" <?php selected( esc_attr( $instance['float_labels'] ), '' ) ?>><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
155 | - <option value="enabled" <?php selected( esc_attr( $instance['float_labels'] ), 'enabled' ) ?>><?php esc_html_e( 'Enabled', 'give' ); ?></option> |
|
156 | - <option value="disabled" <?php selected( esc_attr( $instance['float_labels'] ), 'disabled' ) ?>><?php esc_html_e( 'Disabled', 'give' ); ?></option> |
|
152 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label> |
|
153 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"> |
|
154 | + <option value="" <?php selected(esc_attr($instance['float_labels']), '') ?>><?php esc_html_e('- Select -', 'give'); ?></option> |
|
155 | + <option value="enabled" <?php selected(esc_attr($instance['float_labels']), 'enabled') ?>><?php esc_html_e('Enabled', 'give'); ?></option> |
|
156 | + <option value="disabled" <?php selected(esc_attr($instance['float_labels']), 'disabled') ?>><?php esc_html_e('Disabled', 'give'); ?></option> |
|
157 | 157 | </select><br> |
158 | 158 | <small><?php |
159 | 159 | printf( |
160 | 160 | /* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
161 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
162 | - esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) |
|
161 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
162 | + esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels') |
|
163 | 163 | ); |
164 | 164 | ?></small> |
165 | 165 | </p><?php |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - function widget_init(){ |
|
174 | - register_widget( $this->self ); |
|
173 | + function widget_init() { |
|
174 | + register_widget($this->self); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return array |
184 | 184 | */ |
185 | - public function update( $new_instance, $old_instance ){ |
|
185 | + public function update($new_instance, $old_instance) { |
|
186 | 186 | $this->flush_widget_cache(); |
187 | 187 | |
188 | 188 | return $new_instance; |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return void |
195 | 195 | */ |
196 | - public function flush_widget_cache(){ |
|
197 | - wp_cache_delete( $this->self, 'widget' ); |
|
196 | + public function flush_widget_cache() { |
|
197 | + wp_cache_delete($this->self, 'widget'); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | - 'attributes' => array( |
|
78 | + 'attributes' => array( |
|
79 | 79 | 'placeholder' => give_format_decimal( '1.00' ), |
80 | 80 | 'value' => give_format_decimal( $price ), |
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
111 | 111 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | - 'attributes' => array( |
|
113 | + 'attributes' => array( |
|
114 | 114 | 'placeholder' => give_format_decimal( '1.00' ), |
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,327 +48,327 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => esc_html__('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
61 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => esc_html__('Donation Option', 'give'), |
|
61 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
67 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => esc_html__('Set Donation', 'give'), |
|
67 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
72 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => esc_html__('Set Donation', 'give'), |
|
72 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
80 | - 'value' => give_format_decimal( $price ), |
|
79 | + 'placeholder' => give_format_decimal('1.00'), |
|
80 | + 'value' => give_format_decimal($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
95 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
96 | 96 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => esc_html__( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => esc_html__('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => esc_html__('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | 113 | 'attributes' => array( |
114 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
114 | + 'placeholder' => give_format_decimal('1.00'), |
|
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
117 | 117 | 'before' => 'give_format_admin_multilevel_amount', |
118 | 118 | ), |
119 | 119 | array( |
120 | - 'name' => esc_html__( 'Text', 'give' ), |
|
121 | - 'id' => $prefix . 'text', |
|
120 | + 'name' => esc_html__('Text', 'give'), |
|
121 | + 'id' => $prefix.'text', |
|
122 | 122 | 'type' => 'text', |
123 | 123 | 'attributes' => array( |
124 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
124 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
125 | 125 | 'class' => 'give-multilevel-text-field', |
126 | 126 | ), |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Default', 'give' ), |
|
130 | - 'id' => $prefix . 'default', |
|
129 | + 'name' => esc_html__('Default', 'give'), |
|
130 | + 'id' => $prefix.'default', |
|
131 | 131 | 'type' => 'give_default_radio_inline' |
132 | 132 | ), |
133 | - ) ), |
|
133 | + )), |
|
134 | 134 | ), |
135 | 135 | //Display Style |
136 | 136 | array( |
137 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
138 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
139 | - 'id' => $prefix . 'display_style', |
|
137 | + 'name' => esc_html__('Display Style', 'give'), |
|
138 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
139 | + 'id' => $prefix.'display_style', |
|
140 | 140 | 'type' => 'radio_inline', |
141 | 141 | 'default' => 'buttons', |
142 | 142 | 'options' => array( |
143 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
144 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
145 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
143 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
144 | + 'radios' => esc_html__('Radios', 'give'), |
|
145 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
146 | 146 | ), |
147 | 147 | ), |
148 | 148 | //Custom Amount |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
151 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
152 | - 'id' => $prefix . 'custom_amount', |
|
150 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
151 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
152 | + 'id' => $prefix.'custom_amount', |
|
153 | 153 | 'type' => 'radio_inline', |
154 | 154 | 'default' => 'no', |
155 | 155 | 'options' => array( |
156 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
157 | - 'no' => esc_html__( 'No', 'give' ), |
|
156 | + 'yes' => esc_html__('Yes', 'give'), |
|
157 | + 'no' => esc_html__('No', 'give'), |
|
158 | 158 | ), |
159 | 159 | ), |
160 | 160 | array( |
161 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
162 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
163 | - 'id' => $prefix . 'custom_amount_minimum', |
|
161 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
162 | + 'description' => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
163 | + 'id' => $prefix.'custom_amount_minimum', |
|
164 | 164 | 'type' => 'text_small', |
165 | 165 | 'row_classes' => 'give-subfield', |
166 | 166 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
167 | 167 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
168 | 168 | 'attributes' => array( |
169 | 169 | 'placeholder' => give_format_decimal('1.00'), |
170 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
170 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
171 | 171 | 'class' => 'cmb-type-text-small give-money-field', |
172 | 172 | ) |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
176 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
177 | - 'id' => $prefix . 'custom_amount_text', |
|
175 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
176 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
177 | + 'id' => $prefix.'custom_amount_text', |
|
178 | 178 | 'type' => 'text', |
179 | 179 | 'row_classes' => 'give-subfield', |
180 | 180 | 'attributes' => array( |
181 | 181 | 'rows' => 3, |
182 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
182 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
183 | 183 | ), |
184 | 184 | ), |
185 | 185 | //Goals |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
188 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
189 | - 'id' => $prefix . 'goal_option', |
|
187 | + 'name' => esc_html__('Goal', 'give'), |
|
188 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
189 | + 'id' => $prefix.'goal_option', |
|
190 | 190 | 'type' => 'radio_inline', |
191 | 191 | 'default' => 'no', |
192 | 192 | 'options' => array( |
193 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
194 | - 'no' => esc_html__( 'No', 'give' ), |
|
193 | + 'yes' => esc_html__('Yes', 'give'), |
|
194 | + 'no' => esc_html__('No', 'give'), |
|
195 | 195 | ), |
196 | 196 | ), |
197 | 197 | array( |
198 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
199 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
200 | - 'id' => $prefix . 'set_goal', |
|
198 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
199 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
200 | + 'id' => $prefix.'set_goal', |
|
201 | 201 | 'type' => 'text_small', |
202 | 202 | 'row_classes' => 'give-subfield', |
203 | 203 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
204 | 204 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
207 | - 'value' => give_format_decimal( $goal ), |
|
206 | + 'placeholder' => give_format_decimal('0.00'), |
|
207 | + 'value' => give_format_decimal($goal), |
|
208 | 208 | 'class' => 'cmb-type-text-small give-money-field', |
209 | 209 | ), |
210 | 210 | ), |
211 | 211 | |
212 | 212 | array( |
213 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
214 | - 'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
215 | - 'id' => $prefix . 'goal_format', |
|
213 | + 'name' => esc_html__('Goal Format', 'give'), |
|
214 | + 'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
215 | + 'id' => $prefix.'goal_format', |
|
216 | 216 | 'type' => 'radio_inline', |
217 | 217 | 'default' => 'amount', |
218 | 218 | 'row_classes' => 'give-subfield', |
219 | 219 | 'options' => array( |
220 | - 'amount' => esc_html__( 'Amount ', 'give' ), |
|
221 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
220 | + 'amount' => esc_html__('Amount ', 'give'), |
|
221 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
222 | 222 | ), |
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
226 | - 'id' => $prefix . 'goal_color', |
|
225 | + 'name' => esc_html__('Goal Progress Bar Color', 'give'), |
|
226 | + 'id' => $prefix.'goal_color', |
|
227 | 227 | 'type' => 'colorpicker', |
228 | 228 | 'row_classes' => 'give-subfield', |
229 | 229 | 'default' => '#2bc253', |
230 | 230 | ), |
231 | 231 | |
232 | 232 | array( |
233 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
234 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
235 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
233 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
234 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
235 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
236 | 236 | 'type' => 'radio_inline', |
237 | 237 | 'row_classes' => 'give-subfield', |
238 | 238 | 'options' => array( |
239 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
240 | - 'no' => esc_html__( 'No', 'give' ), |
|
239 | + 'yes' => esc_html__('Yes', 'give'), |
|
240 | + 'no' => esc_html__('No', 'give'), |
|
241 | 241 | ), |
242 | 242 | 'default' => 'no', |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
246 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
247 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
245 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
246 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
247 | + 'id' => $prefix.'form_goal_achieved_message', |
|
248 | 248 | 'type' => 'textarea', |
249 | 249 | 'row_classes' => 'give-subfield', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
252 | 252 | ), |
253 | 253 | ) |
254 | 254 | ) |
255 | 255 | ) |
256 | - ) ); |
|
256 | + )); |
|
257 | 257 | |
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Content Field |
261 | 261 | */ |
262 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
262 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
263 | 263 | 'id' => 'form_content_options', |
264 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
265 | - 'object_types' => array( 'give_forms' ), |
|
264 | + 'title' => esc_html__('Form Content', 'give'), |
|
265 | + 'object_types' => array('give_forms'), |
|
266 | 266 | 'context' => 'normal', |
267 | 267 | 'priority' => 'high', //Show above Content WYSIWYG |
268 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
268 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
269 | 269 | //Donation Option |
270 | 270 | array( |
271 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
272 | - 'description' => esc_html__( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
273 | - 'id' => $prefix . 'content_option', |
|
271 | + 'name' => esc_html__('Display Content', 'give'), |
|
272 | + 'description' => esc_html__('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
273 | + 'id' => $prefix.'content_option', |
|
274 | 274 | 'type' => 'select', |
275 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
276 | - 'none' => esc_html__( 'No content', 'give' ), |
|
277 | - 'give_pre_form' => esc_html__( 'Yes, display content ABOVE the form fields', 'give' ), |
|
278 | - 'give_post_form' => esc_html__( 'Yes, display content BELOW the form fields', 'give' ), |
|
275 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
276 | + 'none' => esc_html__('No content', 'give'), |
|
277 | + 'give_pre_form' => esc_html__('Yes, display content ABOVE the form fields', 'give'), |
|
278 | + 'give_post_form' => esc_html__('Yes, display content BELOW the form fields', 'give'), |
|
279 | 279 | ) |
280 | 280 | ), |
281 | 281 | 'default' => 'none', |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => esc_html__( 'Content', 'give' ), |
|
285 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
286 | - 'id' => $prefix . 'form_content', |
|
284 | + 'name' => esc_html__('Content', 'give'), |
|
285 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
286 | + 'id' => $prefix.'form_content', |
|
287 | 287 | 'row_classes' => 'give-subfield', |
288 | 288 | 'type' => 'wysiwyg' |
289 | 289 | ), |
290 | 290 | ) |
291 | 291 | ) |
292 | - ) ); |
|
292 | + )); |
|
293 | 293 | |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Display Options |
297 | 297 | */ |
298 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
298 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
299 | 299 | 'id' => 'form_display_options', |
300 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
301 | - 'object_types' => array( 'give_forms' ), |
|
300 | + 'title' => esc_html__('Form Display Options', 'give'), |
|
301 | + 'object_types' => array('give_forms'), |
|
302 | 302 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
303 | 303 | 'priority' => 'high', //Show above Content WYSIWYG |
304 | 304 | 'show_names' => true, // Show field names on the left |
305 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
305 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
306 | 306 | array( |
307 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
308 | - 'desc' => esc_html__( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
309 | - 'id' => $prefix . 'payment_display', |
|
307 | + 'name' => esc_html__('Payment Fields', 'give'), |
|
308 | + 'desc' => esc_html__('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
309 | + 'id' => $prefix.'payment_display', |
|
310 | 310 | 'type' => 'select', |
311 | 311 | 'options' => array( |
312 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
313 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
314 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
312 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
313 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
314 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
315 | 315 | ), |
316 | 316 | 'default' => 'onpage', |
317 | 317 | ), |
318 | 318 | array( |
319 | - 'id' => $prefix . 'reveal_label', |
|
320 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
321 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
319 | + 'id' => $prefix.'reveal_label', |
|
320 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
321 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'), |
|
322 | 322 | 'type' => 'text_small', |
323 | 323 | 'row_classes' => 'give-subfield', |
324 | 324 | 'attributes' => array( |
325 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
325 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
326 | 326 | ), |
327 | 327 | ), |
328 | 328 | array( |
329 | - 'id' => $prefix . 'checkout_label', |
|
330 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
331 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
329 | + 'id' => $prefix.'checkout_label', |
|
330 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
331 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
332 | 332 | 'type' => 'text_small', |
333 | 333 | 'attributes' => array( |
334 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
334 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
335 | 335 | ), |
336 | 336 | ), |
337 | 337 | array( |
338 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
339 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
340 | - 'id' => $prefix . 'default_gateway', |
|
338 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
339 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
340 | + 'id' => $prefix.'default_gateway', |
|
341 | 341 | 'type' => 'default_gateway' |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
345 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
345 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'checkbox' |
348 | 348 | ), |
349 | 349 | array( |
350 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
351 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
352 | - 'id' => $prefix . 'show_register_form', |
|
350 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
351 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
352 | + 'id' => $prefix.'show_register_form', |
|
353 | 353 | 'type' => 'select', |
354 | 354 | 'options' => array( |
355 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
356 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
357 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
358 | - 'none' => esc_html__( 'None', 'give' ), |
|
355 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
356 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
357 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
358 | + 'none' => esc_html__('None', 'give'), |
|
359 | 359 | ), |
360 | 360 | 'default' => 'none', |
361 | 361 | ), |
362 | 362 | array( |
363 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
363 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
364 | 364 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
365 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
366 | - 'id' => $prefix . 'form_floating_labels', |
|
365 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
366 | + 'id' => $prefix.'form_floating_labels', |
|
367 | 367 | 'type' => 'select', |
368 | 368 | 'options' => array( |
369 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
370 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
371 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
369 | + '' => esc_html__('Use the global setting', 'give'), |
|
370 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
371 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
372 | 372 | ), |
373 | 373 | 'default' => 'none', |
374 | 374 | ) |
@@ -380,47 +380,47 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Terms & Conditions |
382 | 382 | */ |
383 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
383 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
384 | 384 | 'id' => 'form_terms_options', |
385 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
386 | - 'object_types' => array( 'give_forms' ), |
|
385 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
386 | + 'object_types' => array('give_forms'), |
|
387 | 387 | 'context' => 'normal', |
388 | 388 | 'priority' => 'high', //Show above Content WYSIWYG |
389 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
389 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
390 | 390 | //Donation Option |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
393 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
394 | - 'id' => $prefix . 'terms_option', |
|
392 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
393 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
394 | + 'id' => $prefix.'terms_option', |
|
395 | 395 | 'type' => 'select', |
396 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
397 | - 'none' => esc_html__( 'No', 'give' ), |
|
398 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
396 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
397 | + 'none' => esc_html__('No', 'give'), |
|
398 | + 'yes' => esc_html__('Yes', 'give'), |
|
399 | 399 | ) |
400 | 400 | ), |
401 | 401 | 'default' => 'none', |
402 | 402 | ), |
403 | 403 | array( |
404 | - 'id' => $prefix . 'agree_label', |
|
405 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
406 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
404 | + 'id' => $prefix.'agree_label', |
|
405 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
406 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
407 | 407 | 'type' => 'text', |
408 | 408 | 'row_classes' => 'give-subfield', |
409 | 409 | 'size' => 'regular', |
410 | 410 | 'attributes' => array( |
411 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
411 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
412 | 412 | ), |
413 | 413 | ), |
414 | 414 | array( |
415 | - 'id' => $prefix . 'agree_text', |
|
415 | + 'id' => $prefix.'agree_text', |
|
416 | 416 | 'row_classes' => 'give-subfield', |
417 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
418 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
417 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
418 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
419 | 419 | 'type' => 'wysiwyg' |
420 | 420 | ), |
421 | 421 | ) |
422 | 422 | ) |
423 | - ) ); |
|
423 | + )); |
|
424 | 424 | |
425 | 425 | return $meta_boxes; |
426 | 426 | |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | |
435 | 435 | <div class="table-container"> |
436 | 436 | <div class="table-row"> |
437 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
438 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
439 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
437 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
438 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
439 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
440 | 440 | <?php |
441 | 441 | /** |
442 | 442 | * Fires in repeatable donation levels table head. |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @since 1.0 |
450 | 450 | */ |
451 | - do_action( 'give_donation_levels_table_head' ); |
|
451 | + do_action('give_donation_levels_table_head'); |
|
452 | 452 | ?> |
453 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
453 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
454 | 454 | |
455 | 455 | </div> |
456 | 456 | </div> |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | <?php |
459 | 459 | } |
460 | 460 | |
461 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
461 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
462 | 462 | |
463 | 463 | |
464 | 464 | /** |
@@ -475,25 +475,25 @@ discard block |
||
475 | 475 | * @param $object_type |
476 | 476 | * @param $field_type_object |
477 | 477 | */ |
478 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
478 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
479 | 479 | |
480 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
480 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
481 | 481 | |
482 | 482 | $field_options_array = array( |
483 | 483 | 'class' => 'give-hidden give-level-id-input', |
484 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
485 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
484 | + 'name' => $field_type_object->_name('[level_id]'), |
|
485 | + 'id' => $field_type_object->_id('_level_id'), |
|
486 | 486 | 'value' => $escaped_value, |
487 | 487 | 'type' => 'number', |
488 | 488 | 'desc' => '', |
489 | 489 | ); |
490 | 490 | |
491 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
492 | - echo $field_type_object->input( $field_options_array ); |
|
491 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
492 | + echo $field_type_object->input($field_options_array); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
496 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
497 | 497 | |
498 | 498 | |
499 | 499 | /** |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | * @param $object_type |
506 | 506 | * @param $field_type_object |
507 | 507 | */ |
508 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
509 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
510 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
508 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
509 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
510 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
511 | 511 | |
512 | 512 | } |
513 | 513 | |
514 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
514 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
515 | 515 | |
516 | 516 | |
517 | 517 | /** |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | */ |
522 | 522 | function give_add_shortcode_to_publish_metabox() { |
523 | 523 | |
524 | - if ( 'give_forms' !== get_post_type() ) { |
|
524 | + if ('give_forms' !== get_post_type()) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | |
528 | 528 | global $post; |
529 | 529 | |
530 | 530 | //Only enqueue scripts for CPT on post type screen |
531 | - if ( 'give_forms' === $post->post_type ) { |
|
531 | + if ('give_forms' === $post->post_type) { |
|
532 | 532 | //Shortcode column with select all input |
533 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
534 | - echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
533 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
534 | + echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
540 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,56 +40,56 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | 60 | /* translators: %s: form settings url */ |
61 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
62 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
61 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
62 | + echo wpautop(stripslashes($offline_instructions)); |
|
63 | 63 | ?> |
64 | 64 | </fieldset> |
65 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
65 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
66 | 66 | <?php |
67 | 67 | echo ob_get_clean(); |
68 | 68 | } |
69 | 69 | |
70 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
70 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Give Offline Billing Field |
74 | 74 | * |
75 | 75 | * @param $form_id |
76 | 76 | */ |
77 | -function give_offline_billing_fields( $form_id ) { |
|
77 | +function give_offline_billing_fields($form_id) { |
|
78 | 78 | //Enable Default CC fields (billing info) |
79 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
80 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
79 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
80 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
81 | 81 | |
82 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
82 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
83 | 83 | |
84 | 84 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
85 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
86 | - give_default_cc_address_fields( $form_id ); |
|
87 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | - give_default_cc_address_fields( $form_id ); |
|
85 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
86 | + give_default_cc_address_fields($form_id); |
|
87 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | + give_default_cc_address_fields($form_id); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
92 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Process the payment |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return void |
102 | 102 | */ |
103 | -function give_offline_process_payment( $purchase_data ) { |
|
103 | +function give_offline_process_payment($purchase_data) { |
|
104 | 104 | |
105 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
105 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
106 | 106 | |
107 | 107 | // setup the payment details |
108 | 108 | $payment_data = array( |
109 | 109 | 'price' => $purchase_data['price'], |
110 | 110 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
111 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
112 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
111 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
112 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
113 | 113 | 'date' => $purchase_data['date'], |
114 | 114 | 'user_email' => $purchase_data['user_email'], |
115 | 115 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // record the pending payment |
124 | - $payment = give_insert_payment( $payment_data ); |
|
124 | + $payment = give_insert_payment($payment_data); |
|
125 | 125 | |
126 | - if ( $payment ) { |
|
127 | - give_offline_send_admin_notice( $payment ); |
|
128 | - give_offline_send_donor_instructions( $payment ); |
|
126 | + if ($payment) { |
|
127 | + give_offline_send_admin_notice($payment); |
|
128 | + give_offline_send_donor_instructions($payment); |
|
129 | 129 | give_send_to_success_page(); |
130 | 130 | } else { |
131 | 131 | // if errors are present, send the user back to the donation form so they can be corrected |
132 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
132 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
137 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,47 +147,47 @@ discard block |
||
147 | 147 | * @since 1.0 |
148 | 148 | * @return void |
149 | 149 | */ |
150 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
150 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
151 | 151 | |
152 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
153 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
152 | + $payment_data = give_get_payment_meta($payment_id); |
|
153 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
154 | 154 | |
155 | 155 | //Customize email content depending on whether the single form has been customized |
156 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
156 | + $email_content = give_get_option('global_offline_donation_email'); |
|
157 | 157 | |
158 | - if ( $post_offline_customization_option === 'yes' ) { |
|
159 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
158 | + if ($post_offline_customization_option === 'yes') { |
|
159 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
160 | 160 | } |
161 | 161 | |
162 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
163 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
162 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
163 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
164 | 164 | |
165 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
166 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
165 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
166 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
167 | 167 | |
168 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
168 | + $to_email = give_get_payment_user_email($payment_id); |
|
169 | 169 | |
170 | - $subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
171 | - if ( $post_offline_customization_option === 'yes' ) { |
|
172 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
170 | + $subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give')); |
|
171 | + if ($post_offline_customization_option === 'yes') { |
|
172 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
173 | 173 | } |
174 | 174 | |
175 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
176 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
175 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
176 | + $subject = give_do_email_tags($subject, $payment_id); |
|
177 | 177 | |
178 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
179 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
178 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
179 | + $message = give_do_email_tags($email_content, $payment_id); |
|
180 | 180 | |
181 | 181 | $emails = Give()->emails; |
182 | 182 | |
183 | - $emails->__set( 'from_name', $from_name ); |
|
184 | - $emails->__set( 'from_email', $from_email ); |
|
185 | - $emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
183 | + $emails->__set('from_name', $from_name); |
|
184 | + $emails->__set('from_email', $from_email); |
|
185 | + $emails->__set('heading', esc_html__('Offline Donation Instructions', 'give')); |
|
186 | 186 | |
187 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
188 | - $emails->__set( 'headers', $headers ); |
|
187 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
188 | + $emails->__set('headers', $headers); |
|
189 | 189 | |
190 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
190 | + $emails->send($to_email, $subject, $message, $attachments); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -204,52 +204,52 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | * |
206 | 206 | */ |
207 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
207 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
208 | 208 | |
209 | 209 | /* Send an email notification to the admin */ |
210 | 210 | $admin_email = give_get_admin_notice_emails(); |
211 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
211 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
212 | 212 | |
213 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
214 | - $user_data = get_userdata( $user_info['id'] ); |
|
213 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
214 | + $user_data = get_userdata($user_info['id']); |
|
215 | 215 | $name = $user_data->display_name; |
216 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
217 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
216 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
217 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
218 | 218 | } else { |
219 | 219 | $name = $user_info['email']; |
220 | 220 | } |
221 | 221 | |
222 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
222 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
223 | 223 | |
224 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
224 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
225 | 225 | |
226 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
227 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
228 | - $admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
226 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
227 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
228 | + $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
229 | 229 | |
230 | 230 | |
231 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . '{fullname}' . "\n"; |
|
232 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . '{price}' . "\n\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.'{fullname}'."\n"; |
|
232 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.'{price}'."\n\n"; |
|
233 | 233 | |
234 | 234 | $admin_message .= sprintf( |
235 | 235 | '<a href="%1$s">%2$s</a>', |
236 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
237 | - esc_html__( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
238 | - ) . "\n\n"; |
|
236 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
237 | + esc_html__('Click Here to View and/or Update Donation Details', 'give') |
|
238 | + )."\n\n"; |
|
239 | 239 | |
240 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
241 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
240 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
241 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
242 | 242 | |
243 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
244 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
243 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
244 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
245 | 245 | |
246 | 246 | //Send Email |
247 | 247 | $emails = Give()->emails; |
248 | - if ( ! empty( $admin_headers ) ) { |
|
249 | - $emails->__set( 'headers', $admin_headers ); |
|
248 | + if ( ! empty($admin_headers)) { |
|
249 | + $emails->__set('headers', $admin_headers); |
|
250 | 250 | } |
251 | 251 | |
252 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
252 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | * @since 1.0 |
261 | 261 | * @return array |
262 | 262 | */ |
263 | -function give_offline_add_settings( $settings ) { |
|
263 | +function give_offline_add_settings($settings) { |
|
264 | 264 | |
265 | 265 | //Vars |
266 | 266 | $prefix = '_give_'; |
267 | 267 | |
268 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
268 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
269 | 269 | |
270 | 270 | //this gateway isn't active |
271 | - if ( ! $is_gateway_active ) { |
|
271 | + if ( ! $is_gateway_active) { |
|
272 | 272 | //return settings and bounce |
273 | 273 | return $settings; |
274 | 274 | } |
@@ -277,27 +277,27 @@ discard block |
||
277 | 277 | $check_settings = array( |
278 | 278 | |
279 | 279 | array( |
280 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
281 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
282 | - 'id' => $prefix . 'customize_offline_donations', |
|
280 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
281 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
282 | + 'id' => $prefix.'customize_offline_donations', |
|
283 | 283 | 'type' => 'radio_inline', |
284 | 284 | 'default' => 'no', |
285 | 285 | 'options' => array( |
286 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
287 | - 'no' => esc_attr__( 'No', 'give' ), |
|
286 | + 'yes' => esc_attr__('Yes', 'give'), |
|
287 | + 'no' => esc_attr__('No', 'give'), |
|
288 | 288 | ), |
289 | 289 | ), |
290 | 290 | array( |
291 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
292 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
293 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
291 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
292 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
293 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
294 | 294 | 'row_classes' => 'give-subfield', |
295 | 295 | 'type' => 'checkbox' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'id' => $prefix . 'offline_checkout_notes', |
|
299 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
300 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
298 | + 'id' => $prefix.'offline_checkout_notes', |
|
299 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
300 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
301 | 301 | 'default' => give_get_default_offline_donation_content(), |
302 | 302 | 'type' => 'wysiwyg', |
303 | 303 | 'row_classes' => 'give-subfield', |
@@ -306,17 +306,17 @@ discard block |
||
306 | 306 | ) |
307 | 307 | ), |
308 | 308 | array( |
309 | - 'id' => $prefix . 'offline_donation_subject', |
|
310 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
311 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
312 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
309 | + 'id' => $prefix.'offline_donation_subject', |
|
310 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
311 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
312 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
313 | 313 | 'row_classes' => 'give-subfield', |
314 | 314 | 'type' => 'text' |
315 | 315 | ), |
316 | 316 | array( |
317 | - 'id' => $prefix . 'offline_donation_email', |
|
318 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
319 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
317 | + 'id' => $prefix.'offline_donation_email', |
|
318 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
319 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
320 | 320 | 'default' => give_get_default_offline_donation_email_content(), |
321 | 321 | 'type' => 'wysiwyg', |
322 | 322 | 'row_classes' => 'give-subfield', |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | |
329 | - return array_merge( $settings, $check_settings ); |
|
329 | + return array_merge($settings, $check_settings); |
|
330 | 330 | } |
331 | 331 | |
332 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
332 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -341,32 +341,32 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function give_get_default_offline_donation_content() { |
343 | 343 | |
344 | - $sitename = get_bloginfo( 'sitename' ); |
|
344 | + $sitename = get_bloginfo('sitename'); |
|
345 | 345 | |
346 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
346 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
347 | 347 | $default_text .= '<ol>'; |
348 | 348 | $default_text .= '<li>'; |
349 | 349 | $default_text .= sprintf( |
350 | 350 | /* translators: %s: site name */ |
351 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
351 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
352 | 352 | $sitename |
353 | 353 | ); |
354 | 354 | $default_text .= '</li>'; |
355 | 355 | $default_text .= '<li>'; |
356 | 356 | $default_text .= sprintf( |
357 | 357 | /* translators: %s: site name */ |
358 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
358 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
359 | 359 | $sitename |
360 | 360 | ); |
361 | 361 | $default_text .= '</li>'; |
362 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
362 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
363 | 363 | $default_text .= '</ol>'; |
364 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
364 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
365 | 365 | $default_text .= ' <em>123 G Street </em><br>'; |
366 | 366 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
367 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
367 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
368 | 368 | |
369 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
369 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_email_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
383 | - $default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>'; |
|
384 | - $default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | + $default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>'; |
|
384 | + $default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
389 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>123 G Street </em><br>'; |
404 | 404 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
405 | - $default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
406 | - $default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>'; |
|
407 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
405 | + $default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
406 | + $default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>'; |
|
407 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
408 | 408 | |
409 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
409 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
410 | 410 | |
411 | 411 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id; |
|
71 | + return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id; |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway; |
|
73 | + return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Payment ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Payment ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | 'paged' => $paged |
181 | 181 | ); |
182 | 182 | |
183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
184 | 184 | |
185 | - if ( $logs ) { |
|
186 | - foreach ( $logs as $log ) { |
|
185 | + if ($logs) { |
|
186 | + foreach ($logs as $log) { |
|
187 | 187 | |
188 | 188 | $logs_data[] = array( |
189 | 189 | 'ID' => $log->ID, |
190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
191 | 191 | 'payment_id' => $log->post_parent, |
192 | 192 | 'error' => 'error', |
193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
194 | 194 | 'date' => $log->post_date |
195 | 195 | ); |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $which |
214 | 214 | */ |
215 | - protected function display_tablenav( $which ) { |
|
216 | - if ( 'top' === $which ) { |
|
217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
215 | + protected function display_tablenav($which) { |
|
216 | + if ('top' === $which) { |
|
217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
221 | 221 | |
222 | 222 | <div class="alignleft actions bulkactions"> |
223 | - <?php $this->bulk_actions( $which ); ?> |
|
223 | + <?php $this->bulk_actions($which); ?> |
|
224 | 224 | </div> |
225 | 225 | <?php |
226 | - $this->extra_tablenav( $which ); |
|
227 | - $this->pagination( $which ); |
|
226 | + $this->extra_tablenav($which); |
|
227 | + $this->pagination($which); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | $columns = $this->get_columns(); |
252 | 252 | $hidden = array(); // No hidden columns |
253 | 253 | $sortable = $this->get_sortable_columns(); |
254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
255 | 255 | $this->items = $this->get_logs(); |
256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
257 | 257 | |
258 | - $this->set_pagination_args( array( |
|
258 | + $this->set_pagination_args(array( |
|
259 | 259 | 'total_items' => $total_items, |
260 | 260 | 'per_page' => $this->per_page, |
261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | } |
@@ -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_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
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 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | Give()->roles->remove_caps(); |
73 | 73 | |
74 | 74 | // Delete the Roles. |
75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
76 | - foreach ( $give_roles as $role ) { |
|
77 | - remove_role( $role ); |
|
75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
76 | + foreach ($give_roles as $role) { |
|
77 | + remove_role($role); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Remove all database tables. |
81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
84 | 84 | |
85 | 85 | // Cleanup Cron Events. |
86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
89 | 89 | |
90 | 90 | // Get all options. |
91 | 91 | $give_option_names = $wpdb->get_results( |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | ARRAY_A |
97 | 97 | ); |
98 | 98 | |
99 | - if ( ! empty( $give_option_names ) ) { |
|
99 | + if ( ! empty($give_option_names)) { |
|
100 | 100 | // Convert option name to transient or option name. |
101 | 101 | $new_give_option_names = array(); |
102 | 102 | |
103 | - foreach ( $give_option_names as $option ) { |
|
104 | - $new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) ) |
|
105 | - ? str_replace( '_transient_', '', $option['option_name'] ) |
|
103 | + foreach ($give_option_names as $option) { |
|
104 | + $new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_')) |
|
105 | + ? str_replace('_transient_', '', $option['option_name']) |
|
106 | 106 | : $option['option_name']; |
107 | 107 | } |
108 | 108 | |
109 | 109 | $give_option_names = $new_give_option_names; |
110 | 110 | |
111 | 111 | // Delete all the Plugin Options. |
112 | - foreach ( $give_option_names as $option ) { |
|
113 | - if ( false !== strpos( $option, '_transient_' ) ) { |
|
114 | - delete_transient( $option ); |
|
112 | + foreach ($give_option_names as $option) { |
|
113 | + if (false !== strpos($option, '_transient_')) { |
|
114 | + delete_transient($option); |
|
115 | 115 | } else { |
116 | - delete_option( $option ); |
|
116 | + delete_option($option); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |