@@ -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,15 +118,15 @@ 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. |
|
| 124 | - 'ajax' => false, // Does this table support ajax? |
|
| 125 | - ) ); |
|
| 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 | + 'ajax' => false, // Does this table support ajax? |
|
| 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 | /** |
@@ -135,25 +135,25 @@ discard block |
||
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | 137 | public function advanced_filters() { |
| 138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 141 | 141 | ?> |
| 142 | 142 | <div id="give-payment-filters"> |
| 143 | 143 | <span id="give-payment-date-filters"> |
| 144 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 144 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 145 | 145 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
| 146 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 146 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 147 | 147 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
| 148 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
| 148 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
| 149 | 149 | </span> |
| 150 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 151 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
| 150 | + <?php if ( ! empty($status)) : ?> |
|
| 151 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
| 152 | 152 | <?php endif; ?> |
| 153 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
| 154 | - <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> |
|
| 153 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
| 154 | + <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> |
|
| 155 | 155 | <?php endif; ?> |
| 156 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 156 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 157 | 157 | </div> |
| 158 | 158 | |
| 159 | 159 | <?php |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | - public function search_box( $text, $input_id ) { |
|
| 174 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 173 | + public function search_box($text, $input_id) { |
|
| 174 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 175 | 175 | return; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $input_id = $input_id . '-search-input'; |
|
| 178 | + $input_id = $input_id.'-search-input'; |
|
| 179 | 179 | |
| 180 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 181 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 180 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 181 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 182 | 182 | } |
| 183 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 184 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 183 | + if ( ! empty($_REQUEST['order'])) { |
|
| 184 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 185 | 185 | } |
| 186 | 186 | ?> |
| 187 | 187 | <p class="search-box" role="search"> |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @since 1.7 |
| 195 | 195 | */ |
| 196 | - do_action( 'give_payment_history_search' ); |
|
| 196 | + do_action('give_payment_history_search'); |
|
| 197 | 197 | ?> |
| 198 | 198 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 199 | 199 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 200 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
| 200 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
| 201 | 201 | </p> |
| 202 | 202 | <?php |
| 203 | 203 | } |
@@ -211,52 +211,52 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function get_views() { |
| 213 | 213 | |
| 214 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 215 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 216 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 217 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 218 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 219 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 220 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 221 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 222 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 214 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 215 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 216 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 217 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 218 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 219 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 220 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 221 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 222 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 223 | 223 | |
| 224 | 224 | $views = array( |
| 225 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 225 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 226 | 226 | 'status', |
| 227 | 227 | 'paged', |
| 228 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 229 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 228 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 229 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 230 | 230 | 'status' => 'publish', |
| 231 | 231 | 'paged' => false, |
| 232 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 233 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 232 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 233 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 234 | 234 | 'status' => 'pending', |
| 235 | 235 | 'paged' => false, |
| 236 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 237 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 236 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 237 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 238 | 238 | 'status' => 'refunded', |
| 239 | 239 | 'paged' => false, |
| 240 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 241 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 240 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 241 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 242 | 242 | 'status' => 'revoked', |
| 243 | 243 | 'paged' => false, |
| 244 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 245 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 244 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 245 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 246 | 246 | 'status' => 'failed', |
| 247 | 247 | 'paged' => false, |
| 248 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 249 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 248 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 249 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 250 | 250 | 'status' => 'cancelled', |
| 251 | 251 | 'paged' => false, |
| 252 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 253 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 252 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 253 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 254 | 254 | 'status' => 'abandoned', |
| 255 | 255 | 'paged' => false, |
| 256 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
| 256 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 259 | + return apply_filters('give_payments_table_views', $views); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -269,15 +269,15 @@ discard block |
||
| 269 | 269 | public function get_columns() { |
| 270 | 270 | $columns = array( |
| 271 | 271 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 272 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 273 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 274 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 275 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 276 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 277 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 272 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 273 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 274 | + 'status' => esc_html__('Status', 'give'), |
|
| 275 | + 'date' => esc_html__('Date', 'give'), |
|
| 276 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 277 | + 'details' => esc_html__('Details', 'give'), |
|
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 280 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -289,14 +289,14 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function get_sortable_columns() { |
| 291 | 291 | $columns = array( |
| 292 | - 'donation' => array( 'ID', true ), |
|
| 293 | - 'donation_form' => array( 'donation_form', false ), |
|
| 294 | - 'status' => array( 'status', false ), |
|
| 295 | - 'amount' => array( 'amount', false ), |
|
| 296 | - 'date' => array( 'date', false ), |
|
| 292 | + 'donation' => array('ID', true), |
|
| 293 | + 'donation_form' => array('donation_form', false), |
|
| 294 | + 'status' => array('status', false), |
|
| 295 | + 'amount' => array('amount', false), |
|
| 296 | + 'date' => array('date', false), |
|
| 297 | 297 | ); |
| 298 | 298 | |
| 299 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 299 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -322,65 +322,65 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return string Column Name |
| 324 | 324 | */ |
| 325 | - public function column_default( $payment, $column_name ) { |
|
| 325 | + public function column_default($payment, $column_name) { |
|
| 326 | 326 | |
| 327 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
| 328 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 327 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
| 328 | + $row_actions = $this->get_row_actions($payment); |
|
| 329 | 329 | |
| 330 | - switch ( $column_name ) { |
|
| 330 | + switch ($column_name) { |
|
| 331 | 331 | case 'donation' : |
| 332 | 332 | $value = sprintf( |
| 333 | 333 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
| 334 | 334 | $single_donation_url, |
| 335 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ), |
|
| 335 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID), |
|
| 336 | 336 | $payment->ID, |
| 337 | - esc_html__( 'by', 'give' ), |
|
| 338 | - $this->get_donor( $payment ) |
|
| 337 | + esc_html__('by', 'give'), |
|
| 338 | + $this->get_donor($payment) |
|
| 339 | 339 | ); |
| 340 | - $value .= $this->get_donor_email( $payment ); |
|
| 341 | - $value .= $this->row_actions( $row_actions ); |
|
| 340 | + $value .= $this->get_donor_email($payment); |
|
| 341 | + $value .= $this->row_actions($row_actions); |
|
| 342 | 342 | break; |
| 343 | 343 | |
| 344 | 344 | case 'amount' : |
| 345 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 346 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 345 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 346 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 347 | 347 | break; |
| 348 | 348 | |
| 349 | 349 | case 'donation_form' : |
| 350 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 351 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 352 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 350 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 351 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 352 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 353 | 353 | |
| 354 | - if ( ! empty( $level ) ) { |
|
| 354 | + if ( ! empty($level)) { |
|
| 355 | 355 | $value .= $level; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | break; |
| 359 | 359 | |
| 360 | 360 | case 'date' : |
| 361 | - $date = strtotime( $payment->date ); |
|
| 362 | - $value = date_i18n( give_date_format(), $date ); |
|
| 361 | + $date = strtotime($payment->date); |
|
| 362 | + $value = date_i18n(give_date_format(), $date); |
|
| 363 | 363 | break; |
| 364 | 364 | |
| 365 | 365 | case 'status' : |
| 366 | - $value = $this->get_payment_status( $payment ); |
|
| 366 | + $value = $this->get_payment_status($payment); |
|
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'details' : |
| 370 | 370 | $value = sprintf( |
| 371 | 371 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
| 372 | 372 | $single_donation_url, |
| 373 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ) |
|
| 373 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID) |
|
| 374 | 374 | ); |
| 375 | 375 | break; |
| 376 | 376 | |
| 377 | 377 | default: |
| 378 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 378 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 379 | 379 | break; |
| 380 | 380 | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 383 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -393,17 +393,17 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return string Data shown in the Email column |
| 395 | 395 | */ |
| 396 | - public function get_donor_email( $payment ) { |
|
| 396 | + public function get_donor_email($payment) { |
|
| 397 | 397 | |
| 398 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 398 | + $email = give_get_payment_user_email($payment->ID); |
|
| 399 | 399 | |
| 400 | - if ( empty( $email ) ) { |
|
| 401 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 400 | + if (empty($email)) { |
|
| 401 | + $email = esc_html__('(unknown)', 'give'); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 404 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 405 | 405 | |
| 406 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 406 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -415,18 +415,18 @@ discard block |
||
| 415 | 415 | * |
| 416 | 416 | * @return mixed|void |
| 417 | 417 | */ |
| 418 | - function get_row_actions( $payment ) { |
|
| 418 | + function get_row_actions($payment) { |
|
| 419 | 419 | |
| 420 | 420 | $actions = array(); |
| 421 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 421 | + $email = give_get_payment_user_email($payment->ID); |
|
| 422 | 422 | |
| 423 | 423 | // Add search term string back to base URL. |
| 424 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 425 | - if ( ! empty( $search_terms ) ) { |
|
| 426 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 424 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 425 | + if ( ! empty($search_terms)) { |
|
| 426 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 429 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 430 | 430 | |
| 431 | 431 | $actions['email_links'] = sprintf( |
| 432 | 432 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | ), |
| 441 | 441 | 'give_payment_nonce' |
| 442 | 442 | ), |
| 443 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
| 444 | - esc_html__( 'Resend Receipt', 'give' ) |
|
| 443 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
| 444 | + esc_html__('Resend Receipt', 'give') |
|
| 445 | 445 | ); |
| 446 | 446 | |
| 447 | 447 | } |
@@ -458,11 +458,11 @@ discard block |
||
| 458 | 458 | ), |
| 459 | 459 | 'give_donation_nonce' |
| 460 | 460 | ), |
| 461 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
| 462 | - esc_html__( 'Delete', 'give' ) |
|
| 461 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
| 462 | + esc_html__('Delete', 'give') |
|
| 463 | 463 | ); |
| 464 | 464 | |
| 465 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 465 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | * |
| 477 | 477 | * @return string Data shown in the Email column |
| 478 | 478 | */ |
| 479 | - function get_payment_status( $payment ) { |
|
| 480 | - $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>'; |
|
| 481 | - if ( $payment->mode == 'test' ) { |
|
| 482 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 479 | + function get_payment_status($payment) { |
|
| 480 | + $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>'; |
|
| 481 | + if ($payment->mode == 'test') { |
|
| 482 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | return $value; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @return string Displays a checkbox. |
| 497 | 497 | */ |
| 498 | - public function column_cb( $payment ) { |
|
| 498 | + public function column_cb($payment) { |
|
| 499 | 499 | return sprintf( |
| 500 | 500 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
| 501 | 501 | 'payment', |
@@ -513,8 +513,8 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @return string Displays a checkbox. |
| 515 | 515 | */ |
| 516 | - public function get_payment_id( $payment ) { |
|
| 517 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 516 | + public function get_payment_id($payment) { |
|
| 517 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -527,19 +527,19 @@ discard block |
||
| 527 | 527 | * |
| 528 | 528 | * @return string Data shown in the User column |
| 529 | 529 | */ |
| 530 | - public function get_donor( $payment ) { |
|
| 530 | + public function get_donor($payment) { |
|
| 531 | 531 | |
| 532 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
| 532 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
| 533 | 533 | |
| 534 | - if ( ! empty( $customer_id ) ) { |
|
| 535 | - $customer = new Give_Customer( $customer_id ); |
|
| 536 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
| 534 | + if ( ! empty($customer_id)) { |
|
| 535 | + $customer = new Give_Customer($customer_id); |
|
| 536 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
| 537 | 537 | } else { |
| 538 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 539 | - $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>'; |
|
| 538 | + $email = give_get_payment_user_email($payment->ID); |
|
| 539 | + $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>'; |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 542 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -551,18 +551,18 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function get_bulk_actions() { |
| 553 | 553 | $actions = array( |
| 554 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
| 555 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
| 556 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
| 557 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
| 558 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
| 559 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
| 560 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
| 561 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
| 562 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
| 554 | + 'delete' => esc_html__('Delete', 'give'), |
|
| 555 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
| 556 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
| 557 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
| 558 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
| 559 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
| 560 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
| 561 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
| 562 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | /** |
@@ -573,59 +573,59 @@ discard block |
||
| 573 | 573 | * @return void |
| 574 | 574 | */ |
| 575 | 575 | public function process_bulk_action() { |
| 576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 577 | 577 | $action = $this->current_action(); |
| 578 | 578 | |
| 579 | - if ( ! is_array( $ids ) ) { |
|
| 580 | - $ids = array( $ids ); |
|
| 579 | + if ( ! is_array($ids)) { |
|
| 580 | + $ids = array($ids); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - if ( empty( $action ) ) { |
|
| 583 | + if (empty($action)) { |
|
| 584 | 584 | return; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - foreach ( $ids as $id ) { |
|
| 587 | + foreach ($ids as $id) { |
|
| 588 | 588 | |
| 589 | 589 | // Detect when a bulk action is being triggered. |
| 590 | - switch ( $this->current_action() ) { |
|
| 590 | + switch ($this->current_action()) { |
|
| 591 | 591 | |
| 592 | 592 | case'delete': |
| 593 | - give_delete_purchase( $id ); |
|
| 593 | + give_delete_purchase($id); |
|
| 594 | 594 | break; |
| 595 | 595 | |
| 596 | 596 | case 'set-status-publish': |
| 597 | - give_update_payment_status( $id, 'publish' ); |
|
| 597 | + give_update_payment_status($id, 'publish'); |
|
| 598 | 598 | break; |
| 599 | 599 | |
| 600 | 600 | case 'set-status-pending': |
| 601 | - give_update_payment_status( $id, 'pending' ); |
|
| 601 | + give_update_payment_status($id, 'pending'); |
|
| 602 | 602 | break; |
| 603 | 603 | |
| 604 | 604 | case 'set-status-refunded': |
| 605 | - give_update_payment_status( $id, 'refunded' ); |
|
| 605 | + give_update_payment_status($id, 'refunded'); |
|
| 606 | 606 | break; |
| 607 | 607 | case 'set-status-revoked': |
| 608 | - give_update_payment_status( $id, 'revoked' ); |
|
| 608 | + give_update_payment_status($id, 'revoked'); |
|
| 609 | 609 | break; |
| 610 | 610 | |
| 611 | 611 | case 'set-status-failed': |
| 612 | - give_update_payment_status( $id, 'failed' ); |
|
| 612 | + give_update_payment_status($id, 'failed'); |
|
| 613 | 613 | break; |
| 614 | 614 | |
| 615 | 615 | case 'set-status-cancelled': |
| 616 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 616 | + give_update_payment_status($id, 'cancelled'); |
|
| 617 | 617 | break; |
| 618 | 618 | |
| 619 | 619 | case 'set-status-abandoned': |
| 620 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 620 | + give_update_payment_status($id, 'abandoned'); |
|
| 621 | 621 | break; |
| 622 | 622 | |
| 623 | 623 | case 'set-status-preapproval': |
| 624 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 624 | + give_update_payment_status($id, 'preapproval'); |
|
| 625 | 625 | break; |
| 626 | 626 | |
| 627 | 627 | case 'resend-receipt': |
| 628 | - give_email_donation_receipt( $id, false ); |
|
| 628 | + give_email_donation_receipt($id, false); |
|
| 629 | 629 | break; |
| 630 | 630 | } |
| 631 | 631 | |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | * @param int $id The ID of the payment. |
| 638 | 638 | * @param string $current_action The action that is being triggered. |
| 639 | 639 | */ |
| 640 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 640 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | } |
@@ -653,27 +653,27 @@ discard block |
||
| 653 | 653 | |
| 654 | 654 | $args = array(); |
| 655 | 655 | |
| 656 | - if ( isset( $_GET['user'] ) ) { |
|
| 657 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 658 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 659 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 660 | - if ( $is_user ) { |
|
| 661 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 662 | - unset( $args['s'] ); |
|
| 656 | + if (isset($_GET['user'])) { |
|
| 657 | + $args['user'] = urldecode($_GET['user']); |
|
| 658 | + } elseif (isset($_GET['s'])) { |
|
| 659 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 660 | + if ($is_user) { |
|
| 661 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 662 | + unset($args['s']); |
|
| 663 | 663 | } else { |
| 664 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 664 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 669 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 668 | + if ( ! empty($_GET['start-date'])) { |
|
| 669 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 673 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 672 | + if ( ! empty($_GET['end-date'])) { |
|
| 673 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | - $payment_count = give_count_payments( $args ); |
|
| 676 | + $payment_count = give_count_payments($args); |
|
| 677 | 677 | $this->complete_count = $payment_count->publish; |
| 678 | 678 | $this->pending_count = $payment_count->pending; |
| 679 | 679 | $this->refunded_count = $payment_count->refunded; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $this->cancelled_count = $payment_count->cancelled; |
| 683 | 683 | $this->abandoned_count = $payment_count->abandoned; |
| 684 | 684 | |
| 685 | - foreach ( $payment_count as $count ) { |
|
| 685 | + foreach ($payment_count as $count) { |
|
| 686 | 686 | $this->total_count += $count; |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -697,26 +697,26 @@ discard block |
||
| 697 | 697 | public function payments_data() { |
| 698 | 698 | |
| 699 | 699 | $per_page = $this->per_page; |
| 700 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 701 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 702 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 703 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 704 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 705 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 706 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 707 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 708 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 709 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 710 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 711 | - |
|
| 712 | - if ( ! empty( $search ) ) { |
|
| 700 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 701 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 702 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 703 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 704 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 705 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 706 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 707 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 708 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 709 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 710 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 711 | + |
|
| 712 | + if ( ! empty($search)) { |
|
| 713 | 713 | $status = 'any'; // Force all payment statuses when searching. |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | $args = array( |
| 717 | 717 | 'output' => 'payments', |
| 718 | 718 | 'number' => $per_page, |
| 719 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 719 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 720 | 720 | 'orderby' => $orderby, |
| 721 | 721 | 'order' => $order, |
| 722 | 722 | 'user' => $user, |
@@ -730,14 +730,14 @@ discard block |
||
| 730 | 730 | 'end_date' => $end_date, |
| 731 | 731 | ); |
| 732 | 732 | |
| 733 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 733 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 734 | 734 | |
| 735 | 735 | $args['search_in_notes'] = true; |
| 736 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 736 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 737 | 737 | |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - $p_query = new Give_Payments_Query( $args ); |
|
| 740 | + $p_query = new Give_Payments_Query($args); |
|
| 741 | 741 | |
| 742 | 742 | return $p_query->get_payments(); |
| 743 | 743 | |
@@ -757,17 +757,17 @@ discard block |
||
| 757 | 757 | */ |
| 758 | 758 | public function prepare_items() { |
| 759 | 759 | |
| 760 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 760 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 761 | 761 | |
| 762 | 762 | $columns = $this->get_columns(); |
| 763 | 763 | $hidden = array(); // No hidden columns. |
| 764 | 764 | $sortable = $this->get_sortable_columns(); |
| 765 | 765 | $data = $this->payments_data(); |
| 766 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 766 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 767 | 767 | |
| 768 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 768 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 769 | 769 | |
| 770 | - switch ( $status ) { |
|
| 770 | + switch ($status) { |
|
| 771 | 771 | case 'publish': |
| 772 | 772 | $total_items = $this->complete_count; |
| 773 | 773 | break; |
@@ -794,19 +794,19 @@ discard block |
||
| 794 | 794 | break; |
| 795 | 795 | default: |
| 796 | 796 | // Retrieve the count of the non-default-Give status. |
| 797 | - $count = wp_count_posts( 'give_payment' ); |
|
| 797 | + $count = wp_count_posts('give_payment'); |
|
| 798 | 798 | $total_items = $count->{$status}; |
| 799 | 799 | break; |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | $this->items = $data; |
| 803 | 803 | |
| 804 | - $this->set_pagination_args( array( |
|
| 804 | + $this->set_pagination_args(array( |
|
| 805 | 805 | 'total_items' => $total_items, |
| 806 | 806 | // We have to calculate the total number of items. |
| 807 | 807 | 'per_page' => $this->per_page, |
| 808 | 808 | // We have to determine how many items to show on a page. |
| 809 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 809 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 810 | 810 | // We have to calculate the total number of pages. |
| 811 | 811 | ) |
| 812 | 812 | ); |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Setup the variables |
| 28 | -$payment_id = absint( $_GET['id'] ); |
|
| 29 | -$payment = new Give_Payment( $payment_id ); |
|
| 28 | +$payment_id = absint($_GET['id']); |
|
| 29 | +$payment = new Give_Payment($payment_id); |
|
| 30 | 30 | |
| 31 | 31 | // Sanity check... fail if donation ID is invalid |
| 32 | 32 | $payment_exists = $payment->ID; |
| 33 | -if ( empty( $payment_exists ) ) { |
|
| 34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 33 | +if (empty($payment_exists)) { |
|
| 34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $number = $payment->number; |
| 38 | 38 | $payment_meta = $payment->get_meta(); |
| 39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 40 | 40 | $user_id = $payment->user_id; |
| 41 | 41 | $customer_id = $payment->customer_id; |
| 42 | -$payment_date = strtotime( $payment->date ); |
|
| 43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 42 | +$payment_date = strtotime($payment->date); |
|
| 43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 44 | 44 | $address = $payment->address; |
| 45 | 45 | $gateway = $payment->gateway; |
| 46 | 46 | $currency_code = $payment->currency; |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | <h1 id="transaction-details-heading"><?php |
| 54 | 54 | printf( |
| 55 | 55 | /* translators: %s: donation number */ |
| 56 | - esc_html__( 'Donation %s', 'give' ), |
|
| 56 | + esc_html__('Donation %s', 'give'), |
|
| 57 | 57 | $number |
| 58 | 58 | ); |
| 59 | - if ( $payment_mode == 'test' ) { |
|
| 60 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
| 59 | + if ($payment_mode == 'test') { |
|
| 60 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
| 61 | 61 | } |
| 62 | 62 | ?></h1> |
| 63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @param int $payment_id Payment id. |
| 71 | 71 | */ |
| 72 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
| 72 | + do_action('give_view_order_details_before', $payment_id); |
|
| 73 | 73 | ?> |
| 74 | 74 | <form id="give-edit-order-form" method="post"> |
| 75 | 75 | <?php |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param int $payment_id Payment id. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
| 83 | + do_action('give_view_order_details_form_top', $payment_id); |
|
| 84 | 84 | ?> |
| 85 | 85 | <div id="poststuff"> |
| 86 | 86 | <div id="give-dashboard-widgets-wrap"> |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @param int $payment_id Payment id. |
| 98 | 98 | */ |
| 99 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
| 99 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
| 100 | 100 | ?> |
| 101 | 101 | |
| 102 | 102 | <div id="give-order-update" class="postbox give-order-data"> |
| 103 | 103 | |
| 104 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
| 104 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
| 105 | 105 | |
| 106 | 106 | <div class="inside"> |
| 107 | 107 | <div class="give-admin-box"> |
@@ -114,33 +114,33 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @param int $payment_id Payment id. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
| 117 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <div class="give-admin-box-inside"> |
| 121 | 121 | <p> |
| 122 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 122 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 123 | 123 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 124 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 125 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 124 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 125 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 126 | 126 | <?php endforeach; ?> |
| 127 | 127 | </select> |
| 128 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 128 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 129 | 129 | </p> |
| 130 | 130 | </div> |
| 131 | 131 | |
| 132 | 132 | <div class="give-admin-box-inside"> |
| 133 | 133 | <p> |
| 134 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 135 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
| 134 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 135 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
| 136 | 136 | </p> |
| 137 | 137 | </div> |
| 138 | 138 | |
| 139 | 139 | <div class="give-admin-box-inside"> |
| 140 | 140 | <p> |
| 141 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 142 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
| 143 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
| 141 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 142 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
| 143 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
| 144 | 144 | </p> |
| 145 | 145 | </div> |
| 146 | 146 | |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @param int $payment_id Payment id. |
| 156 | 156 | */ |
| 157 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
| 157 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
| 158 | 158 | |
| 159 | 159 | // @TODO: Fees |
| 160 | - $fees = give_get_payment_fees( $payment_id ); |
|
| 161 | - if ( ! empty( $fees ) ) : ?> |
|
| 160 | + $fees = give_get_payment_fees($payment_id); |
|
| 161 | + if ( ! empty($fees)) : ?> |
|
| 162 | 162 | <div class="give-order-fees give-admin-box-inside"> |
| 163 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
| 163 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
| 164 | 164 | <ul class="give-payment-fees"> |
| 165 | - <?php foreach ( $fees as $fee ) : ?> |
|
| 165 | + <?php foreach ($fees as $fee) : ?> |
|
| 166 | 166 | <li> |
| 167 | 167 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
| 168 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
| 168 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
| 169 | 169 | </li> |
| 170 | 170 | <?php endforeach; ?> |
| 171 | 171 | </ul> |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | <div class="give-order-payment give-admin-box-inside"> |
| 176 | 176 | <p> |
| 177 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 178 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 179 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
| 177 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 178 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 179 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
| 180 | 180 | </p> |
| 181 | 181 | </div> |
| 182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @param int $payment_id Payment id. |
| 190 | 190 | */ |
| 191 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 191 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | </div> |
@@ -206,17 +206,17 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @param int $payment_id Payment id. |
| 208 | 208 | */ |
| 209 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 209 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 210 | 210 | ?> |
| 211 | 211 | |
| 212 | 212 | <div id="major-publishing-actions"> |
| 213 | 213 | <div id="publishing-action"> |
| 214 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 215 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 216 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 214 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 215 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 216 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 217 | 217 | 'give-action' => 'email_links', |
| 218 | 218 | 'purchase_id' => $payment_id, |
| 219 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 219 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 220 | 220 | <?php endif; ?> |
| 221 | 221 | </div> |
| 222 | 222 | <div class="clear"></div> |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @param int $payment_id Payment id. |
| 232 | 232 | */ |
| 233 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 233 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 234 | 234 | ?> |
| 235 | 235 | |
| 236 | 236 | </div> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | <div id="give-order-details" class="postbox give-order-data"> |
| 243 | 243 | |
| 244 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 244 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 245 | 245 | |
| 246 | 246 | <div class="inside"> |
| 247 | 247 | <div class="give-admin-box"> |
@@ -254,44 +254,44 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @param int $payment_id Payment id. |
| 256 | 256 | */ |
| 257 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 257 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 258 | 258 | |
| 259 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 260 | - if ( $gateway ) : ?> |
|
| 259 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 260 | + if ($gateway) : ?> |
|
| 261 | 261 | <div class="give-order-gateway give-admin-box-inside"> |
| 262 | 262 | <p> |
| 263 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 264 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 263 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 264 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 265 | 265 | </p> |
| 266 | 266 | </div> |
| 267 | 267 | <?php endif; ?> |
| 268 | 268 | |
| 269 | 269 | <div class="give-order-payment-key give-admin-box-inside"> |
| 270 | 270 | <p> |
| 271 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 272 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 271 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 272 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 273 | 273 | </p> |
| 274 | 274 | </div> |
| 275 | 275 | |
| 276 | 276 | <div class="give-order-ip give-admin-box-inside"> |
| 277 | 277 | <p> |
| 278 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 279 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 278 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 279 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 280 | 280 | </p> |
| 281 | 281 | </div> |
| 282 | 282 | |
| 283 | - <?php if ( $transaction_id ) : ?> |
|
| 283 | + <?php if ($transaction_id) : ?> |
|
| 284 | 284 | <div class="give-order-tx-id give-admin-box-inside"> |
| 285 | 285 | <p> |
| 286 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 287 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 286 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 287 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 288 | 288 | </p> |
| 289 | 289 | </div> |
| 290 | 290 | <?php endif; ?> |
| 291 | 291 | |
| 292 | 292 | <div class="give-admin-box-inside"> |
| 293 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
| 294 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 293 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
| 294 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 295 | 295 | </p> |
| 296 | 296 | </div> |
| 297 | 297 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @param int $payment_id Payment id. |
| 305 | 305 | */ |
| 306 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 306 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 307 | 307 | ?> |
| 308 | 308 | |
| 309 | 309 | </div> |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @param int $payment_id Payment id. |
| 325 | 325 | */ |
| 326 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 326 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 327 | 327 | ?> |
| 328 | 328 | |
| 329 | 329 | </div> |
@@ -343,55 +343,55 @@ discard block |
||
| 343 | 343 | * |
| 344 | 344 | * @param int $payment_id Payment id. |
| 345 | 345 | */ |
| 346 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 346 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 347 | 347 | ?> |
| 348 | 348 | |
| 349 | 349 | <?php $column_count = 'columns-3'; ?> |
| 350 | 350 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 351 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 351 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 352 | 352 | |
| 353 | 353 | <div class="inside"> |
| 354 | 354 | |
| 355 | 355 | <div class="column-container"> |
| 356 | 356 | <div class="column"> |
| 357 | 357 | <p> |
| 358 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 358 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 359 | 359 | <?php |
| 360 | - if ( $payment_meta['form_id'] ) : |
|
| 360 | + if ($payment_meta['form_id']) : |
|
| 361 | 361 | printf( |
| 362 | 362 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 363 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 363 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 364 | 364 | $payment_meta['form_id'] |
| 365 | 365 | ); |
| 366 | 366 | endif; |
| 367 | 367 | ?> |
| 368 | 368 | </p> |
| 369 | 369 | <p> |
| 370 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 371 | - <?php give_get_form_dropdown( array( |
|
| 370 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 371 | + <?php give_get_form_dropdown(array( |
|
| 372 | 372 | 'id' => $payment_meta['form_id'], |
| 373 | 373 | 'selected' => $payment_meta['form_id'], |
| 374 | 374 | 'chosen' => true, |
| 375 | - ), true ); ?> |
|
| 375 | + ), true); ?> |
|
| 376 | 376 | </p> |
| 377 | 377 | </div> |
| 378 | 378 | <div class="column"> |
| 379 | 379 | <p> |
| 380 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 381 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 380 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 381 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 382 | 382 | </p> |
| 383 | 383 | <p> |
| 384 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 384 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 385 | 385 | <span class="give-donation-level"> |
| 386 | 386 | <?php |
| 387 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 388 | - if ( empty( $var_prices ) ) { |
|
| 389 | - esc_html_e( 'n/a', 'give' ); |
|
| 387 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 388 | + if (empty($var_prices)) { |
|
| 389 | + esc_html_e('n/a', 'give'); |
|
| 390 | 390 | } else { |
| 391 | 391 | $prices_atts = ''; |
| 392 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 393 | - foreach ( $variable_prices as $variable_price ) { |
|
| 394 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
| 392 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 393 | + foreach ($variable_prices as $variable_price) { |
|
| 394 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | // Variable price dropdown options. |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | 'chosen' => true, |
| 402 | 402 | 'show_option_all' => '', |
| 403 | 403 | 'show_option_none' => '', |
| 404 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
| 404 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
| 405 | 405 | 'selected' => $payment_meta['price_id'], |
| 406 | 406 | ); |
| 407 | 407 | // Render variable prices select tag html. |
| 408 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 408 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 409 | 409 | } |
| 410 | 410 | ?> |
| 411 | 411 | </span> |
@@ -413,8 +413,8 @@ discard block |
||
| 413 | 413 | </div> |
| 414 | 414 | <div class="column"> |
| 415 | 415 | <p> |
| 416 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 417 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
| 416 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 417 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
| 418 | 418 | </p> |
| 419 | 419 | <p> |
| 420 | 420 | <?php |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @param int $payment_id Payment id. |
| 429 | 429 | */ |
| 430 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 430 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 431 | 431 | |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @param int $payment_id Payment id. |
| 441 | 441 | */ |
| 442 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 442 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 443 | 443 | |
| 444 | 444 | /** |
| 445 | 445 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @param int $payment_id Payment id. |
| 452 | 452 | */ |
| 453 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 453 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | 456 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * |
| 462 | 462 | * @param int $payment_id Payment id. |
| 463 | 463 | */ |
| 464 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 464 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 465 | 465 | ?> |
| 466 | 466 | </p> |
| 467 | 467 | </div> |
@@ -481,57 +481,57 @@ discard block |
||
| 481 | 481 | * |
| 482 | 482 | * @param int $payment_id Payment id. |
| 483 | 483 | */ |
| 484 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 484 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 485 | 485 | ?> |
| 486 | 486 | |
| 487 | 487 | <div id="give-donor-details" class="postbox"> |
| 488 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 488 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 489 | 489 | |
| 490 | 490 | <div class="inside"> |
| 491 | 491 | |
| 492 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
| 492 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
| 493 | 493 | |
| 494 | 494 | <div class="column-container customer-info"> |
| 495 | 495 | <div class="column"> |
| 496 | 496 | <p> |
| 497 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 497 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 498 | 498 | <?php |
| 499 | - if ( ! empty( $customer->id ) ) { |
|
| 499 | + if ( ! empty($customer->id)) { |
|
| 500 | 500 | printf( |
| 501 | 501 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 502 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
| 502 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
| 503 | 503 | $customer->id |
| 504 | 504 | ); |
| 505 | 505 | } |
| 506 | 506 | ?> |
| 507 | 507 | </p> |
| 508 | 508 | <p> |
| 509 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 510 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
| 509 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 510 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
| 511 | 511 | </p> |
| 512 | 512 | </div> |
| 513 | 513 | <div class="column"> |
| 514 | 514 | <p> |
| 515 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 515 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 516 | 516 | <?php echo $customer->name; ?> |
| 517 | 517 | </p> |
| 518 | 518 | <p> |
| 519 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 519 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 520 | 520 | <?php echo $customer->email; ?> |
| 521 | 521 | </p> |
| 522 | 522 | </div> |
| 523 | 523 | <div class="column"> |
| 524 | 524 | <p> |
| 525 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 525 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 526 | 526 | <?php |
| 527 | - echo Give()->html->donor_dropdown( array( |
|
| 527 | + echo Give()->html->donor_dropdown(array( |
|
| 528 | 528 | 'selected' => $customer->id, |
| 529 | 529 | 'name' => 'customer-id', |
| 530 | - ) ); |
|
| 530 | + )); |
|
| 531 | 531 | ?> |
| 532 | 532 | </p> |
| 533 | 533 | <p> |
| 534 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 534 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 535 | 535 | </p> |
| 536 | 536 | </div> |
| 537 | 537 | </div> |
@@ -539,13 +539,13 @@ discard block |
||
| 539 | 539 | <div class="column-container new-customer" style="display: none"> |
| 540 | 540 | <div class="column"> |
| 541 | 541 | <p> |
| 542 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 542 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 543 | 543 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
| 544 | 544 | </p> |
| 545 | 545 | </div> |
| 546 | 546 | <div class="column"> |
| 547 | 547 | <p> |
| 548 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 548 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 549 | 549 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
| 550 | 550 | </p> |
| 551 | 551 | </div> |
@@ -553,9 +553,9 @@ discard block |
||
| 553 | 553 | <p> |
| 554 | 554 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
| 555 | 555 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
| 556 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 556 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 557 | 557 | <br> |
| 558 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 558 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 559 | 559 | </p> |
| 560 | 560 | </div> |
| 561 | 561 | </div> |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | * @param array $payment_meta Payment meta. |
| 572 | 572 | * @param array $user_info User information. |
| 573 | 573 | */ |
| 574 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 574 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 575 | 575 | |
| 576 | 576 | /** |
| 577 | 577 | * Fires in order details page, in the donor-details metabox. |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @param int $payment_id Payment id. |
| 582 | 582 | */ |
| 583 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 583 | + do_action('give_payment_view_details', $payment_id); |
|
| 584 | 584 | ?> |
| 585 | 585 | |
| 586 | 586 | </div> |
@@ -596,11 +596,11 @@ discard block |
||
| 596 | 596 | * |
| 597 | 597 | * @param int $payment_id Payment id. |
| 598 | 598 | */ |
| 599 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 599 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 600 | 600 | ?> |
| 601 | 601 | |
| 602 | 602 | <div id="give-billing-details" class="postbox"> |
| 603 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 603 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 604 | 604 | |
| 605 | 605 | <div class="inside"> |
| 606 | 606 | |
@@ -610,57 +610,57 @@ discard block |
||
| 610 | 610 | <div class="data column-container"> |
| 611 | 611 | <div class="column"> |
| 612 | 612 | <div class="give-wrap-address-line1"> |
| 613 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 614 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 613 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 614 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 615 | 615 | </div> |
| 616 | 616 | <div class="give-wrap-address-line2"> |
| 617 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 618 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 617 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 618 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 619 | 619 | </div> |
| 620 | 620 | </div> |
| 621 | 621 | <div class="column"> |
| 622 | 622 | <div class="give-wrap-address-city"> |
| 623 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 624 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 623 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 624 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 625 | 625 | </div> |
| 626 | 626 | <div class="give-wrap-address-zip"> |
| 627 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 628 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 627 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 628 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 629 | 629 | |
| 630 | 630 | </div> |
| 631 | 631 | </div> |
| 632 | 632 | <div class="column"> |
| 633 | 633 | <div id="give-order-address-country-wrap"> |
| 634 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 634 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 635 | 635 | <?php |
| 636 | - echo Give()->html->select( array( |
|
| 636 | + echo Give()->html->select(array( |
|
| 637 | 637 | 'options' => give_get_country_list(), |
| 638 | 638 | 'name' => 'give-payment-address[0][country]', |
| 639 | 639 | 'selected' => $address['country'], |
| 640 | 640 | 'show_option_all' => false, |
| 641 | 641 | 'show_option_none' => false, |
| 642 | 642 | 'chosen' => true, |
| 643 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 644 | - ) ); |
|
| 643 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 644 | + )); |
|
| 645 | 645 | ?> |
| 646 | 646 | </div> |
| 647 | 647 | <div id="give-order-address-state-wrap"> |
| 648 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
| 648 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
| 649 | 649 | <?php |
| 650 | - $states = give_get_states( $address['country'] ); |
|
| 651 | - if ( ! empty( $states ) ) { |
|
| 652 | - echo Give()->html->select( array( |
|
| 650 | + $states = give_get_states($address['country']); |
|
| 651 | + if ( ! empty($states)) { |
|
| 652 | + echo Give()->html->select(array( |
|
| 653 | 653 | 'options' => $states, |
| 654 | 654 | 'name' => 'give-payment-address[0][state]', |
| 655 | 655 | 'selected' => $address['state'], |
| 656 | 656 | 'show_option_all' => false, |
| 657 | 657 | 'show_option_none' => false, |
| 658 | 658 | 'chosen' => true, |
| 659 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 660 | - ) ); |
|
| 659 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 660 | + )); |
|
| 661 | 661 | } else { |
| 662 | 662 | ?> |
| 663 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 663 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 664 | 664 | <?php |
| 665 | 665 | } ?> |
| 666 | 666 | </div> |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | * |
| 681 | 681 | * @param int $payment_id Payment id. |
| 682 | 682 | */ |
| 683 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 683 | + do_action('give_payment_billing_details', $payment_id); |
|
| 684 | 684 | ?> |
| 685 | 685 | |
| 686 | 686 | </div> |
@@ -696,32 +696,32 @@ discard block |
||
| 696 | 696 | * |
| 697 | 697 | * @param int $payment_id Payment id. |
| 698 | 698 | */ |
| 699 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 699 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 700 | 700 | ?> |
| 701 | 701 | |
| 702 | 702 | <div id="give-payment-notes" class="postbox"> |
| 703 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 703 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 704 | 704 | |
| 705 | 705 | <div class="inside"> |
| 706 | 706 | <div id="give-payment-notes-inner"> |
| 707 | 707 | <?php |
| 708 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 709 | - if ( ! empty( $notes ) ) { |
|
| 708 | + $notes = give_get_payment_notes($payment_id); |
|
| 709 | + if ( ! empty($notes)) { |
|
| 710 | 710 | $no_notes_display = ' style="display:none;"'; |
| 711 | - foreach ( $notes as $note ) : |
|
| 711 | + foreach ($notes as $note) : |
|
| 712 | 712 | |
| 713 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 713 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 714 | 714 | |
| 715 | 715 | endforeach; |
| 716 | 716 | } else { |
| 717 | 717 | $no_notes_display = ''; |
| 718 | 718 | } |
| 719 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
| 719 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
| 720 | 720 | </div> |
| 721 | 721 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 722 | 722 | |
| 723 | 723 | <div class="give-clearfix"> |
| 724 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
| 724 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
| 725 | 725 | </div> |
| 726 | 726 | |
| 727 | 727 | </div> |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | * |
| 738 | 738 | * @param int $payment_id Payment id. |
| 739 | 739 | */ |
| 740 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 740 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 741 | 741 | ?> |
| 742 | 742 | |
| 743 | 743 | </div> |
@@ -759,11 +759,11 @@ discard block |
||
| 759 | 759 | * |
| 760 | 760 | * @param int $payment_id Payment id. |
| 761 | 761 | */ |
| 762 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 762 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 763 | 763 | |
| 764 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 764 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 765 | 765 | ?> |
| 766 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 766 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 767 | 767 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 768 | 768 | </form> |
| 769 | 769 | <?php |
@@ -774,6 +774,6 @@ discard block |
||
| 774 | 774 | * |
| 775 | 775 | * @param int $payment_id Payment id. |
| 776 | 776 | */ |
| 777 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 777 | + do_action('give_view_order_details_after', $payment_id); |
|
| 778 | 778 | ?> |
| 779 | 779 | </div><!-- /.wrap --> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly. |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * 'testing' => false, // (required) Never leave as "true" in production!!! |
| 33 | 33 | * } |
| 34 | 34 | */ |
| 35 | - function __construct( $_banner_details ) { |
|
| 35 | + function __construct($_banner_details) { |
|
| 36 | 36 | $current_user = wp_get_current_user(); |
| 37 | 37 | |
| 38 | 38 | $this->plugin_activate_by = 0; |
| 39 | 39 | $this->banner_details = $_banner_details; |
| 40 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
| 41 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
| 42 | - $this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user'; |
|
| 40 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
| 41 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
| 42 | + $this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user'; |
|
| 43 | 43 | |
| 44 | 44 | //Get current user |
| 45 | 45 | $this->user_id = $current_user->ID; |
@@ -62,16 +62,16 @@ discard block |
||
| 62 | 62 | public function init() { |
| 63 | 63 | |
| 64 | 64 | //Testing? |
| 65 | - if ( $this->test_mode ) { |
|
| 66 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
| 65 | + if ($this->test_mode) { |
|
| 66 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | //Get the current page to add the notice to |
| 70 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 71 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
| 70 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 71 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
| 72 | 72 | |
| 73 | 73 | // File path of addon must be included in banner detail other addon activate meta will not delete. |
| 74 | - add_action( 'deactivate_' . $this->get_plugin_file_name(), array( $this, 'remove_addon_activate_meta' ) ); |
|
| 74 | + add_action('deactivate_'.$this->get_plugin_file_name(), array($this, 'remove_addon_activate_meta')); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | private function is_plugin_page() { |
| 86 | 86 | $screen = get_current_screen(); |
| 87 | 87 | |
| 88 | - return ( $screen->parent_file === 'plugins.php' ); |
|
| 88 | + return ($screen->parent_file === 'plugins.php'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | public function give_addon_activation_admin_notice() { |
| 99 | 99 | |
| 100 | 100 | // Bailout. |
| 101 | - if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) { |
|
| 101 | + if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) { |
|
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // If the user hasn't already dismissed the alert, output activation banner. |
| 106 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { |
|
| 106 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { |
|
| 107 | 107 | |
| 108 | 108 | // Output inline styles here because there's no reason |
| 109 | 109 | // to enqueued them after the alert is dismissed. |
@@ -185,44 +185,44 @@ discard block |
||
| 185 | 185 | <h3><?php |
| 186 | 186 | printf( |
| 187 | 187 | /* translators: %s: Add-on name */ |
| 188 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
| 189 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
| 188 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
| 189 | + '<span>'.$this->banner_details['name'].'</span>' |
|
| 190 | 190 | ); |
| 191 | 191 | ?></h3> |
| 192 | 192 | |
| 193 | 193 | <a href="<?php |
| 194 | 194 | //The Dismiss Button. |
| 195 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
| 196 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
| 195 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
| 196 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
| 197 | 197 | class="dashicons dashicons-dismiss"></span></a> |
| 198 | 198 | |
| 199 | 199 | <div class="alert-actions"> |
| 200 | 200 | |
| 201 | 201 | <?php //Point them to your settings page. |
| 202 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
| 202 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
| 203 | 203 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
| 204 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
| 204 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
| 205 | 205 | </a> |
| 206 | 206 | <?php } ?> |
| 207 | 207 | |
| 208 | 208 | <?php |
| 209 | 209 | // Show them how to configure the Addon. |
| 210 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
| 210 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
| 211 | 211 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
| 212 | 212 | <span class="dashicons dashicons-media-text"></span><?php |
| 213 | 213 | printf( |
| 214 | 214 | /* translators: %s: Add-on name */ |
| 215 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
| 215 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
| 216 | 216 | $this->banner_details['name'] |
| 217 | 217 | ); |
| 218 | 218 | ?></a> |
| 219 | 219 | <?php } ?> |
| 220 | 220 | <?php |
| 221 | 221 | //Let them signup for plugin updates |
| 222 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
| 222 | + if (isset($this->banner_details['support_url'])) { ?> |
|
| 223 | 223 | |
| 224 | 224 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
| 225 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
| 225 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
| 226 | 226 | </a> |
| 227 | 227 | |
| 228 | 228 | <?php } ?> |
@@ -249,13 +249,13 @@ discard block |
||
| 249 | 249 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
| 250 | 250 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 251 | 251 | */ |
| 252 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
| 252 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
| 253 | 253 | |
| 254 | 254 | //Get the global user |
| 255 | 255 | $current_user = wp_get_current_user(); |
| 256 | 256 | $user_id = $current_user->ID; |
| 257 | 257 | |
| 258 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
| 258 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | * @access private |
| 267 | 267 | */ |
| 268 | 268 | private function add_addon_activate_meta() { |
| 269 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
| 269 | + $user_id = get_option($this->activate_by_meta_key); |
|
| 270 | 270 | $this->plugin_activate_by = (int) $user_id; |
| 271 | 271 | |
| 272 | - if ( ! $user_id ) { |
|
| 273 | - add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' ); |
|
| 272 | + if ( ! $user_id) { |
|
| 273 | + add_option($this->activate_by_meta_key, $this->user_id, '', 'no'); |
|
| 274 | 274 | $this->plugin_activate_by = (int) $this->user_id; |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | * @access public |
| 284 | 284 | */ |
| 285 | 285 | public function remove_addon_activate_meta() { |
| 286 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
| 286 | + $user_id = get_option($this->activate_by_meta_key); |
|
| 287 | 287 | |
| 288 | - if ( $user_id ) { |
|
| 289 | - delete_option( $this->activate_by_meta_key ); |
|
| 288 | + if ($user_id) { |
|
| 289 | + delete_option($this->activate_by_meta_key); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
@@ -299,35 +299,35 @@ discard block |
||
| 299 | 299 | * @return mixed |
| 300 | 300 | */ |
| 301 | 301 | private function get_plugin_file_name() { |
| 302 | - $active_plugins = get_option( 'active_plugins' ); |
|
| 302 | + $active_plugins = get_option('active_plugins'); |
|
| 303 | 303 | $file_name = ''; |
| 304 | 304 | |
| 305 | 305 | try { |
| 306 | 306 | |
| 307 | 307 | // Check addon file path. |
| 308 | - if ( ! empty( $this->banner_details['file'] ) ) { |
|
| 308 | + if ( ! empty($this->banner_details['file'])) { |
|
| 309 | 309 | $file_name = ''; |
| 310 | - if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) { |
|
| 311 | - $file_path = array_pop( $file_path ); |
|
| 312 | - $file_name = current( explode( '/', $file_path ) ); |
|
| 310 | + if ($file_path = explode('/plugins/', $this->banner_details['file'])) { |
|
| 311 | + $file_path = array_pop($file_path); |
|
| 312 | + $file_name = current(explode('/', $file_path)); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - foreach ( $active_plugins as $plugin ) { |
|
| 316 | - if ( false !== strpos( $plugin, $file_name ) ) { |
|
| 315 | + foreach ($active_plugins as $plugin) { |
|
| 316 | + if (false !== strpos($plugin, $file_name)) { |
|
| 317 | 317 | $file_name = $plugin; |
| 318 | 318 | break; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | } else { |
| 322 | - throw new Exception( __( "File path must be added of {$this->banner_details['name']} addon in banner details.", 'give' ) ); |
|
| 322 | + throw new Exception(__("File path must be added of {$this->banner_details['name']} addon in banner details.", 'give')); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Check plugin path calculated by addon file path. |
| 326 | - if ( empty( $file_name ) ) { |
|
| 327 | - throw new Exception( __( "Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give' ) ); |
|
| 326 | + if (empty($file_name)) { |
|
| 327 | + throw new Exception(__("Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give')); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - } catch ( Exception $e ) { |
|
| 330 | + } catch (Exception $e) { |
|
| 331 | 331 | echo $e->getMessage(); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -10,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 | /** |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | global $status, $page; |
| 54 | 54 | |
| 55 | 55 | // Set parent defaults |
| 56 | - parent::__construct( array( |
|
| 57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
| 58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
| 59 | - 'ajax' => false,// Does this table support ajax? |
|
| 60 | - ) ); |
|
| 56 | + parent::__construct(array( |
|
| 57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
| 58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
| 59 | + 'ajax' => false, // Does this table support ajax? |
|
| 60 | + )); |
|
| 61 | 61 | |
| 62 | 62 | $this->query(); |
| 63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return string Column Name |
| 75 | 75 | */ |
| 76 | - public function column_default( $item, $column_name ) { |
|
| 77 | - return $item[ $column_name ]; |
|
| 76 | + public function column_default($item, $column_name) { |
|
| 77 | + return $item[$column_name]; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return string Column Name |
| 89 | 89 | */ |
| 90 | - public function column_key( $item ) { |
|
| 91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
| 90 | + public function column_key($item) { |
|
| 91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return string Column Name |
| 103 | 103 | */ |
| 104 | - public function column_token( $item ) { |
|
| 105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
| 104 | + public function column_token($item) { |
|
| 105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string Column Name |
| 117 | 117 | */ |
| 118 | - public function column_secret( $item ) { |
|
| 119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
| 118 | + public function column_secret($item) { |
|
| 119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
| 126 | 126 | * @since 1.1 |
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | - public function column_user( $item ) { |
|
| 129 | + public function column_user($item) { |
|
| 130 | 130 | |
| 131 | 131 | $actions = array(); |
| 132 | 132 | |
| 133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
| 133 | + if (apply_filters('give_api_log_requests', true)) { |
|
| 134 | 134 | $actions['view'] = sprintf( |
| 135 | 135 | '<a href="%s">%s</a>', |
| 136 | - esc_url( add_query_arg( array( |
|
| 136 | + esc_url(add_query_arg(array( |
|
| 137 | 137 | 'section' => 'api_requests', |
| 138 | 138 | 'post_type' => 'give_forms', |
| 139 | 139 | 'page' => 'give-tools', |
| 140 | 140 | 'tab' => 'logs', |
| 141 | 141 | 's' => $item['email'], |
| 142 | - ), 'edit.php' ) ), |
|
| 143 | - esc_html__( 'View API Log', 'give' ) |
|
| 142 | + ), 'edit.php')), |
|
| 143 | + esc_html__('View API Log', 'give') |
|
| 144 | 144 | ); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $actions['reissue'] = sprintf( |
| 148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
| 149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
| 149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
| 150 | 150 | 'user_id' => $item['id'], |
| 151 | 151 | 'give_action' => 'process_api_key', |
| 152 | 152 | 'give_api_process' => 'regenerate', |
| 153 | - ) ), 'give-api-nonce' ) ), |
|
| 154 | - esc_html__( 'Reissue', 'give' ) |
|
| 153 | + )), 'give-api-nonce')), |
|
| 154 | + esc_html__('Reissue', 'give') |
|
| 155 | 155 | ); |
| 156 | - $actions['revoke'] = sprintf( |
|
| 156 | + $actions['revoke'] = sprintf( |
|
| 157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
| 158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
| 158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
| 159 | 159 | 'user_id' => $item['id'], |
| 160 | 160 | 'give_action' => 'process_api_key', |
| 161 | 161 | 'give_api_process' => 'revoke', |
| 162 | - ) ), 'give-api-nonce' ) ), |
|
| 163 | - esc_html__( 'Revoke', 'give' ) |
|
| 162 | + )), 'give-api-nonce')), |
|
| 163 | + esc_html__('Revoke', 'give') |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
| 166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
| 167 | 167 | |
| 168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
| 168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function get_columns() { |
| 191 | 191 | $columns = array( |
| 192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
| 193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
| 194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
| 195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
| 192 | + 'user' => esc_html__('Username', 'give'), |
|
| 193 | + 'key' => esc_html__('Public Key', 'give'), |
|
| 194 | + 'token' => esc_html__('Token', 'give'), |
|
| 195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @param string $which |
| 208 | 208 | */ |
| 209 | - protected function display_tablenav( $which ) { |
|
| 210 | - if ( 'top' === $which ) { |
|
| 211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 209 | + protected function display_tablenav($which) { |
|
| 210 | + if ('top' === $which) { |
|
| 211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 212 | 212 | } |
| 213 | 213 | ?> |
| 214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 215 | 215 | |
| 216 | 216 | <div class="alignleft actions bulkactions"> |
| 217 | - <?php $this->bulk_actions( $which ); ?> |
|
| 217 | + <?php $this->bulk_actions($which); ?> |
|
| 218 | 218 | </div> |
| 219 | 219 | |
| 220 | 220 | <?php |
| 221 | - $this->extra_tablenav( $which ); |
|
| 222 | - $this->pagination( $which ); |
|
| 221 | + $this->extra_tablenav($which); |
|
| 222 | + $this->pagination($which); |
|
| 223 | 223 | ?> |
| 224 | 224 | |
| 225 | 225 | <br class="clear"/> |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return void |
| 239 | 239 | */ |
| 240 | - function bulk_actions( $which = '' ) { |
|
| 240 | + function bulk_actions($which = '') { |
|
| 241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place |
| 242 | 242 | static $give_api_is_bottom; |
| 243 | 243 | |
| 244 | - if ( $give_api_is_bottom ) { |
|
| 244 | + if ($give_api_is_bottom) { |
|
| 245 | 245 | return; |
| 246 | 246 | } |
| 247 | 247 | ?> |
| 248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
| 249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
| 250 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
| 250 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
| 251 | 251 | <?php echo Give()->html->ajax_user_search(); ?> |
| 252 | - <?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 252 | + <?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
| 253 | 253 | <?php |
| 254 | 254 | $give_api_is_bottom = true; |
| 255 | 255 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @return int Current page number |
| 263 | 263 | */ |
| 264 | 264 | public function get_paged() { |
| 265 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 265 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -273,21 +273,21 @@ discard block |
||
| 273 | 273 | * @return array |
| 274 | 274 | */ |
| 275 | 275 | public function query() { |
| 276 | - $users = get_users( array( |
|
| 276 | + $users = get_users(array( |
|
| 277 | 277 | 'meta_value' => 'give_user_secret_key', |
| 278 | 278 | 'number' => $this->per_page, |
| 279 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
| 280 | - ) ); |
|
| 281 | - $keys = array(); |
|
| 282 | - |
|
| 283 | - foreach ( $users as $user ) { |
|
| 284 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
| 285 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
| 286 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
| 287 | - |
|
| 288 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
| 289 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
| 290 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
| 279 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
| 280 | + )); |
|
| 281 | + $keys = array(); |
|
| 282 | + |
|
| 283 | + foreach ($users as $user) { |
|
| 284 | + $keys[$user->ID]['id'] = $user->ID; |
|
| 285 | + $keys[$user->ID]['email'] = $user->user_email; |
|
| 286 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
| 287 | + |
|
| 288 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
| 289 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
| 290 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $keys; |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | public function total_items() { |
| 305 | 305 | global $wpdb; |
| 306 | 306 | |
| 307 | - if ( ! get_transient( 'give_total_api_keys' ) ) { |
|
| 308 | - $total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" ); |
|
| 307 | + if ( ! get_transient('give_total_api_keys')) { |
|
| 308 | + $total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'"); |
|
| 309 | 309 | |
| 310 | - set_transient( 'give_total_api_keys', $total_items, 60 * 60 ); |
|
| 310 | + set_transient('give_total_api_keys', $total_items, 60 * 60); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - return get_transient( 'give_total_api_keys' ); |
|
| 313 | + return get_transient('give_total_api_keys'); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $hidden = array(); // No hidden columns |
| 327 | 327 | $sortable = array(); // Not sortable... for now |
| 328 | 328 | |
| 329 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 329 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 330 | 330 | |
| 331 | 331 | $data = $this->query(); |
| 332 | 332 | |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $this->items = $data; |
| 336 | 336 | |
| 337 | - $this->set_pagination_args( array( |
|
| 337 | + $this->set_pagination_args(array( |
|
| 338 | 338 | 'total_items' => $total_items, |
| 339 | 339 | 'per_page' => $this->per_page, |
| 340 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 340 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 341 | 341 | ) |
| 342 | 342 | ); |
| 343 | 343 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | * @since 1.5 |
| 21 | 21 | */ |
| 22 | 22 | function give_register_batch_recount_export_classes() { |
| 23 | - add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 ); |
|
| 23 | + add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 ); |
|
| 26 | +add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10); |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,31 +35,31 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | -function give_include_batch_export_class( $class ) { |
|
| 39 | - switch ( $class ) { |
|
| 38 | +function give_include_batch_export_class($class) { |
|
| 39 | + switch ($class) { |
|
| 40 | 40 | |
| 41 | 41 | case 'Give_Tools_Delete_Test_Transactions': |
| 42 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php'; |
|
| 42 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php'; |
|
| 43 | 43 | break; |
| 44 | 44 | |
| 45 | 45 | case 'Give_Tools_Recount_Customer_Stats': |
| 46 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php'; |
|
| 46 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php'; |
|
| 47 | 47 | break; |
| 48 | 48 | |
| 49 | 49 | case 'Give_Tools_Reset_Stats': |
| 50 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php'; |
|
| 50 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php'; |
|
| 51 | 51 | break; |
| 52 | 52 | |
| 53 | 53 | case 'Give_Tools_Recount_All_Stats': |
| 54 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php'; |
|
| 54 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php'; |
|
| 55 | 55 | break; |
| 56 | 56 | |
| 57 | 57 | case 'Give_Tools_Recount_Form_Stats': |
| 58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php'; |
|
| 58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php'; |
|
| 59 | 59 | break; |
| 60 | 60 | |
| 61 | 61 | case 'Give_Tools_Recount_Income': |
| 62 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php'; |
|
| 62 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php'; |
|
| 63 | 63 | break; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -39,30 +39,30 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function csv_cols() { |
| 41 | 41 | $cols = array( |
| 42 | - 'id' => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
| 43 | - 'seq_id' => esc_html__( 'Payment Number', 'give' ), // sequential payment ID. |
|
| 44 | - 'email' => esc_html__( 'Email', 'give' ), |
|
| 45 | - 'first' => esc_html__( 'First Name', 'give' ), |
|
| 46 | - 'last' => esc_html__( 'Last Name', 'give' ), |
|
| 47 | - 'address1' => esc_html__( 'Address 1', 'give' ), |
|
| 48 | - 'address2' => esc_html__( 'Address 2', 'give' ), |
|
| 49 | - 'city' => esc_html__( 'City', 'give' ), |
|
| 50 | - 'state' => esc_html__( 'State', 'give' ), |
|
| 51 | - 'country' => esc_html__( 'Country', 'give' ), |
|
| 52 | - 'zip' => esc_html__( 'Zip / Postal Code', 'give' ), |
|
| 53 | - 'form_id' => esc_html__( 'Form ID', 'give' ), |
|
| 54 | - 'form_name' => esc_html__( 'Form Name', 'give' ), |
|
| 55 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
| 56 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
| 57 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
| 58 | - 'key' => esc_html__( 'Key', 'give' ), |
|
| 59 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 60 | - 'user' => esc_html__( 'User', 'give' ), |
|
| 61 | - 'status' => esc_html__( 'Status', 'give' ) |
|
| 42 | + 'id' => esc_html__('ID', 'give'), // unaltered payment ID (use for querying). |
|
| 43 | + 'seq_id' => esc_html__('Payment Number', 'give'), // sequential payment ID. |
|
| 44 | + 'email' => esc_html__('Email', 'give'), |
|
| 45 | + 'first' => esc_html__('First Name', 'give'), |
|
| 46 | + 'last' => esc_html__('Last Name', 'give'), |
|
| 47 | + 'address1' => esc_html__('Address 1', 'give'), |
|
| 48 | + 'address2' => esc_html__('Address 2', 'give'), |
|
| 49 | + 'city' => esc_html__('City', 'give'), |
|
| 50 | + 'state' => esc_html__('State', 'give'), |
|
| 51 | + 'country' => esc_html__('Country', 'give'), |
|
| 52 | + 'zip' => esc_html__('Zip / Postal Code', 'give'), |
|
| 53 | + 'form_id' => esc_html__('Form ID', 'give'), |
|
| 54 | + 'form_name' => esc_html__('Form Name', 'give'), |
|
| 55 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
| 56 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
| 57 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
| 58 | + 'key' => esc_html__('Key', 'give'), |
|
| 59 | + 'date' => esc_html__('Date', 'give'), |
|
| 60 | + 'user' => esc_html__('User', 'give'), |
|
| 61 | + 'status' => esc_html__('Status', 'give') |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 65 | - unset( $cols['seq_id'] ); |
|
| 64 | + if ( ! give_get_option('enable_sequential')) { |
|
| 65 | + unset($cols['seq_id']); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | 'status' => $this->status |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
| 90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
| 91 | 91 | |
| 92 | 92 | $args['date_query'] = array( |
| 93 | 93 | array( |
| 94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
| 95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
| 94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
| 95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
| 96 | 96 | 'inclusive' => true |
| 97 | 97 | ) |
| 98 | 98 | ); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Add category or tag to payment query if any. |
| 103 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
| 103 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
| 104 | 104 | $form_args = array( |
| 105 | 105 | 'post_type' => 'give_forms', |
| 106 | 106 | 'post_status' => 'publish', |
| 107 | - 'posts_per_page' => - 1, |
|
| 107 | + 'posts_per_page' => -1, |
|
| 108 | 108 | 'fields' => 'ids', |
| 109 | 109 | 'tax_query' => array( |
| 110 | 110 | 'relation' => 'AND', |
@@ -112,75 +112,75 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | |
| 115 | - if ( ! empty( $this->categories ) ) { |
|
| 115 | + if ( ! empty($this->categories)) { |
|
| 116 | 116 | $form_args['tax_query'][] = array( |
| 117 | 117 | 'taxonomy' => 'give_forms_category', |
| 118 | 118 | 'terms' => $this->categories, |
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( ! empty( $this->tags ) ) { |
|
| 122 | + if ( ! empty($this->tags)) { |
|
| 123 | 123 | $form_args['tax_query'][] = array( |
| 124 | 124 | 'taxonomy' => 'give_forms_tag', |
| 125 | 125 | 'terms' => $this->tags, |
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $forms = new WP_Query( $form_args ); |
|
| 129 | + $forms = new WP_Query($form_args); |
|
| 130 | 130 | |
| 131 | - if ( empty( $forms->posts ) ) { |
|
| 131 | + if (empty($forms->posts)) { |
|
| 132 | 132 | return array(); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $args['give_forms'] = $forms->posts; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $payments = give_get_payments( $args ); |
|
| 138 | + $payments = give_get_payments($args); |
|
| 139 | 139 | |
| 140 | - if ( $payments ) { |
|
| 140 | + if ($payments) { |
|
| 141 | 141 | |
| 142 | - foreach ( $payments as $payment ) { |
|
| 143 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
| 144 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
| 145 | - $total = give_get_payment_amount( $payment->ID ); |
|
| 146 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 142 | + foreach ($payments as $payment) { |
|
| 143 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
| 144 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
| 145 | + $total = give_get_payment_amount($payment->ID); |
|
| 146 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 147 | 147 | $products = ''; |
| 148 | 148 | $skus = ''; |
| 149 | 149 | |
| 150 | - if ( is_numeric( $user_id ) ) { |
|
| 151 | - $user = get_userdata( $user_id ); |
|
| 150 | + if (is_numeric($user_id)) { |
|
| 151 | + $user = get_userdata($user_id); |
|
| 152 | 152 | } else { |
| 153 | 153 | $user = false; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $data[] = array( |
| 157 | 157 | 'id' => $payment->ID, |
| 158 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
| 158 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
| 159 | 159 | 'email' => $payment_meta['email'], |
| 160 | 160 | 'first' => $user_info['first_name'], |
| 161 | 161 | 'last' => $user_info['last_name'], |
| 162 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
| 163 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
| 164 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
| 165 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
| 166 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
| 167 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
| 168 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
| 169 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
| 162 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
| 163 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
| 164 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
| 165 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
| 166 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
| 167 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
| 168 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
| 169 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
| 170 | 170 | 'skus' => $skus, |
| 171 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
| 172 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
| 173 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
| 171 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
| 172 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
| 173 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
| 174 | 174 | 'key' => $payment_meta['key'], |
| 175 | 175 | 'date' => $payment->post_date, |
| 176 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
| 177 | - 'status' => give_get_payment_status( $payment, true ) |
|
| 176 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
| 177 | + 'status' => give_get_payment_status($payment, true) |
|
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 183 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 182 | + $data = apply_filters('give_export_get_data', $data); |
|
| 183 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 184 | 184 | |
| 185 | 185 | return $data; |
| 186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $status = $this->status; |
| 202 | 202 | $args = array( |
| 203 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
| 204 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
| 203 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
| 204 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - if ( 'any' == $status ) { |
|
| 207 | + if ('any' == $status) { |
|
| 208 | 208 | |
| 209 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
| 209 | + $total = array_sum((array) give_count_payments($args)); |
|
| 210 | 210 | |
| 211 | 211 | } else { |
| 212 | 212 | |
| 213 | - $total = give_count_payments( $args )->$status; |
|
| 213 | + $total = give_count_payments($args)->$status; |
|
| 214 | 214 | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $percentage = 100; |
| 218 | 218 | |
| 219 | - if ( $total > 0 ) { |
|
| 220 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 219 | + if ($total > 0) { |
|
| 220 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if ( $percentage > 100 ) { |
|
| 223 | + if ($percentage > 100) { |
|
| 224 | 224 | $percentage = 100; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @param array $request The Form Data passed into the batch processing. |
| 236 | 236 | */ |
| 237 | - public function set_properties( $request ) { |
|
| 238 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
| 239 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
| 240 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
| 241 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
| 242 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
| 237 | + public function set_properties($request) { |
|
| 238 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
| 239 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
| 240 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
| 241 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
| 242 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
| 243 | 243 | } |
| 244 | 244 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_logs_view_sales() { |
| 26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
| 26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
| 27 | 27 | |
| 28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
| 29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | function give_logs_view_gateway_errors() { |
| 46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
| 46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
| 47 | 47 | |
| 48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 49 | 49 | $logs_table->prepare_items(); |
| 50 | 50 | $logs_table->display(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | 64 | function give_logs_view_api_requests() { |
| 65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
| 65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
| 66 | 66 | |
| 67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
| 68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @since 1.0 |
| 77 | 77 | */ |
| 78 | - do_action( 'give_logs_api_requests_top' ); |
|
| 78 | + do_action('give_logs_api_requests_top'); |
|
| 79 | 79 | ?> |
| 80 | 80 | |
| 81 | 81 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
| 82 | 82 | <?php |
| 83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
| 83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
| 84 | 84 | $logs_table->display(); |
| 85 | 85 | ?> |
| 86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @since 1.0 |
| 95 | 95 | */ |
| 96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
| 96 | + do_action('give_logs_api_requests_bottom'); |
|
| 97 | 97 | ?> |
| 98 | 98 | |
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Renders the Reports page views drop down |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | $current_section = give_get_current_setting_section(); |
| 113 | 113 | |
| 114 | 114 | // If there are not any event attach to action then do not show form. |
| 115 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
| 115 | + if ( ! has_action('give_log_view_actions')) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | ?> |
| 119 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
| 119 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
| 120 | 120 | <?php |
| 121 | 121 | /** |
| 122 | 122 | * Fires after displaying the reports page views drop down. |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @since 1.0 |
| 127 | 127 | */ |
| 128 | - do_action( 'give_log_view_actions' ); |
|
| 128 | + do_action('give_log_view_actions'); |
|
| 129 | 129 | ?> |
| 130 | 130 | |
| 131 | 131 | <input type="hidden" name="post_type" value="give_forms"/> |
| 132 | 132 | <input type="hidden" name="page" value="give-tools"/> |
| 133 | 133 | <input type="hidden" name="tab" value="logs"/> |
| 134 | 134 | |
| 135 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 135 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 136 | 136 | </form> |
| 137 | 137 | <?php |
| 138 | 138 | } |
@@ -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,53 +24,53 @@ discard block |
||
| 24 | 24 | function give_hide_subscription_notices() { |
| 25 | 25 | |
| 26 | 26 | // Hide subscription notices permanently. |
| 27 | - if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) { |
|
| 27 | + if ( ! empty($_GET['_give_hide_license_notices_permanently'])) { |
|
| 28 | 28 | $current_user = wp_get_current_user(); |
| 29 | 29 | |
| 30 | 30 | // check previously disabled notice ids. |
| 31 | - $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) ) |
|
| 31 | + $already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true)) |
|
| 32 | 32 | ? $already_dismiss_notices |
| 33 | 33 | : array(); |
| 34 | 34 | |
| 35 | 35 | // Get notice id. |
| 36 | - $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] ); |
|
| 36 | + $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']); |
|
| 37 | 37 | |
| 38 | - if ( ! in_array( $notice_id, $already_dismiss_notices ) ) { |
|
| 38 | + if ( ! in_array($notice_id, $already_dismiss_notices)) { |
|
| 39 | 39 | $already_dismiss_notices[] = $notice_id; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Store subscription ids. |
| 43 | - update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices ); |
|
| 43 | + update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices); |
|
| 44 | 44 | |
| 45 | 45 | // Redirect user. |
| 46 | - wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) ); |
|
| 46 | + wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'])); |
|
| 47 | 47 | exit(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Hide subscription notices shortly. |
| 51 | - if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) { |
|
| 51 | + if ( ! empty($_GET['_give_hide_license_notices_shortly'])) { |
|
| 52 | 52 | $current_user = wp_get_current_user(); |
| 53 | 53 | |
| 54 | 54 | // Get notice id. |
| 55 | - $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] ); |
|
| 55 | + $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']); |
|
| 56 | 56 | |
| 57 | 57 | // Transient key name. |
| 58 | 58 | $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}"; |
| 59 | 59 | |
| 60 | - if ( get_transient( $transient_key ) ) { |
|
| 60 | + if (get_transient($transient_key)) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Hide notice for 24 hours. |
| 65 | - set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS ); |
|
| 65 | + set_transient($transient_key, true, 24 * HOUR_IN_SECONDS); |
|
| 66 | 66 | |
| 67 | 67 | // Redirect user. |
| 68 | - wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) ); |
|
| 68 | + wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'])); |
|
| 69 | 69 | exit(); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | -add_action( 'admin_init', 'give_hide_subscription_notices' ); |
|
| 73 | +add_action('admin_init', 'give_hide_subscription_notices'); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Load wp editor by ajax. |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @since 1.8 |
| 79 | 79 | */ |
| 80 | 80 | function give_load_wp_editor() { |
| 81 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
| 81 | + if ( ! isset($_POST['wp_editor'])) { |
|
| 82 | 82 | die(); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
| 85 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
| 86 | 86 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
| 87 | 87 | |
| 88 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
| 88 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
| 89 | 89 | |
| 90 | 90 | die(); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
| 93 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | // Get current page. |
| 112 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
| 112 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
| 113 | 113 | |
| 114 | 114 | // Bailout. |
| 115 | 115 | if ( |
| 116 | - empty( $current_page ) |
|
| 117 | - || empty( $_GET['_wp_http_referer'] ) |
|
| 118 | - || ! in_array( $current_page, $give_pages ) |
|
| 116 | + empty($current_page) |
|
| 117 | + || empty($_GET['_wp_http_referer']) |
|
| 118 | + || ! in_array($current_page, $give_pages) |
|
| 119 | 119 | ) { |
| 120 | 120 | return false; |
| 121 | 121 | } |
@@ -125,18 +125,18 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @since 1.8 |
| 127 | 127 | */ |
| 128 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
| 128 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
| 129 | 129 | |
| 130 | - if ( $redirect ) { |
|
| 130 | + if ($redirect) { |
|
| 131 | 131 | // Redirect. |
| 132 | 132 | wp_redirect( |
| 133 | 133 | remove_query_arg( |
| 134 | - array( '_wp_http_referer', '_wpnonce' ), |
|
| 135 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
| 134 | + array('_wp_http_referer', '_wpnonce'), |
|
| 135 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
| 136 | 136 | ) |
| 137 | 137 | ); |
| 138 | 138 | exit; |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
| 142 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | * |
| 99 | 99 | * @since 1.8 |
| 100 | 100 | * |
| 101 | - * @return bool |
|
| 101 | + * @return false|null |
|
| 102 | 102 | */ |
| 103 | 103 | function give_redirect_to_clean_url_admin_pages() { |
| 104 | 104 | // Give admin pages. |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | // uncomment this line for testing |
| 4 | 4 | // set_site_transient( 'update_plugins', null ); |
| 5 | 5 | // Exit if accessed directly. |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * @param string $_plugin_file Path to the plugin file. |
| 27 | 27 | * @param array $_api_data Optional data to send with API calls. |
| 28 | 28 | */ |
| 29 | - function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
| 30 | - $this->api_url = trailingslashit( $_api_url ); |
|
| 29 | + function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
| 30 | + $this->api_url = trailingslashit($_api_url); |
|
| 31 | 31 | $this->api_data = $_api_data; |
| 32 | - $this->name = plugin_basename( $_plugin_file ); |
|
| 33 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
| 32 | + $this->name = plugin_basename($_plugin_file); |
|
| 33 | + $this->slug = basename($_plugin_file, '.php'); |
|
| 34 | 34 | $this->version = $_api_data['version']; |
| 35 | 35 | |
| 36 | 36 | // Set up hooks. |
| 37 | 37 | $this->init(); |
| 38 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
| 38 | + add_action('admin_init', array($this, 'show_changelog')); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function init() { |
| 47 | 47 | |
| 48 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 49 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
| 48 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 49 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
| 50 | 50 | |
| 51 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 51 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -65,34 +65,34 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return stdClass Modified update array with custom plugin data |
| 67 | 67 | */ |
| 68 | - function check_update( $_transient_data ) { |
|
| 68 | + function check_update($_transient_data) { |
|
| 69 | 69 | |
| 70 | 70 | $screen = get_current_screen(); |
| 71 | 71 | |
| 72 | - if ( ! is_object( $_transient_data ) ) { |
|
| 72 | + if ( ! is_object($_transient_data)) { |
|
| 73 | 73 | $_transient_data = new stdClass; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( is_object( $screen ) && 'plugins.php' == $screen->parent_file && is_multisite() ) { |
|
| 76 | + if (is_object($screen) && 'plugins.php' == $screen->parent_file && is_multisite()) { |
|
| 77 | 77 | return $_transient_data; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
| 80 | + if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) { |
|
| 81 | 81 | |
| 82 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 82 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 83 | 83 | |
| 84 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
| 84 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
| 85 | 85 | |
| 86 | 86 | $this->did_check = true; |
| 87 | 87 | |
| 88 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 88 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 89 | 89 | |
| 90 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 90 | + $_transient_data->response[$this->name] = $version_info; |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $_transient_data->last_checked = time(); |
| 95 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 95 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -106,85 +106,85 @@ discard block |
||
| 106 | 106 | * @param string $file |
| 107 | 107 | * @param array $plugin |
| 108 | 108 | */ |
| 109 | - public function show_update_notification( $file, $plugin ) { |
|
| 109 | + public function show_update_notification($file, $plugin) { |
|
| 110 | 110 | |
| 111 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
| 111 | + if ( ! current_user_can('update_plugins')) { |
|
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ( ! is_multisite() ) { |
|
| 115 | + if ( ! is_multisite()) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if ( $this->name != $file ) { |
|
| 119 | + if ($this->name != $file) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Remove our filter on the site transient |
| 124 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
| 124 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
| 125 | 125 | |
| 126 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
| 126 | + $update_cache = get_site_transient('update_plugins'); |
|
| 127 | 127 | |
| 128 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
| 128 | + if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
| 129 | 129 | |
| 130 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' ); |
|
| 131 | - $version_info = get_transient( $cache_key ); |
|
| 130 | + $cache_key = md5('edd_plugin_'.sanitize_key($this->name).'_version_info'); |
|
| 131 | + $version_info = get_transient($cache_key); |
|
| 132 | 132 | |
| 133 | - if ( false === $version_info ) { |
|
| 133 | + if (false === $version_info) { |
|
| 134 | 134 | |
| 135 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 135 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 136 | 136 | |
| 137 | - set_transient( $cache_key, $version_info, 3600 ); |
|
| 137 | + set_transient($cache_key, $version_info, 3600); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if ( ! is_object( $version_info ) ) { |
|
| 140 | + if ( ! is_object($version_info)) { |
|
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 144 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 145 | 145 | |
| 146 | - $update_cache->response[ $this->name ] = $version_info; |
|
| 146 | + $update_cache->response[$this->name] = $version_info; |
|
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $update_cache->last_checked = time(); |
| 151 | - $update_cache->checked[ $this->name ] = $this->version; |
|
| 151 | + $update_cache->checked[$this->name] = $this->version; |
|
| 152 | 152 | |
| 153 | - set_site_transient( 'update_plugins', $update_cache ); |
|
| 153 | + set_site_transient('update_plugins', $update_cache); |
|
| 154 | 154 | |
| 155 | 155 | } else { |
| 156 | 156 | |
| 157 | - $version_info = $update_cache->response[ $this->name ]; |
|
| 157 | + $version_info = $update_cache->response[$this->name]; |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Restore our filter |
| 162 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 162 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 163 | 163 | |
| 164 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 164 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
| 165 | 165 | |
| 166 | 166 | // build a plugin list row, with update notification |
| 167 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
| 168 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 167 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
| 168 | + echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 169 | 169 | |
| 170 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
| 170 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
| 171 | 171 | |
| 172 | - if ( empty( $version_info->download_link ) ) { |
|
| 172 | + if (empty($version_info->download_link)) { |
|
| 173 | 173 | printf( |
| 174 | 174 | /* translators: 1: name 2: changelog URL 3: version */ |
| 175 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give' ), |
|
| 176 | - esc_html( $version_info->name ), |
|
| 177 | - esc_url( $changelog_link ), |
|
| 178 | - esc_html( $version_info->new_version ) |
|
| 175 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give'), |
|
| 176 | + esc_html($version_info->name), |
|
| 177 | + esc_url($changelog_link), |
|
| 178 | + esc_html($version_info->new_version) |
|
| 179 | 179 | ); |
| 180 | 180 | } else { |
| 181 | 181 | printf( |
| 182 | 182 | /* translators: 1: name 2: changelog URL 3: version 4: update URL */ |
| 183 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give' ), |
|
| 184 | - esc_html( $version_info->name ), |
|
| 185 | - esc_url( $changelog_link ), |
|
| 186 | - esc_html( $version_info->new_version ), |
|
| 187 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
| 183 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give'), |
|
| 184 | + esc_html($version_info->name), |
|
| 185 | + esc_url($changelog_link), |
|
| 186 | + esc_html($version_info->new_version), |
|
| 187 | + esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)) |
|
| 188 | 188 | ); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -204,15 +204,15 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return object $_data |
| 206 | 206 | */ |
| 207 | - function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
| 207 | + function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
| 208 | 208 | |
| 209 | - if ( $_action != 'plugin_information' ) { |
|
| 209 | + if ($_action != 'plugin_information') { |
|
| 210 | 210 | |
| 211 | 211 | return $_data; |
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
| 215 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
| 216 | 216 | |
| 217 | 217 | return $_data; |
| 218 | 218 | |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | ), |
| 228 | 228 | ); |
| 229 | 229 | |
| 230 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
| 230 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
| 231 | 231 | |
| 232 | - if ( false !== $api_response ) { |
|
| 232 | + if (false !== $api_response) { |
|
| 233 | 233 | $_data = $api_response; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @return object $array |
| 247 | 247 | */ |
| 248 | - function http_request_args( $args, $url ) { |
|
| 248 | + function http_request_args($args, $url) { |
|
| 249 | 249 | // If it is an https request and we are performing a package download, disable ssl verification |
| 250 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
| 250 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
| 251 | 251 | $args['sslverify'] = false; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -266,43 +266,43 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @return false||object |
| 268 | 268 | */ |
| 269 | - private function api_request( $_action, $_data ) { |
|
| 269 | + private function api_request($_action, $_data) { |
|
| 270 | 270 | |
| 271 | - $data = array_merge( $this->api_data, $_data ); |
|
| 271 | + $data = array_merge($this->api_data, $_data); |
|
| 272 | 272 | |
| 273 | - if ( $data['slug'] != $this->slug ) { |
|
| 273 | + if ($data['slug'] != $this->slug) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if ( empty( $data['license'] ) ) { |
|
| 277 | + if (empty($data['license'])) { |
|
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( $this->api_url == home_url() ) { |
|
| 281 | + if ($this->api_url == home_url()) { |
|
| 282 | 282 | return false; // Don't allow a plugin to ping itself |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $api_params = array( |
| 286 | 286 | 'edd_action' => 'get_version', |
| 287 | 287 | 'license' => $data['license'], |
| 288 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 289 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 288 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 289 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 290 | 290 | 'slug' => $data['slug'], |
| 291 | 291 | 'author' => $data['author'], |
| 292 | 292 | 'url' => home_url(), |
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, |
|
| 295 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, |
|
| 296 | 296 | 'sslverify' => false, |
| 297 | 297 | 'body' => $api_params, |
| 298 | - ) ); |
|
| 298 | + )); |
|
| 299 | 299 | |
| 300 | - if ( ! is_wp_error( $request ) ) { |
|
| 301 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
| 300 | + if ( ! is_wp_error($request)) { |
|
| 301 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if ( $request && isset( $request->sections ) ) { |
|
| 305 | - $request->sections = maybe_unserialize( $request->sections ); |
|
| 304 | + if ($request && isset($request->sections)) { |
|
| 305 | + $request->sections = maybe_unserialize($request->sections); |
|
| 306 | 306 | } else { |
| 307 | 307 | $request = false; |
| 308 | 308 | } |
@@ -312,26 +312,26 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | public function show_changelog() { |
| 314 | 314 | |
| 315 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
| 315 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
| 316 | 316 | return; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if ( empty( $_REQUEST['plugin'] ) ) { |
|
| 319 | + if (empty($_REQUEST['plugin'])) { |
|
| 320 | 320 | return; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if ( empty( $_REQUEST['slug'] ) ) { |
|
| 323 | + if (empty($_REQUEST['slug'])) { |
|
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
| 328 | - wp_die( esc_html__( 'You do not have permission to install plugin updates.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 327 | + if ( ! current_user_can('update_plugins')) { |
|
| 328 | + wp_die(esc_html__('You do not have permission to install plugin updates.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
| 331 | + $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug'])); |
|
| 332 | 332 | |
| 333 | - if ( $response && isset( $response->sections['changelog'] ) ) { |
|
| 334 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
| 333 | + if ($response && isset($response->sections['changelog'])) { |
|
| 334 | + echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>'; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | exit; |