@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | - if ( isset( $_GET['give_action'] ) ) { |
|
28 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
27 | + if (isset($_GET['give_action'])) { |
|
28 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -add_action( 'init', 'give_get_actions' ); |
|
32 | +add_action('init', 'give_get_actions'); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function give_post_actions() { |
44 | - if ( isset( $_POST['give_action'] ) ) { |
|
45 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
44 | + if (isset($_POST['give_action'])) { |
|
45 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -add_action( 'init', 'give_post_actions' ); |
|
49 | +add_action('init', 'give_post_actions'); |
@@ -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 ) { |
@@ -267,10 +267,10 @@ |
||
267 | 267 | 'donation' => esc_html__( 'Donation', 'give' ), |
268 | 268 | 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
269 | 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 | - ); |
|
270 | + 'date' => esc_html__( 'Date', 'give' ), |
|
271 | + 'amount' => esc_html__( 'Amount', 'give' ), |
|
272 | + 'details' => esc_html__( 'Details', 'give' ), |
|
273 | + ); |
|
274 | 274 | |
275 | 275 | return apply_filters( 'give_payments_table_columns', $columns ); |
276 | 276 | } |
@@ -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,65 +315,65 @@ 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_transaction_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_transaction_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 | $value = sprintf( |
326 | 326 | /* translators: 1: Payment link 2: Donor link */ |
327 | - esc_html__( '%1$s by %2$s', 'give' ), |
|
327 | + esc_html__('%1$s by %2$s', 'give'), |
|
328 | 328 | sprintf( |
329 | 329 | '<a href="%1$s">#%2$s</a>', |
330 | - get_permalink( $payment->ID ), |
|
330 | + get_permalink($payment->ID), |
|
331 | 331 | $payment->ID |
332 | 332 | ), |
333 | 333 | sprintf( |
334 | 334 | '%1$s<br>%2$s', |
335 | - $this->get_donor( $payment ), |
|
336 | - $this->get_donor_email( $payment ) |
|
335 | + $this->get_donor($payment), |
|
336 | + $this->get_donor_email($payment) |
|
337 | 337 | ) |
338 | 338 | ); |
339 | 339 | break; |
340 | 340 | |
341 | 341 | case 'amount' : |
342 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
343 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
342 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
343 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
344 | 344 | break; |
345 | 345 | |
346 | 346 | case 'donation_form' : |
347 | 347 | |
348 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
349 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
348 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
349 | + $level = give_get_payment_form_title($payment->meta, true); |
|
350 | 350 | |
351 | - if ( ! empty( $level ) ) { |
|
351 | + if ( ! empty($level)) { |
|
352 | 352 | $value .= $level; |
353 | 353 | } |
354 | 354 | |
355 | 355 | break; |
356 | 356 | |
357 | 357 | case 'date' : |
358 | - $date = strtotime( $payment->date ); |
|
359 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
358 | + $date = strtotime($payment->date); |
|
359 | + $value = date_i18n(get_option('date_format'), $date); |
|
360 | 360 | break; |
361 | 361 | |
362 | 362 | case 'status' : |
363 | - $value = $this->get_payment_status( $payment ); |
|
363 | + $value = $this->get_payment_status($payment); |
|
364 | 364 | break; |
365 | 365 | |
366 | 366 | case 'details' : |
367 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_transaction_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>'; |
|
367 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_transaction_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>'; |
|
368 | 368 | break; |
369 | 369 | |
370 | 370 | default: |
371 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
371 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
372 | 372 | break; |
373 | 373 | |
374 | 374 | } |
375 | 375 | |
376 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
376 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @return string Data shown in the Email column |
388 | 388 | */ |
389 | - public function get_donor_email( $payment ) { |
|
389 | + public function get_donor_email($payment) { |
|
390 | 390 | |
391 | - $email = give_get_payment_user_email( $payment->ID ); |
|
391 | + $email = give_get_payment_user_email($payment->ID); |
|
392 | 392 | |
393 | - if ( empty( $email ) ) { |
|
394 | - $email = esc_html__( '(unknown)', 'give' ); |
|
393 | + if (empty($email)) { |
|
394 | + $email = esc_html__('(unknown)', 'give'); |
|
395 | 395 | } |
396 | 396 | |
397 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
397 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
398 | 398 | |
399 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
399 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -406,31 +406,31 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return mixed|void |
408 | 408 | */ |
409 | - function get_row_actions( $payment ) { |
|
409 | + function get_row_actions($payment) { |
|
410 | 410 | |
411 | 411 | $row_actions = array(); |
412 | - $email = give_get_payment_user_email( $payment->ID ); |
|
412 | + $email = give_get_payment_user_email($payment->ID); |
|
413 | 413 | |
414 | 414 | // Add search term string back to base URL |
415 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
416 | - if ( ! empty( $search_terms ) ) { |
|
417 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
415 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
416 | + if ( ! empty($search_terms)) { |
|
417 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
418 | 418 | } |
419 | 419 | |
420 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
421 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
420 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
421 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
422 | 422 | 'give-action' => 'email_links', |
423 | 423 | 'purchase_id' => $payment->ID |
424 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
424 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
425 | 425 | |
426 | 426 | } |
427 | 427 | |
428 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
428 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
429 | 429 | 'give-action' => 'delete_payment', |
430 | 430 | 'purchase_id' => $payment->ID |
431 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
431 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
432 | 432 | |
433 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
433 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -444,10 +444,10 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @return string Data shown in the Email column |
446 | 446 | */ |
447 | - function get_payment_status( $payment ) { |
|
448 | - $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>'; |
|
449 | - if ( $payment->mode == 'test' ) { |
|
450 | - $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>'; |
|
447 | + function get_payment_status($payment) { |
|
448 | + $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>'; |
|
449 | + if ($payment->mode == 'test') { |
|
450 | + $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>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | return $value; |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * |
464 | 464 | * @return string Displays a checkbox |
465 | 465 | */ |
466 | - public function column_cb( $payment ) { |
|
466 | + public function column_cb($payment) { |
|
467 | 467 | return sprintf( |
468 | 468 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
469 | 469 | 'payment', |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return string Displays a checkbox |
483 | 483 | */ |
484 | - public function get_payment_id( $payment ) { |
|
485 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
484 | + public function get_payment_id($payment) { |
|
485 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -495,19 +495,19 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return string Data shown in the User column |
497 | 497 | */ |
498 | - public function get_donor( $payment ) { |
|
498 | + public function get_donor($payment) { |
|
499 | 499 | |
500 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
500 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
501 | 501 | |
502 | - if ( ! empty( $customer_id ) ) { |
|
503 | - $customer = new Give_Customer( $customer_id ); |
|
504 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
502 | + if ( ! empty($customer_id)) { |
|
503 | + $customer = new Give_Customer($customer_id); |
|
504 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
505 | 505 | } else { |
506 | - $email = give_get_payment_user_email( $payment->ID ); |
|
507 | - $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>'; |
|
506 | + $email = give_get_payment_user_email($payment->ID); |
|
507 | + $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>'; |
|
508 | 508 | } |
509 | 509 | |
510 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
510 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -519,18 +519,18 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public function get_bulk_actions() { |
521 | 521 | $actions = array( |
522 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
523 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
524 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
525 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
526 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
527 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
528 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
529 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
530 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
522 | + 'delete' => esc_html__('Delete', 'give'), |
|
523 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
524 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
525 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
526 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
527 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
528 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
529 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
530 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
531 | 531 | ); |
532 | 532 | |
533 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
533 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
@@ -541,59 +541,59 @@ discard block |
||
541 | 541 | * @return void |
542 | 542 | */ |
543 | 543 | public function process_bulk_action() { |
544 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
544 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
545 | 545 | $action = $this->current_action(); |
546 | 546 | |
547 | - if ( ! is_array( $ids ) ) { |
|
548 | - $ids = array( $ids ); |
|
547 | + if ( ! is_array($ids)) { |
|
548 | + $ids = array($ids); |
|
549 | 549 | } |
550 | 550 | |
551 | - if ( empty( $action ) ) { |
|
551 | + if (empty($action)) { |
|
552 | 552 | return; |
553 | 553 | } |
554 | 554 | |
555 | - foreach ( $ids as $id ) { |
|
555 | + foreach ($ids as $id) { |
|
556 | 556 | |
557 | 557 | // Detect when a bulk action is being triggered... |
558 | - switch ( $this->current_action() ) { |
|
558 | + switch ($this->current_action()) { |
|
559 | 559 | |
560 | 560 | case'delete': |
561 | - give_delete_purchase( $id ); |
|
561 | + give_delete_purchase($id); |
|
562 | 562 | break; |
563 | 563 | |
564 | 564 | case 'set-status-publish': |
565 | - give_update_payment_status( $id, 'publish' ); |
|
565 | + give_update_payment_status($id, 'publish'); |
|
566 | 566 | break; |
567 | 567 | |
568 | 568 | case 'set-status-pending': |
569 | - give_update_payment_status( $id, 'pending' ); |
|
569 | + give_update_payment_status($id, 'pending'); |
|
570 | 570 | break; |
571 | 571 | |
572 | 572 | case 'set-status-refunded': |
573 | - give_update_payment_status( $id, 'refunded' ); |
|
573 | + give_update_payment_status($id, 'refunded'); |
|
574 | 574 | break; |
575 | 575 | case 'set-status-revoked': |
576 | - give_update_payment_status( $id, 'revoked' ); |
|
576 | + give_update_payment_status($id, 'revoked'); |
|
577 | 577 | break; |
578 | 578 | |
579 | 579 | case 'set-status-failed': |
580 | - give_update_payment_status( $id, 'failed' ); |
|
580 | + give_update_payment_status($id, 'failed'); |
|
581 | 581 | break; |
582 | 582 | |
583 | 583 | case 'set-status-cancelled': |
584 | - give_update_payment_status( $id, 'cancelled' ); |
|
584 | + give_update_payment_status($id, 'cancelled'); |
|
585 | 585 | break; |
586 | 586 | |
587 | 587 | case 'set-status-abandoned': |
588 | - give_update_payment_status( $id, 'abandoned' ); |
|
588 | + give_update_payment_status($id, 'abandoned'); |
|
589 | 589 | break; |
590 | 590 | |
591 | 591 | case 'set-status-preapproval': |
592 | - give_update_payment_status( $id, 'preapproval' ); |
|
592 | + give_update_payment_status($id, 'preapproval'); |
|
593 | 593 | break; |
594 | 594 | |
595 | 595 | case 'resend-receipt': |
596 | - give_email_donation_receipt( $id, false ); |
|
596 | + give_email_donation_receipt($id, false); |
|
597 | 597 | break; |
598 | 598 | } |
599 | 599 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @param int $id The ID of the payment. |
606 | 606 | * @param string $current_action The action that is being triggered. |
607 | 607 | */ |
608 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
608 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | } |
@@ -621,27 +621,27 @@ discard block |
||
621 | 621 | |
622 | 622 | $args = array(); |
623 | 623 | |
624 | - if ( isset( $_GET['user'] ) ) { |
|
625 | - $args['user'] = urldecode( $_GET['user'] ); |
|
626 | - } elseif ( isset( $_GET['s'] ) ) { |
|
627 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
628 | - if ( $is_user ) { |
|
629 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
630 | - unset( $args['s'] ); |
|
624 | + if (isset($_GET['user'])) { |
|
625 | + $args['user'] = urldecode($_GET['user']); |
|
626 | + } elseif (isset($_GET['s'])) { |
|
627 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
628 | + if ($is_user) { |
|
629 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
630 | + unset($args['s']); |
|
631 | 631 | } else { |
632 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
632 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | |
636 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
637 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
636 | + if ( ! empty($_GET['start-date'])) { |
|
637 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
638 | 638 | } |
639 | 639 | |
640 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
641 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
640 | + if ( ! empty($_GET['end-date'])) { |
|
641 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
642 | 642 | } |
643 | 643 | |
644 | - $payment_count = give_count_payments( $args ); |
|
644 | + $payment_count = give_count_payments($args); |
|
645 | 645 | $this->complete_count = $payment_count->publish; |
646 | 646 | $this->pending_count = $payment_count->pending; |
647 | 647 | $this->refunded_count = $payment_count->refunded; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $this->cancelled_count = $payment_count->cancelled; |
651 | 651 | $this->abandoned_count = $payment_count->abandoned; |
652 | 652 | |
653 | - foreach ( $payment_count as $count ) { |
|
653 | + foreach ($payment_count as $count) { |
|
654 | 654 | $this->total_count += $count; |
655 | 655 | } |
656 | 656 | } |
@@ -665,26 +665,26 @@ discard block |
||
665 | 665 | public function payments_data() { |
666 | 666 | |
667 | 667 | $per_page = $this->per_page; |
668 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
669 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
670 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
671 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
672 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
673 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
674 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
675 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
676 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
677 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
678 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
679 | - |
|
680 | - if ( ! empty( $search ) ) { |
|
668 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
669 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
670 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
671 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
672 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
673 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
674 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
675 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
676 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
677 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
678 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
679 | + |
|
680 | + if ( ! empty($search)) { |
|
681 | 681 | $status = 'any'; // Force all payment statuses when searching |
682 | 682 | } |
683 | 683 | |
684 | 684 | $args = array( |
685 | 685 | 'output' => 'payments', |
686 | 686 | 'number' => $per_page, |
687 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
687 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
688 | 688 | 'orderby' => $orderby, |
689 | 689 | 'order' => $order, |
690 | 690 | 'user' => $user, |
@@ -698,14 +698,14 @@ discard block |
||
698 | 698 | 'end_date' => $end_date, |
699 | 699 | ); |
700 | 700 | |
701 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
701 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
702 | 702 | |
703 | 703 | $args['search_in_notes'] = true; |
704 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
704 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
705 | 705 | |
706 | 706 | } |
707 | 707 | |
708 | - $p_query = new Give_Payments_Query( $args ); |
|
708 | + $p_query = new Give_Payments_Query($args); |
|
709 | 709 | |
710 | 710 | return $p_query->get_payments(); |
711 | 711 | |
@@ -725,17 +725,17 @@ discard block |
||
725 | 725 | */ |
726 | 726 | public function prepare_items() { |
727 | 727 | |
728 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
728 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
729 | 729 | |
730 | 730 | $columns = $this->get_columns(); |
731 | 731 | $hidden = array(); // No hidden columns |
732 | 732 | $sortable = $this->get_sortable_columns(); |
733 | 733 | $data = $this->payments_data(); |
734 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
734 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
735 | 735 | |
736 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
736 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
737 | 737 | |
738 | - switch ( $status ) { |
|
738 | + switch ($status) { |
|
739 | 739 | case 'publish': |
740 | 740 | $total_items = $this->complete_count; |
741 | 741 | break; |
@@ -762,19 +762,19 @@ discard block |
||
762 | 762 | break; |
763 | 763 | default: |
764 | 764 | // Retrieve the count of the non-default-Give status |
765 | - $count = wp_count_posts( 'give_payment' ); |
|
765 | + $count = wp_count_posts('give_payment'); |
|
766 | 766 | $total_items = $count->{$status}; |
767 | 767 | break; |
768 | 768 | } |
769 | 769 | |
770 | 770 | $this->items = $data; |
771 | 771 | |
772 | - $this->set_pagination_args( array( |
|
772 | + $this->set_pagination_args(array( |
|
773 | 773 | 'total_items' => $total_items, |
774 | 774 | // WE have to calculate the total number of items |
775 | 775 | 'per_page' => $this->per_page, |
776 | 776 | // WE have to determine how many items to show on a page |
777 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
777 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
778 | 778 | // WE have to calculate the total number of pages |
779 | 779 | ) |
780 | 780 | ); |
@@ -713,7 +713,7 @@ |
||
713 | 713 | * @param bool $colon Check if add colon between heading and message. |
714 | 714 | * @param string $color Heading color. |
715 | 715 | * |
716 | - * @return mixed |
|
716 | + * @return string |
|
717 | 717 | */ |
718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
719 | 719 | // Add colon. |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @subcommand donors |
327 | 327 | */ |
328 | 328 | public function donors( $args, $assoc_args ) { |
329 | - global $wp_query; |
|
329 | + global $wp_query; |
|
330 | 330 | $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
331 | 331 | $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
332 | 332 | $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * @subcommand donations |
493 | 493 | */ |
494 | 494 | public function donations( $args, $assoc_args ) { |
495 | - global $wp_query; |
|
495 | + global $wp_query; |
|
496 | 496 | $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
497 | 497 | |
498 | 498 | // Cache previous number query var. |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | * @return mixed |
717 | 717 | */ |
718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
719 | - // Add colon. |
|
720 | - if ( $colon ) { |
|
721 | - $heading = $heading . ': '; |
|
719 | + // Add colon. |
|
720 | + if ( $colon ) { |
|
721 | + $heading = $heading . ': '; |
|
722 | 722 | } |
723 | 723 | return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
724 | 724 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
10 | +if ( ! defined('ABSPATH')) { exit; } |
|
11 | 11 | |
12 | 12 | // Add give command. |
13 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
13 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -66,54 +66,54 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @subcommand details |
68 | 68 | */ |
69 | - public function details( $args, $assoc_args ) { |
|
69 | + public function details($args, $assoc_args) { |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Plugin Information |
73 | 73 | */ |
74 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
74 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * General Information. |
78 | 78 | */ |
79 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
79 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
80 | 80 | |
81 | - $success_page = give_get_option( 'success_page' ); |
|
82 | - $failure_page = give_get_option( 'failure_page' ); |
|
83 | - $history_page = give_get_option( 'history_page' ); |
|
81 | + $success_page = give_get_option('success_page'); |
|
82 | + $failure_page = give_get_option('failure_page'); |
|
83 | + $history_page = give_get_option('history_page'); |
|
84 | 84 | |
85 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
86 | - WP_CLI::log( $this->color_message( __( 'Failed Transaction Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
87 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
88 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
85 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
86 | + WP_CLI::log($this->color_message(__('Failed Transaction Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
87 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
88 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Currency Information. |
92 | 92 | */ |
93 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
93 | + $default_gateway = give_get_option('default_gateway'); |
|
94 | 94 | |
95 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
95 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
96 | 96 | |
97 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
98 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
99 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
100 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
101 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
102 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
103 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
97 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
98 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
99 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
100 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
101 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
102 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
103 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
104 | 104 | |
105 | 105 | // Payment gateways Information. |
106 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
107 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
106 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
107 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
108 | 108 | |
109 | - if ( ! empty( $gateways ) ) { |
|
109 | + if ( ! empty($gateways)) { |
|
110 | 110 | self::$counter = 1; |
111 | - foreach ( $gateways as $gateway ) { |
|
112 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
111 | + foreach ($gateways as $gateway) { |
|
112 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
113 | 113 | self::$counter++; |
114 | 114 | } |
115 | 115 | } else { |
116 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
116 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @subcommand forms |
147 | 147 | */ |
148 | - public function forms( $args, $assoc_args ) { |
|
148 | + public function forms($args, $assoc_args) { |
|
149 | 149 | global $wp_query; |
150 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
151 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
150 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
151 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
152 | 152 | $start = time(); |
153 | 153 | |
154 | 154 | // Cache previous number query var. |
155 | 155 | $is_set_number = $cache_per_page = false; |
156 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
156 | + if (isset($wp_query->query_vars['number'])) { |
|
157 | 157 | $cache_per_page = $wp_query->query_vars['number']; |
158 | 158 | $is_set_number = true; |
159 | 159 | } |
@@ -162,46 +162,46 @@ discard block |
||
162 | 162 | $wp_query->query_vars['number'] = $number; |
163 | 163 | |
164 | 164 | // Get forms. |
165 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
165 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
166 | 166 | |
167 | 167 | // Reset number query var. |
168 | - if ( $is_set_number ) { |
|
168 | + if ($is_set_number) { |
|
169 | 169 | $wp_query->query_vars['number'] = $cache_per_page; |
170 | 170 | } |
171 | 171 | |
172 | 172 | // Bailout. |
173 | - if ( array_key_exists( 'error', $forms ) ) { |
|
173 | + if (array_key_exists('error', $forms)) { |
|
174 | 174 | |
175 | - WP_CLI::warning( $forms['error'] ); |
|
175 | + WP_CLI::warning($forms['error']); |
|
176 | 176 | return; |
177 | - } elseif ( empty( $forms['forms'] ) ) { |
|
177 | + } elseif (empty($forms['forms'])) { |
|
178 | 178 | |
179 | - WP_CLI::error( __( 'No form found.', 'give' ) ); |
|
179 | + WP_CLI::error(__('No form found.', 'give')); |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Param to check if form typeis already showed or not. |
184 | 184 | $is_show_form_type = false; |
185 | 185 | |
186 | - if ( 1 === count( $forms ) && $form_id ) { |
|
186 | + if (1 === count($forms) && $form_id) { |
|
187 | 187 | // Show single form. |
188 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
189 | - switch ( $key ) { |
|
188 | + foreach ($forms['forms'][0] as $key => $info) { |
|
189 | + switch ($key) { |
|
190 | 190 | case 'stats': |
191 | - $this->color_main_heading( ucfirst( $key ) ); |
|
191 | + $this->color_main_heading(ucfirst($key)); |
|
192 | 192 | |
193 | - foreach ( $info as $heading => $data ) { |
|
194 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
195 | - switch ( $heading ) { |
|
193 | + foreach ($info as $heading => $data) { |
|
194 | + $this->color_sub_heading(ucfirst($heading)); |
|
195 | + switch ($heading) { |
|
196 | 196 | default: |
197 | - foreach ( $data as $subheading => $subdata ) { |
|
197 | + foreach ($data as $subheading => $subdata) { |
|
198 | 198 | |
199 | - switch ( $subheading ) { |
|
199 | + switch ($subheading) { |
|
200 | 200 | case 'earnings': |
201 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
201 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
202 | 202 | break; |
203 | 203 | default: |
204 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
204 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
@@ -211,26 +211,26 @@ discard block |
||
211 | 211 | case 'pricing': |
212 | 212 | case 'info': |
213 | 213 | default: |
214 | - $this->color_main_heading( ucfirst( $key ) ); |
|
214 | + $this->color_main_heading(ucfirst($key)); |
|
215 | 215 | |
216 | 216 | // Show form type. |
217 | - if ( ! $is_show_form_type ) { |
|
218 | - $form = new Give_Donate_Form( $form_id ); |
|
217 | + if ( ! $is_show_form_type) { |
|
218 | + $form = new Give_Donate_Form($form_id); |
|
219 | 219 | $is_show_form_type = true; |
220 | 220 | |
221 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
221 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
222 | 222 | } |
223 | 223 | |
224 | - foreach ( $info as $heading => $data ) { |
|
224 | + foreach ($info as $heading => $data) { |
|
225 | 225 | |
226 | - switch ( $heading ) { |
|
226 | + switch ($heading) { |
|
227 | 227 | case 'id': |
228 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
228 | + WP_CLI::log($this->color_message($heading, $data)); |
|
229 | 229 | break; |
230 | 230 | |
231 | 231 | default: |
232 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
233 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
232 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
233 | + WP_CLI::log($this->color_message($heading, $data)); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | } |
@@ -241,37 +241,37 @@ discard block |
||
241 | 241 | $is_table_first_row_set = false; |
242 | 242 | $table_column_count = 0; |
243 | 243 | |
244 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
244 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
245 | 245 | |
246 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
246 | + foreach ($forms['forms'] as $index => $form_data) { |
|
247 | 247 | |
248 | 248 | // Default table data. |
249 | 249 | $table_first_row = array(); |
250 | 250 | $table_row = array(); |
251 | 251 | |
252 | - foreach ( $form_data['info'] as $key => $form ) { |
|
252 | + foreach ($form_data['info'] as $key => $form) { |
|
253 | 253 | |
254 | 254 | // Do not show thumbnail, content and link in table. |
255 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
255 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | - if ( ! $is_table_first_row_set ) { |
|
259 | + if ( ! $is_table_first_row_set) { |
|
260 | 260 | $table_first_row[] = $key; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $table_row[] = $form; |
264 | 264 | |
265 | - if ( 'status' === $key ) { |
|
265 | + if ('status' === $key) { |
|
266 | 266 | // First array item will be an form id in our case. |
267 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
267 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
268 | 268 | |
269 | 269 | $table_row[] = $form->get_type(); |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | 273 | // Set table first row. |
274 | - if ( ! $is_table_first_row_set ) { |
|
274 | + if ( ! $is_table_first_row_set) { |
|
275 | 275 | |
276 | 276 | // Add extra column to table. |
277 | 277 | $table_first_row[] = 'type'; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $table_data[] = $table_row; |
285 | 285 | } |
286 | 286 | |
287 | - $this->display_table( $table_data ); |
|
287 | + $this->display_table($table_data); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -325,29 +325,29 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @subcommand donors |
327 | 327 | */ |
328 | - public function donors( $args, $assoc_args ) { |
|
328 | + public function donors($args, $assoc_args) { |
|
329 | 329 | global $wp_query; |
330 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
331 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
332 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
333 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
334 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
330 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
331 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
332 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
333 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
334 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
335 | 335 | $start = time(); |
336 | 336 | |
337 | - if ( $create ) { |
|
337 | + if ($create) { |
|
338 | 338 | $number = 1; |
339 | 339 | |
340 | 340 | // Create one or more donors. |
341 | - if ( ! $email ) { |
|
341 | + if ( ! $email) { |
|
342 | 342 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
343 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
343 | + $number = is_numeric($create) ? absint($create) : 1; |
|
344 | 344 | } |
345 | 345 | |
346 | - for ( $i = 0; $i < $number; $i++ ) { |
|
347 | - if ( ! $email ) { |
|
346 | + for ($i = 0; $i < $number; $i++) { |
|
347 | + if ( ! $email) { |
|
348 | 348 | |
349 | 349 | // Generate fake email. |
350 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
350 | + $email = 'customer-'.uniqid().'@test.com'; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $args = array( |
@@ -355,33 +355,33 @@ discard block |
||
355 | 355 | 'name' => $name, |
356 | 356 | ); |
357 | 357 | |
358 | - $customer_id = Give()->customers->add( $args ); |
|
358 | + $customer_id = Give()->customers->add($args); |
|
359 | 359 | |
360 | - if ( $customer_id ) { |
|
361 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor %d created successfully', 'give' ), $customer_id ) ) ); |
|
360 | + if ($customer_id) { |
|
361 | + WP_CLI::line($this->color_message(sprintf(__('Donor %d created successfully', 'give'), $customer_id))); |
|
362 | 362 | } else { |
363 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
363 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // Reset email to false so it is generated on the next loop (if creating donors). |
367 | 367 | $email = false; |
368 | 368 | } |
369 | 369 | |
370 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
370 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
371 | 371 | |
372 | 372 | } else { |
373 | 373 | // Counter. |
374 | 374 | self::$counter = 1; |
375 | 375 | |
376 | 376 | // Search for customers. |
377 | - $search = $donor_id ? $donor_id : $email; |
|
377 | + $search = $donor_id ? $donor_id : $email; |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Get donors. |
381 | 381 | */ |
382 | 382 | // Cache previous number query var. |
383 | 383 | $is_set_number = $cache_per_page = false; |
384 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
384 | + if (isset($wp_query->query_vars['number'])) { |
|
385 | 385 | $cache_per_page = $wp_query->query_vars['number']; |
386 | 386 | $is_set_number = true; |
387 | 387 | } |
@@ -390,43 +390,43 @@ discard block |
||
390 | 390 | $wp_query->query_vars['number'] = $number; |
391 | 391 | |
392 | 392 | // Get donors. |
393 | - $donors = $this->api->get_customers( $search ); |
|
393 | + $donors = $this->api->get_customers($search); |
|
394 | 394 | |
395 | 395 | // Reset number query var. |
396 | - if ( $is_set_number ) { |
|
396 | + if ($is_set_number) { |
|
397 | 397 | $wp_query->query_vars['number'] = $cache_per_page; |
398 | 398 | } |
399 | 399 | |
400 | - if ( isset( $donors['error'] ) ) { |
|
401 | - WP_CLI::error( $donors['error'] ); |
|
400 | + if (isset($donors['error'])) { |
|
401 | + WP_CLI::error($donors['error']); |
|
402 | 402 | } |
403 | 403 | |
404 | - if ( empty( $donors ) ) { |
|
405 | - WP_CLI::error( __( 'No donors found', 'give' ) ); |
|
404 | + if (empty($donors)) { |
|
405 | + WP_CLI::error(__('No donors found', 'give')); |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | 409 | $table_data = array(); |
410 | 410 | $is_table_first_row_set = false; |
411 | 411 | |
412 | - foreach ( $donors['donors'] as $donor_data ) { |
|
412 | + foreach ($donors['donors'] as $donor_data) { |
|
413 | 413 | // Set default table row data. |
414 | - $table_first_row = array( __( 'S. No.', 'give' ) ); |
|
415 | - $table_row = array( self::$counter ); |
|
414 | + $table_first_row = array(__('S. No.', 'give')); |
|
415 | + $table_row = array(self::$counter); |
|
416 | 416 | |
417 | - foreach ( $donor_data as $key => $donor ) { |
|
418 | - switch ( $key ) { |
|
417 | + foreach ($donor_data as $key => $donor) { |
|
418 | + switch ($key) { |
|
419 | 419 | case 'stats': |
420 | - foreach ( $donor as $heading => $data ) { |
|
420 | + foreach ($donor as $heading => $data) { |
|
421 | 421 | |
422 | 422 | // Get first row. |
423 | - if ( ! $is_table_first_row_set ) { |
|
423 | + if ( ! $is_table_first_row_set) { |
|
424 | 424 | $table_first_row[] = $heading; |
425 | 425 | } |
426 | 426 | |
427 | - switch ( $heading ) { |
|
427 | + switch ($heading) { |
|
428 | 428 | case 'total_spent': |
429 | - $table_row[] = give_currency_filter( $data ); |
|
429 | + $table_row[] = give_currency_filter($data); |
|
430 | 430 | break; |
431 | 431 | |
432 | 432 | default: |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | |
438 | 438 | case 'info': |
439 | 439 | default: |
440 | - foreach ( $donor as $heading => $data ) { |
|
440 | + foreach ($donor as $heading => $data) { |
|
441 | 441 | |
442 | 442 | // Get first row. |
443 | - if ( ! $is_table_first_row_set ) { |
|
443 | + if ( ! $is_table_first_row_set) { |
|
444 | 444 | $table_first_row[] = $heading; |
445 | 445 | } |
446 | 446 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | // Add first row data to table data. |
453 | - if ( ! $is_table_first_row_set ) { |
|
453 | + if ( ! $is_table_first_row_set) { |
|
454 | 454 | $table_data[] = $table_first_row; |
455 | 455 | $is_table_first_row_set = true; |
456 | 456 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | self::$counter++; |
463 | 463 | } |
464 | 464 | |
465 | - $this->display_table( $table_data ); |
|
465 | + $this->display_table($table_data); |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | * |
492 | 492 | * @subcommand donations |
493 | 493 | */ |
494 | - public function donations( $args, $assoc_args ) { |
|
494 | + public function donations($args, $assoc_args) { |
|
495 | 495 | global $wp_query; |
496 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
496 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
497 | 497 | |
498 | 498 | // Cache previous number query var. |
499 | 499 | $is_set_number = $cache_per_page = false; |
500 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
500 | + if (isset($wp_query->query_vars['number'])) { |
|
501 | 501 | $cache_per_page = $wp_query->query_vars['number']; |
502 | 502 | $is_set_number = true; |
503 | 503 | } |
@@ -509,45 +509,45 @@ discard block |
||
509 | 509 | $donations = $this->api->get_recent_donations(); |
510 | 510 | |
511 | 511 | // Reset number query var. |
512 | - if ( $is_set_number ) { |
|
512 | + if ($is_set_number) { |
|
513 | 513 | $wp_query->query_vars['number'] = $cache_per_page; |
514 | 514 | } |
515 | 515 | |
516 | - if ( empty( $donations ) ) { |
|
517 | - WP_CLI::error( __( 'No sales found', 'give' ) ); |
|
516 | + if (empty($donations)) { |
|
517 | + WP_CLI::error(__('No sales found', 'give')); |
|
518 | 518 | return; |
519 | 519 | } |
520 | 520 | |
521 | 521 | self::$counter = 1; |
522 | 522 | |
523 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
524 | - $this->color_main_heading( sprintf( __( '%1$s. Payment #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
523 | + foreach ($donations['donations'] as $key => $donation) { |
|
524 | + $this->color_main_heading(sprintf(__('%1$s. Payment #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
525 | 525 | self::$counter++; |
526 | 526 | |
527 | - foreach ( $donation as $column => $data ) { |
|
527 | + foreach ($donation as $column => $data) { |
|
528 | 528 | |
529 | - if ( is_array( $data ) ) { |
|
530 | - $this->color_sub_heading( $column ); |
|
531 | - foreach ( $data as $subcolumn => $subdata ) { |
|
529 | + if (is_array($data)) { |
|
530 | + $this->color_sub_heading($column); |
|
531 | + foreach ($data as $subcolumn => $subdata) { |
|
532 | 532 | |
533 | 533 | // Decode html codes. |
534 | - switch ( $subcolumn ) { |
|
534 | + switch ($subcolumn) { |
|
535 | 535 | case 'name': |
536 | - $subdata = html_entity_decode( $subdata ); |
|
536 | + $subdata = html_entity_decode($subdata); |
|
537 | 537 | break; |
538 | 538 | } |
539 | 539 | |
540 | 540 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
541 | - if ( is_array( $subdata ) ) { |
|
541 | + if (is_array($subdata)) { |
|
542 | 542 | continue; |
543 | 543 | } |
544 | 544 | |
545 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
545 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
546 | 546 | } |
547 | 547 | continue; |
548 | 548 | } |
549 | 549 | |
550 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
550 | + WP_CLI::log($this->color_message($column, $data)); |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
@@ -586,27 +586,27 @@ discard block |
||
586 | 586 | * |
587 | 587 | * @return void |
588 | 588 | */ |
589 | - public function report( $args, $assoc_args ) { |
|
589 | + public function report($args, $assoc_args) { |
|
590 | 590 | $stats = new Give_Payment_Stats(); |
591 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
592 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
593 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
594 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
591 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
592 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
593 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
594 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
595 | 595 | |
596 | - if ( ! empty( $date ) ) { |
|
596 | + if ( ! empty($date)) { |
|
597 | 597 | $start_date = $date; |
598 | 598 | $end_date = false; |
599 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
599 | + } elseif (empty($date) && empty($start_date)) { |
|
600 | 600 | $start_date = 'this_month'; |
601 | 601 | $end_date = false; |
602 | 602 | } |
603 | 603 | |
604 | 604 | // Get stats. |
605 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
606 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
605 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
606 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
607 | 607 | |
608 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
609 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
608 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
609 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -633,26 +633,26 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @subcommand cache |
635 | 635 | */ |
636 | - public function cache( $args, $assoc_args ) { |
|
637 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
636 | + public function cache($args, $assoc_args) { |
|
637 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
638 | 638 | |
639 | 639 | // Bailout. |
640 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
641 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
640 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
641 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
642 | 642 | return; |
643 | 643 | } |
644 | 644 | |
645 | - switch ( $action ) { |
|
645 | + switch ($action) { |
|
646 | 646 | case 'delete' : |
647 | 647 | // Reset counter. |
648 | 648 | self::$counter = 1; |
649 | 649 | |
650 | - if ( $this->delete_stats_transients() ) { |
|
650 | + if ($this->delete_stats_transients()) { |
|
651 | 651 | // Report .eading. |
652 | - WP_CLI::success( 'All form stat transient cache deleted.' ); |
|
652 | + WP_CLI::success('All form stat transient cache deleted.'); |
|
653 | 653 | } else { |
654 | 654 | // Report .eading. |
655 | - WP_CLI::warning( 'We did not find any transient to delete :)' ); |
|
655 | + WP_CLI::warning('We did not find any transient to delete :)'); |
|
656 | 656 | } |
657 | 657 | break; |
658 | 658 | } |
@@ -678,23 +678,23 @@ discard block |
||
678 | 678 | ARRAY_A |
679 | 679 | ); |
680 | 680 | |
681 | - if ( ! empty( $stat_option_names ) ) { |
|
681 | + if ( ! empty($stat_option_names)) { |
|
682 | 682 | |
683 | 683 | // Convert transient option name to transient name. |
684 | 684 | $stat_option_names = array_map( |
685 | - function( $option ) { |
|
686 | - return str_replace( '_transient_', '', $option['option_name'] ); |
|
685 | + function($option) { |
|
686 | + return str_replace('_transient_', '', $option['option_name']); |
|
687 | 687 | }, |
688 | 688 | $stat_option_names |
689 | 689 | ); |
690 | 690 | |
691 | - foreach ( $stat_option_names as $option_name ) { |
|
692 | - if ( delete_transient( $option_name ) ) { |
|
691 | + foreach ($stat_option_names as $option_name) { |
|
692 | + if (delete_transient($option_name)) { |
|
693 | 693 | |
694 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
694 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
695 | 695 | self::$counter++; |
696 | 696 | } else { |
697 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
697 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
@@ -715,12 +715,12 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @return mixed |
717 | 717 | */ |
718 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
718 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
719 | 719 | // Add colon. |
720 | - if ( $colon ) { |
|
721 | - $heading = $heading . ': '; |
|
720 | + if ($colon) { |
|
721 | + $heading = $heading.': '; |
|
722 | 722 | } |
723 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
723 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
739 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
738 | + private function color_main_heading($heading, $color = 'g') { |
|
739 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return void |
751 | 751 | */ |
752 | - private function color_sub_heading( $subheading ) { |
|
753 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
752 | + private function color_sub_heading($subheading) { |
|
753 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | * |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - private function display_table( $data ) { |
|
767 | + private function display_table($data) { |
|
768 | 768 | $table = new \cli\Table(); |
769 | 769 | |
770 | 770 | // Set table header. |
771 | - $table->setHeaders( $data[0] ); |
|
771 | + $table->setHeaders($data[0]); |
|
772 | 772 | |
773 | 773 | // Remove table header. |
774 | - unset( $data[0] ); |
|
774 | + unset($data[0]); |
|
775 | 775 | |
776 | 776 | // Set table data. |
777 | - $table->setRows( $data ); |
|
777 | + $table->setRows($data); |
|
778 | 778 | |
779 | 779 | // Display table. |
780 | 780 | $table->display(); |
@@ -358,9 +358,9 @@ |
||
358 | 358 | require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
359 | 359 | require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
360 | 360 | |
361 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
363 | - } |
|
361 | + if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
362 | + require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
363 | + } |
|
364 | 364 | |
365 | 365 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
366 | 366 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function __clone() { |
234 | 234 | // Cloning instances of the class is forbidden |
235 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
235 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function __wakeup() { |
247 | 247 | // Unserializing instances of the class is forbidden. |
248 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
248 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | private function setup_constants() { |
260 | 260 | |
261 | 261 | // Plugin version |
262 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
263 | - define( 'GIVE_VERSION', '1.6' ); |
|
262 | + if ( ! defined('GIVE_VERSION')) { |
|
263 | + define('GIVE_VERSION', '1.6'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // Plugin Folder Path |
267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
267 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // Plugin Folder URL |
272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
272 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Plugin Basename aka: "give/give.php" |
277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Plugin Root File |
282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
282 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
283 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // Make sure CAL_GREGORIAN is defined |
287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
288 | - define( 'CAL_GREGORIAN', 1 ); |
|
287 | + if ( ! defined('CAL_GREGORIAN')) { |
|
288 | + define('CAL_GREGORIAN', 1); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,114 +300,114 @@ discard block |
||
300 | 300 | private function includes() { |
301 | 301 | global $give_options; |
302 | 302 | |
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
304 | 304 | $give_options = give_get_settings(); |
305 | 305 | |
306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
311 | - |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
326 | - |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
342 | - |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
348 | - |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
354 | - |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
360 | - |
|
361 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
311 | + |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
326 | + |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
342 | + |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
348 | + |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
354 | + |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
360 | + |
|
361 | + if (defined('WP_CLI') && WP_CLI) { |
|
362 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
363 | 363 | } |
364 | 364 | |
365 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
366 | - |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
377 | - |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
380 | - |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
386 | - |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
394 | - |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
404 | - |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
365 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
366 | + |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
377 | + |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
380 | + |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
386 | + |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
394 | + |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
404 | + |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
410 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
411 | 411 | |
412 | 412 | } |
413 | 413 | |
@@ -421,26 +421,26 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function load_textdomain() { |
423 | 423 | // Set filter for Give's languages directory |
424 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
425 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
424 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
425 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
426 | 426 | |
427 | 427 | // Traditional WordPress plugin locale filter |
428 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
429 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
428 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
429 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
430 | 430 | |
431 | 431 | // Setup paths to current locale file |
432 | - $mofile_local = $give_lang_dir . $mofile; |
|
433 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
432 | + $mofile_local = $give_lang_dir.$mofile; |
|
433 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
434 | 434 | |
435 | - if ( file_exists( $mofile_global ) ) { |
|
435 | + if (file_exists($mofile_global)) { |
|
436 | 436 | // Look in global /wp-content/languages/give folder |
437 | - load_textdomain( 'give', $mofile_global ); |
|
438 | - } elseif ( file_exists( $mofile_local ) ) { |
|
437 | + load_textdomain('give', $mofile_global); |
|
438 | + } elseif (file_exists($mofile_local)) { |
|
439 | 439 | // Look in local location from filter `give_languages_directory` |
440 | - load_textdomain( 'give', $mofile_local ); |
|
440 | + load_textdomain('give', $mofile_local); |
|
441 | 441 | } else { |
442 | 442 | // Load the default language files packaged up w/ Give |
443 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
443 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h1><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | public function admin_menus() { |
52 | 52 | // About Page |
53 | 53 | add_dashboard_page( |
54 | - esc_html__( 'Welcome to Give', 'give' ), |
|
55 | - esc_html__( 'Welcome to Give', 'give' ), |
|
54 | + esc_html__('Welcome to Give', 'give'), |
|
55 | + esc_html__('Welcome to Give', 'give'), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'give-about', |
58 | - array( $this, 'about_screen' ) |
|
58 | + array($this, 'about_screen') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | // Changelog Page |
62 | 62 | add_dashboard_page( |
63 | - esc_html__( 'Give Changelog', 'give' ), |
|
64 | - esc_html__( 'Give Changelog', 'give' ), |
|
63 | + esc_html__('Give Changelog', 'give'), |
|
64 | + esc_html__('Give Changelog', 'give'), |
|
65 | 65 | $this->minimum_capability, |
66 | 66 | 'give-changelog', |
67 | - array( $this, 'changelog_screen' ) |
|
67 | + array($this, 'changelog_screen') |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | // Getting Started Page |
71 | 71 | add_dashboard_page( |
72 | - esc_html__( 'Getting started with Give', 'give' ), |
|
73 | - esc_html__( 'Getting started with Give', 'give' ), |
|
72 | + esc_html__('Getting started with Give', 'give'), |
|
73 | + esc_html__('Getting started with Give', 'give'), |
|
74 | 74 | $this->minimum_capability, |
75 | 75 | 'give-getting-started', |
76 | - array( $this, 'getting_started_screen' ) |
|
76 | + array($this, 'getting_started_screen') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Credits Page |
80 | 80 | add_dashboard_page( |
81 | - esc_html__( 'The people that build Give', 'give' ), |
|
82 | - esc_html__( 'The people that build Give', 'give' ), |
|
81 | + esc_html__('The people that build Give', 'give'), |
|
82 | + esc_html__('The people that build Give', 'give'), |
|
83 | 83 | $this->minimum_capability, |
84 | 84 | 'give-credits', |
85 | - array( $this, 'credits_screen' ) |
|
85 | + array($this, 'credits_screen') |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function admin_head() { |
97 | 97 | |
98 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
99 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
100 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
101 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
98 | + remove_submenu_page('index.php', 'give-about'); |
|
99 | + remove_submenu_page('index.php', 'give-changelog'); |
|
100 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
101 | + remove_submenu_page('index.php', 'give-credits'); |
|
102 | 102 | |
103 | 103 | // Badge for welcome page |
104 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
104 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <style type="text/css" media="screen"> |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | public function tabs() { |
218 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
218 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
219 | 219 | ?> |
220 | 220 | <h2 class="nav-tab-wrapper"> |
221 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
222 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
221 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
222 | + <?php esc_html_e('About Give', 'give'); ?> |
|
223 | 223 | </a> |
224 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
225 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
224 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
225 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
226 | 226 | </a> |
227 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
228 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
227 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
228 | + <?php esc_html_e('Credits', 'give'); ?> |
|
229 | 229 | </a> |
230 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
230 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h2> |
234 | 234 | <?php |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function about_screen() { |
245 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
245 | + list($display_version) = explode('-', GIVE_VERSION); |
|
246 | 246 | ?> |
247 | 247 | <div class="wrap about-wrap"> |
248 | 248 | <h1 class="welcome-h1"><?php |
249 | 249 | printf( |
250 | 250 | /* translators: %s: Give version */ |
251 | - esc_html__( 'Welcome to Give %s', 'give' ), |
|
251 | + esc_html__('Welcome to Give %s', 'give'), |
|
252 | 252 | $display_version |
253 | 253 | ); |
254 | 254 | ?></h1> |
@@ -258,19 +258,19 @@ discard block |
||
258 | 258 | <p class="about-text"><?php |
259 | 259 | printf( |
260 | 260 | /* translators: %s: https://givewp.com/documenation/ */ |
261 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
262 | - esc_url( 'https://givewp.com/documenation/' ) |
|
261 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
262 | + esc_url('https://givewp.com/documenation/') |
|
263 | 263 | ); |
264 | 264 | ?></p> |
265 | 265 | |
266 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
266 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
267 | 267 | |
268 | 268 | <?php give_get_newsletter() ?> |
269 | 269 | |
270 | 270 | <div class="give-badge"><?php |
271 | 271 | printf( |
272 | 272 | /* translators: %s: Give version */ |
273 | - esc_html__( 'Version %s', 'give' ), |
|
273 | + esc_html__('Version %s', 'give'), |
|
274 | 274 | $display_version |
275 | 275 | ); |
276 | 276 | ?></div> |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | <div class="feature-section clearfix introduction"> |
281 | 281 | |
282 | 282 | <div class="video feature-section-item"> |
283 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
283 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="content feature-section-item last-feature"> |
287 | 287 | |
288 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
288 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
289 | 289 | |
290 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
290 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
291 | 291 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
292 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
292 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
293 | 293 | <span class="dashicons dashicons-external"></span> |
294 | 294 | </a> |
295 | 295 | |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | |
303 | 303 | <div class="content feature-section-item"> |
304 | 304 | |
305 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
305 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
306 | 306 | |
307 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
307 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
308 | 308 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary"> |
309 | - <?php esc_html_e( 'View Documentation', 'give' ); ?> |
|
309 | + <?php esc_html_e('View Documentation', 'give'); ?> |
|
310 | 310 | <span class="dashicons dashicons-external"></span> |
311 | 311 | </a> |
312 | 312 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
316 | 316 | |
317 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
317 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
318 | 318 | |
319 | 319 | </div> |
320 | 320 | |
@@ -334,22 +334,22 @@ discard block |
||
334 | 334 | * @return void |
335 | 335 | */ |
336 | 336 | public function changelog_screen() { |
337 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
337 | + list($display_version) = explode('-', GIVE_VERSION); |
|
338 | 338 | ?> |
339 | 339 | <div class="wrap about-wrap"> |
340 | - <h1><?php esc_html_e( 'Give Changelog', 'give' ); ?></h1> |
|
340 | + <h1><?php esc_html_e('Give Changelog', 'give'); ?></h1> |
|
341 | 341 | |
342 | 342 | <p class="about-text"><?php |
343 | 343 | printf( |
344 | 344 | /* translators: %s: Give version */ |
345 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
345 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
346 | 346 | $display_version |
347 | 347 | ); |
348 | 348 | ?></p> |
349 | 349 | <div class="give-badge"><?php |
350 | 350 | printf( |
351 | 351 | /* translators: %s: Give version */ |
352 | - esc_html__( 'Version %s', 'give' ), |
|
352 | + esc_html__('Version %s', 'give'), |
|
353 | 353 | $display_version |
354 | 354 | ); |
355 | 355 | ?></div> |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | <?php $this->tabs(); ?> |
358 | 358 | |
359 | 359 | <div class="changelog"> |
360 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
360 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
361 | 361 | |
362 | 362 | <div class="feature-section"> |
363 | 363 | <?php echo $this->parse_readme(); ?> |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | </div> |
366 | 366 | |
367 | 367 | <div class="return-to-dashboard"> |
368 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
368 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
369 | 369 | 'post_type' => 'give_forms', |
370 | 370 | 'page' => 'give-settings' |
371 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
371 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
372 | 372 | </div> |
373 | 373 | </div> |
374 | 374 | <?php |
@@ -382,45 +382,45 @@ discard block |
||
382 | 382 | * @return void |
383 | 383 | */ |
384 | 384 | public function getting_started_screen() { |
385 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
385 | + list($display_version) = explode('-', GIVE_VERSION); |
|
386 | 386 | ?> |
387 | 387 | <div class="wrap about-wrap get-started"> |
388 | 388 | <h1 class="welcome-h1"><?php |
389 | 389 | printf( |
390 | 390 | /* translators: %s: Give version */ |
391 | - esc_html__( 'Give %s - Getting Started Guide', 'give' ), |
|
391 | + esc_html__('Give %s - Getting Started Guide', 'give'), |
|
392 | 392 | $display_version |
393 | 393 | ); |
394 | 394 | ?></h1> |
395 | 395 | |
396 | 396 | <?php give_social_media_elements() ?> |
397 | 397 | |
398 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
398 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
399 | 399 | |
400 | - <p class="newsletter-intro"><?php esc_html_e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?></p> |
|
400 | + <p class="newsletter-intro"><?php esc_html_e('Don\'t forget to sign up for the newsletter!', 'give'); ?></p> |
|
401 | 401 | |
402 | 402 | <?php give_get_newsletter() ?> |
403 | 403 | |
404 | 404 | <div class="give-badge"><?php |
405 | 405 | printf( |
406 | 406 | /* translators: %s: Give version */ |
407 | - esc_html__( 'Version %s', 'give' ), |
|
407 | + esc_html__('Version %s', 'give'), |
|
408 | 408 | $display_version |
409 | 409 | ); |
410 | 410 | ?></div> |
411 | 411 | |
412 | 412 | <?php $this->tabs(); ?> |
413 | 413 | |
414 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
414 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
415 | 415 | |
416 | 416 | <div class="feature-section clearfix"> |
417 | 417 | |
418 | 418 | <div class="content feature-section-item"> |
419 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
419 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
420 | 420 | |
421 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
421 | + <p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
422 | 422 | |
423 | - <p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
423 | + <p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
424 | 424 | </div> |
425 | 425 | |
426 | 426 | <div class="content feature-section-item last-feature"> |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | </div> |
438 | 438 | |
439 | 439 | <div class="content feature-section-item last-feature"> |
440 | - <h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
440 | + <h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
441 | 441 | |
442 | - <p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
442 | + <p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | </div> |
@@ -448,11 +448,11 @@ discard block |
||
448 | 448 | <div class="feature-section clearfix"> |
449 | 449 | |
450 | 450 | <div class="content feature-section-item add-content"> |
451 | - <h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
451 | + <h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
452 | 452 | |
453 | - <p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
453 | + <p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
454 | 454 | |
455 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
455 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
456 | 456 | </div> |
457 | 457 | |
458 | 458 | <div class="content feature-section-item last-feature"> |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | </div> |
470 | 470 | |
471 | 471 | <div class="content feature-section-item last-feature"> |
472 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
472 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
473 | 473 | |
474 | - <p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
474 | + <p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
475 | 475 | </div> |
476 | 476 | |
477 | 477 | |
@@ -491,31 +491,31 @@ discard block |
||
491 | 491 | * @return void |
492 | 492 | */ |
493 | 493 | public function credits_screen() { |
494 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
494 | + list($display_version) = explode('-', GIVE_VERSION); |
|
495 | 495 | ?> |
496 | 496 | <div class="wrap about-wrap"> |
497 | 497 | <h1 class="welcome-h1"><?php |
498 | 498 | printf( |
499 | 499 | /* translators: %s: Give version */ |
500 | - esc_html__( 'Give %s - Credits', 'give' ), |
|
500 | + esc_html__('Give %s - Credits', 'give'), |
|
501 | 501 | $display_version |
502 | 502 | ); |
503 | 503 | ?></h1> |
504 | 504 | |
505 | 505 | <?php give_social_media_elements() ?> |
506 | 506 | |
507 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
507 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
508 | 508 | |
509 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
509 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
510 | 510 | |
511 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
511 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
512 | 512 | |
513 | 513 | <?php give_get_newsletter() ?> |
514 | 514 | |
515 | 515 | <div class="give-badge"><?php |
516 | 516 | printf( |
517 | 517 | /* translators: %s: Give version */ |
518 | - esc_html__( 'Version %s', 'give' ), |
|
518 | + esc_html__('Version %s', 'give'), |
|
519 | 519 | $display_version |
520 | 520 | ); |
521 | 521 | ?></div> |
@@ -525,8 +525,8 @@ discard block |
||
525 | 525 | <p class="about-description"><?php |
526 | 526 | printf( |
527 | 527 | /* translators: %s: https://github.com/WordImpress/give */ |
528 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
529 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
528 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
529 | + esc_url('https://github.com/WordImpress/give') |
|
530 | 530 | ); |
531 | 531 | ?></p> |
532 | 532 | |
@@ -543,21 +543,21 @@ discard block |
||
543 | 543 | * @return string $readme HTML formatted readme file |
544 | 544 | */ |
545 | 545 | public function parse_readme() { |
546 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
546 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
547 | 547 | |
548 | - if ( ! $file ) { |
|
549 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
548 | + if ( ! $file) { |
|
549 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
550 | 550 | } else { |
551 | - $readme = file_get_contents( $file ); |
|
552 | - $readme = nl2br( esc_html( $readme ) ); |
|
553 | - $readme = explode( '== Changelog ==', $readme ); |
|
554 | - $readme = end( $readme ); |
|
555 | - |
|
556 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
557 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
558 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
559 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
560 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
551 | + $readme = file_get_contents($file); |
|
552 | + $readme = nl2br(esc_html($readme)); |
|
553 | + $readme = explode('== Changelog ==', $readme); |
|
554 | + $readme = end($readme); |
|
555 | + |
|
556 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
557 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
558 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
559 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
560 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $readme; |
@@ -574,27 +574,27 @@ discard block |
||
574 | 574 | public function contributors() { |
575 | 575 | $contributors = $this->get_contributors(); |
576 | 576 | |
577 | - if ( empty( $contributors ) ) { |
|
577 | + if (empty($contributors)) { |
|
578 | 578 | return ''; |
579 | 579 | } |
580 | 580 | |
581 | 581 | $contributor_list = '<ul class="wp-people-group">'; |
582 | 582 | |
583 | - foreach ( $contributors as $contributor ) { |
|
583 | + foreach ($contributors as $contributor) { |
|
584 | 584 | $contributor_list .= '<li class="wp-person">'; |
585 | - $contributor_list .= sprintf( '<a href="%s" title="%s">', |
|
586 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
585 | + $contributor_list .= sprintf('<a href="%s" title="%s">', |
|
586 | + esc_url('https://github.com/'.$contributor->login), |
|
587 | 587 | esc_html( |
588 | 588 | sprintf( |
589 | 589 | /* translators: %s: github contributor */ |
590 | - esc_html__( 'View %s', 'give' ), |
|
590 | + esc_html__('View %s', 'give'), |
|
591 | 591 | $contributor->login |
592 | 592 | ) |
593 | 593 | ) |
594 | 594 | ); |
595 | - $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ); |
|
595 | + $contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)); |
|
596 | 596 | $contributor_list .= '</a>'; |
597 | - $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ); |
|
597 | + $contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login)); |
|
598 | 598 | $contributor_list .= '</a>'; |
599 | 599 | $contributor_list .= '</li>'; |
600 | 600 | } |
@@ -612,25 +612,25 @@ discard block |
||
612 | 612 | * @return array $contributors List of contributors |
613 | 613 | */ |
614 | 614 | public function get_contributors() { |
615 | - $contributors = get_transient( 'give_contributors' ); |
|
615 | + $contributors = get_transient('give_contributors'); |
|
616 | 616 | |
617 | - if ( false !== $contributors ) { |
|
617 | + if (false !== $contributors) { |
|
618 | 618 | return $contributors; |
619 | 619 | } |
620 | 620 | |
621 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
621 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
622 | 622 | |
623 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
623 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
624 | 624 | return array(); |
625 | 625 | } |
626 | 626 | |
627 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
627 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
628 | 628 | |
629 | - if ( ! is_array( $contributors ) ) { |
|
629 | + if ( ! is_array($contributors)) { |
|
630 | 630 | return array(); |
631 | 631 | } |
632 | 632 | |
633 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
633 | + set_transient('give_contributors', $contributors, 3600); |
|
634 | 634 | |
635 | 635 | return $contributors; |
636 | 636 | } |
@@ -649,24 +649,24 @@ discard block |
||
649 | 649 | |
650 | 650 | |
651 | 651 | // Bail if no activation redirect |
652 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
652 | + if ( ! get_transient('_give_activation_redirect')) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
656 | 656 | // Delete the redirect transient |
657 | - delete_transient( '_give_activation_redirect' ); |
|
657 | + delete_transient('_give_activation_redirect'); |
|
658 | 658 | |
659 | 659 | // Bail if activating from network, or bulk |
660 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
660 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
661 | 661 | return; |
662 | 662 | } |
663 | 663 | |
664 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
664 | + $upgrade = get_option('give_version_upgraded_from'); |
|
665 | 665 | |
666 | - if ( ! $upgrade ) { // First time install |
|
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
666 | + if ( ! $upgrade) { // First time install |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
669 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
670 | 670 | |
671 | 671 | } else { // Welcome is NOT disabled in settings |
672 | 672 | wp_safe_redirect(admin_url('index.php?page=give-about')); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 1.3.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) or exit; |
|
11 | +defined('ABSPATH') or exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class Give_Shortcode_Donation_Form_Goal |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | 22 | |
23 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
24 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
23 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_goal' ); |
|
26 | + parent::__construct('give_goal'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | $create_form_link = sprintf( |
37 | 37 | /* translators: %s: create new form URL */ |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,35 +46,35 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
49 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ), |
|
52 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_text', |
63 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
64 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
63 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
64 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => esc_html__( 'Show', 'give' ), |
|
67 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
66 | + 'true' => esc_html__('Show', 'give'), |
|
67 | + 'false' => esc_html__('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_bar', |
73 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
74 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
73 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
74 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => esc_html__( 'Show', 'give' ), |
|
77 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
76 | + 'true' => esc_html__('Show', 'give'), |
|
77 | + 'false' => esc_html__('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | 38 | /* translators: %s: create new form URL */ |
39 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
40 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
39 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
40 | + admin_url('post-new.php?post_type=give_forms') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | return array( |
@@ -47,68 +47,68 @@ discard block |
||
47 | 47 | 'post_type' => 'give_forms', |
48 | 48 | ), |
49 | 49 | 'name' => 'id', |
50 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
51 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
50 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
51 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
52 | 52 | 'required' => array( |
53 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
54 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ), |
|
53 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
54 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'container', |
59 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
59 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'type' => 'listbox', |
63 | 63 | 'name' => 'show_title', |
64 | - 'label' => esc_attr__( 'Show Title:', 'give' ), |
|
65 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
64 | + 'label' => esc_attr__('Show Title:', 'give'), |
|
65 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
66 | 66 | 'options' => array( |
67 | - 'true' => esc_html__( 'Show', 'give' ), |
|
68 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
67 | + 'true' => esc_html__('Show', 'give'), |
|
68 | + 'false' => esc_html__('Hide', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'type' => 'listbox', |
73 | 73 | 'name' => 'show_goal', |
74 | - 'label' => esc_attr__( 'Show Goal:', 'give' ), |
|
75 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
74 | + 'label' => esc_attr__('Show Goal:', 'give'), |
|
75 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'show_content', |
84 | 84 | 'minWidth' => 240, |
85 | - 'label' => esc_attr__( 'Display Content:', 'give' ), |
|
86 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
85 | + 'label' => esc_attr__('Display Content:', 'give'), |
|
86 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
87 | 87 | 'options' => array( |
88 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
89 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
90 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
88 | + 'none' => esc_html__('No Content', 'give'), |
|
89 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
90 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | array( |
94 | 94 | 'type' => 'listbox', |
95 | 95 | 'name' => 'display_style', |
96 | - 'label' => esc_attr__( 'Payment Fields:', 'give' ), |
|
97 | - 'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ), |
|
96 | + 'label' => esc_attr__('Payment Fields:', 'give'), |
|
97 | + 'tooltip' => esc_attr__('How would you like to display payment information?', 'give'), |
|
98 | 98 | 'options' => array( |
99 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
100 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
101 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
99 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
100 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
101 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'listbox', |
106 | 106 | 'name' => 'float_labels', |
107 | - 'label' => esc_attr__( 'Floating Labels:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Override the default floating labels setting for this form.', 'give' ), |
|
107 | + 'label' => esc_attr__('Floating Labels:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Override the default floating labels setting for this form.', 'give'), |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
111 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
110 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
111 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => esc_html__( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => esc_html__( 'Email', 'give' ), |
|
45 | - 'first' => esc_html__( 'First Name', 'give' ), |
|
46 | - 'last' => esc_html__( 'Last Name', 'give' ), |
|
47 | - 'address1' => esc_html__( 'Address 1', 'give' ), |
|
48 | - 'address2' => esc_html__( 'Address 2', 'give' ), |
|
49 | - 'city' => esc_html__( 'City', 'give' ), |
|
50 | - 'state' => esc_html__( 'State', 'give' ), |
|
51 | - 'country' => esc_html__( 'Country', 'give' ), |
|
52 | - 'zip' => esc_html__( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => esc_html__( 'Form ID', 'give' ), |
|
54 | - 'form_name' => esc_html__( 'Form Name', 'give' ), |
|
55 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
56 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
58 | - 'key' => esc_html__( 'Purchase Key', 'give' ), |
|
59 | - 'date' => esc_html__( 'Date', 'give' ), |
|
60 | - 'user' => esc_html__( 'User', 'give' ), |
|
61 | - 'status' => esc_html__( 'Status', 'give' ) |
|
42 | + 'id' => esc_html__('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => esc_html__('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => esc_html__('Email', 'give'), |
|
45 | + 'first' => esc_html__('First Name', 'give'), |
|
46 | + 'last' => esc_html__('Last Name', 'give'), |
|
47 | + 'address1' => esc_html__('Address 1', 'give'), |
|
48 | + 'address2' => esc_html__('Address 2', 'give'), |
|
49 | + 'city' => esc_html__('City', 'give'), |
|
50 | + 'state' => esc_html__('State', 'give'), |
|
51 | + 'country' => esc_html__('Country', 'give'), |
|
52 | + 'zip' => esc_html__('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => esc_html__('Form ID', 'give'), |
|
54 | + 'form_name' => esc_html__('Form Name', 'give'), |
|
55 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
56 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
57 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
58 | + 'key' => esc_html__('Purchase Key', 'give'), |
|
59 | + 'date' => esc_html__('Date', 'give'), |
|
60 | + 'user' => esc_html__('User', 'give'), |
|
61 | + 'status' => esc_html__('Status', 'give') |
|
62 | 62 | ); |
63 | 63 | |
64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
65 | - unset( $cols['seq_id'] ); |
|
64 | + if ( ! give_get_option('enable_sequential')) { |
|
65 | + unset($cols['seq_id']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -101,52 +101,52 @@ discard block |
||
101 | 101 | |
102 | 102 | //echo json_encode($args ); exit; |
103 | 103 | |
104 | - $payments = give_get_payments( $args ); |
|
104 | + $payments = give_get_payments($args); |
|
105 | 105 | |
106 | - if ( $payments ) { |
|
106 | + if ($payments) { |
|
107 | 107 | |
108 | - foreach ( $payments as $payment ) { |
|
109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
111 | - $total = give_get_payment_amount( $payment->ID ); |
|
112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
108 | + foreach ($payments as $payment) { |
|
109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
111 | + $total = give_get_payment_amount($payment->ID); |
|
112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
113 | 113 | $products = ''; |
114 | 114 | $skus = ''; |
115 | 115 | |
116 | - if ( is_numeric( $user_id ) ) { |
|
117 | - $user = get_userdata( $user_id ); |
|
116 | + if (is_numeric($user_id)) { |
|
117 | + $user = get_userdata($user_id); |
|
118 | 118 | } else { |
119 | 119 | $user = false; |
120 | 120 | } |
121 | 121 | |
122 | 122 | $data[] = array( |
123 | 123 | 'id' => $payment->ID, |
124 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
124 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
125 | 125 | 'email' => $payment_meta['email'], |
126 | 126 | 'first' => $user_info['first_name'], |
127 | 127 | 'last' => $user_info['last_name'], |
128 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
129 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
130 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
131 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
132 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
133 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
134 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
135 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
128 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
129 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
130 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
131 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
132 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
133 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
134 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
135 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
136 | 136 | 'skus' => $skus, |
137 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
138 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
139 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
137 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
138 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
139 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
140 | 140 | 'key' => $payment_meta['key'], |
141 | 141 | 'date' => $payment->post_date, |
142 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
143 | - 'status' => give_get_payment_status( $payment, true ) |
|
142 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
143 | + 'status' => give_get_payment_status($payment, true) |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | } |
147 | 147 | |
148 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
149 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
148 | + $data = apply_filters('give_export_get_data', $data); |
|
149 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
150 | 150 | |
151 | 151 | return $data; |
152 | 152 | |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | |
167 | 167 | $status = $this->status; |
168 | 168 | $args = array( |
169 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
170 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
169 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
170 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
171 | 171 | ); |
172 | 172 | |
173 | - if ( 'any' == $status ) { |
|
173 | + if ('any' == $status) { |
|
174 | 174 | |
175 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
175 | + $total = array_sum((array) give_count_payments($args)); |
|
176 | 176 | |
177 | 177 | } else { |
178 | 178 | |
179 | - $total = give_count_payments( $args )->$status; |
|
179 | + $total = give_count_payments($args)->$status; |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
183 | 183 | $percentage = 100; |
184 | 184 | |
185 | - if ( $total > 0 ) { |
|
186 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
185 | + if ($total > 0) { |
|
186 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
187 | 187 | } |
188 | 188 | |
189 | - if ( $percentage > 100 ) { |
|
189 | + if ($percentage > 100) { |
|
190 | 190 | $percentage = 100; |
191 | 191 | } |
192 | 192 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param array $request The Form Data passed into the batch processing. |
202 | 202 | */ |
203 | - public function set_properties( $request ) { |
|
204 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
205 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
206 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
203 | + public function set_properties($request) { |
|
204 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
205 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
206 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
207 | 207 | } |
208 | 208 | } |