@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | <?php |
| 5 | 5 | echo |
| 6 | 6 | wp_sprintf( |
| 7 | - __( 'Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing' ), |
|
| 8 | - esc_url( remove_query_arg( 'payment-confirm' ) ) |
|
| 7 | + __('Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing'), |
|
| 8 | + esc_url(remove_query_arg('payment-confirm')) |
|
| 9 | 9 | ); |
| 10 | 10 | ?> |
| 11 | 11 | <i class="fa fa-spin fa-refresh"></i> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | <script type="text/javascript"> |
| 15 | 15 | setTimeout( |
| 16 | 16 | function(){ |
| 17 | - window.location.href = '<?php echo esc_url( remove_query_arg( 'payment-confirm' ) ) ;?>'; |
|
| 17 | + window.location.href = '<?php echo esc_url(remove_query_arg('payment-confirm')); ?>'; |
|
| 18 | 18 | }, |
| 19 | 19 | 10000 |
| 20 | 20 | ); |
@@ -7,64 +7,64 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Fetch the invoice. |
| 13 | -$invoice = new WPInv_Invoice( $invoice ); |
|
| 13 | +$invoice = new WPInv_Invoice($invoice); |
|
| 14 | 14 | |
| 15 | 15 | // @deprecated |
| 16 | -do_action( 'wpinv_success_content_before', $invoice ); |
|
| 17 | -do_action( 'wpinv_before_receipt', $invoice ); |
|
| 16 | +do_action('wpinv_success_content_before', $invoice); |
|
| 17 | +do_action('wpinv_before_receipt', $invoice); |
|
| 18 | 18 | |
| 19 | 19 | wpinv_print_errors(); |
| 20 | 20 | |
| 21 | 21 | // Prepare header text. |
| 22 | -if ( $invoice->is_paid() ) { |
|
| 22 | +if ($invoice->is_paid()) { |
|
| 23 | 23 | |
| 24 | 24 | $alert = aui()->alert( |
| 25 | 25 | array( |
| 26 | 26 | 'type' => 'success', |
| 27 | - 'content' => __( 'Thank you for your payment!', 'invoicing' ), |
|
| 27 | + 'content' => __('Thank you for your payment!', 'invoicing'), |
|
| 28 | 28 | ) |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | -} else if ( $invoice->is_refunded() ) { |
|
| 31 | +} else if ($invoice->is_refunded()) { |
|
| 32 | 32 | |
| 33 | 33 | $alert = aui()->alert( |
| 34 | 34 | array( |
| 35 | 35 | 'type' => 'info', |
| 36 | - 'content' => __( 'This invoice was refunded.', 'invoicing' ), |
|
| 36 | + 'content' => __('This invoice was refunded.', 'invoicing'), |
|
| 37 | 37 | ) |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | -} else if ( $invoice->is_held() ) { |
|
| 40 | +} else if ($invoice->is_held()) { |
|
| 41 | 41 | |
| 42 | 42 | $alert = aui()->alert( |
| 43 | 43 | array( |
| 44 | 44 | 'type' => 'info', |
| 45 | - 'content' => __( 'This invoice will be processed as soon we verify your payment.', 'invoicing' ), |
|
| 45 | + 'content' => __('This invoice will be processed as soon we verify your payment.', 'invoicing'), |
|
| 46 | 46 | ) |
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | -} else if ( $invoice->needs_payment() ) { |
|
| 49 | +} else if ($invoice->needs_payment()) { |
|
| 50 | 50 | |
| 51 | - if ( $invoice->is_due() ) { |
|
| 51 | + if ($invoice->is_due()) { |
|
| 52 | 52 | |
| 53 | 53 | $alert = aui()->alert( |
| 54 | 54 | array( |
| 55 | 55 | 'type' => 'info', |
| 56 | - 'content' => __( "Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing' ), |
|
| 56 | + 'content' => __("Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing'), |
|
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | - } else if ( $invoice->is_due() ) { |
|
| 60 | + } else if ($invoice->is_due()) { |
|
| 61 | 61 | |
| 62 | 62 | $alert = aui()->alert( |
| 63 | 63 | array( |
| 64 | 64 | 'type' => 'danger', |
| 65 | 65 | 'content' => sprintf( |
| 66 | - __( 'This invoice was due on %.', 'invoicing' ), |
|
| 67 | - getpaid_format_date_value( $invoice->get_due_date() ) |
|
| 66 | + __('This invoice was due on %.', 'invoicing'), |
|
| 67 | + getpaid_format_date_value($invoice->get_due_date()) |
|
| 68 | 68 | ), |
| 69 | 69 | ) |
| 70 | 70 | ); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $alert = aui()->alert( |
| 75 | 75 | array( |
| 76 | 76 | 'type' => 'warning', |
| 77 | - 'content' => __( 'This invoice needs payment.', 'invoicing' ), |
|
| 77 | + 'content' => __('This invoice needs payment.', 'invoicing'), |
|
| 78 | 78 | ) |
| 79 | 79 | ); |
| 80 | 80 | |
@@ -89,19 +89,19 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | 'pay' => array( |
| 91 | 91 | 'url' => $invoice->get_checkout_payment_url(), |
| 92 | - 'name' => __( 'Pay For Invoice', 'invoicing' ), |
|
| 92 | + 'name' => __('Pay For Invoice', 'invoicing'), |
|
| 93 | 93 | 'class' => 'btn-success', |
| 94 | 94 | ), |
| 95 | 95 | |
| 96 | 96 | 'view' => array( |
| 97 | 97 | 'url' => $invoice->get_view_url(), |
| 98 | - 'name' => __( 'View Invoice', 'invoicing' ), |
|
| 98 | + 'name' => __('View Invoice', 'invoicing'), |
|
| 99 | 99 | 'class' => 'btn-primary', |
| 100 | 100 | ), |
| 101 | 101 | |
| 102 | 102 | 'history' => array( |
| 103 | 103 | 'url' => wpinv_get_history_page_uri(), |
| 104 | - 'name' => __( 'Invoice History', 'invoicing' ), |
|
| 104 | + 'name' => __('Invoice History', 'invoicing'), |
|
| 105 | 105 | 'class' => 'btn-warning', |
| 106 | 106 | ), |
| 107 | 107 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | -if ( ( ! $invoice->needs_payment() || $invoice->is_held() ) && isset( $actions['pay'] ) ) { |
|
| 114 | - unset( $actions['pay'] ); |
|
| 113 | +if ((!$invoice->needs_payment() || $invoice->is_held()) && isset($actions['pay'])) { |
|
| 114 | + unset($actions['pay']); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -if ( ! is_user_logged_in() && isset( $actions['history'] ) ) { |
|
| 118 | - unset( $actions['history'] ); |
|
| 117 | +if (!is_user_logged_in() && isset($actions['history'])) { |
|
| 118 | + unset($actions['history']); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | ?> |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | <?php |
| 126 | 126 | |
| 127 | - do_action( 'wpinv_receipt_start', $invoice ); |
|
| 127 | + do_action('wpinv_receipt_start', $invoice); |
|
| 128 | 128 | |
| 129 | - if ( ! empty( $actions ) ) { |
|
| 129 | + if (!empty($actions)) { |
|
| 130 | 130 | |
| 131 | 131 | echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
| 132 | 132 | |
| 133 | - foreach ( $actions as $key => $action ) { |
|
| 133 | + foreach ($actions as $key => $action) { |
|
| 134 | 134 | |
| 135 | - $key = sanitize_html_class( $key ); |
|
| 136 | - $class = empty( $action['class'] ) ? 'btn-dark' : sanitize_html_class( $action['class'] ); |
|
| 137 | - $url = empty( $action['url'] ) ? '#' : esc_url( $action['url'] ); |
|
| 138 | - $attrs = empty( $action['attrs'] ) ? '' : $action['attrs']; |
|
| 139 | - $anchor = sanitize_text_field( $action['name'] ); |
|
| 135 | + $key = sanitize_html_class($key); |
|
| 136 | + $class = empty($action['class']) ? 'btn-dark' : sanitize_html_class($action['class']); |
|
| 137 | + $url = empty($action['url']) ? '#' : esc_url($action['url']); |
|
| 138 | + $attrs = empty($action['attrs']) ? '' : $action['attrs']; |
|
| 139 | + $anchor = sanitize_text_field($action['name']); |
|
| 140 | 140 | |
| 141 | 141 | echo "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>"; |
| 142 | 142 | } |
@@ -152,21 +152,21 @@ discard block |
||
| 152 | 152 | <div class="wpinv-receipt-details"> |
| 153 | 153 | |
| 154 | 154 | <h4 class="wpinv-details-t mb-3 mt-3"> |
| 155 | - <?php echo apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ); ?> |
|
| 155 | + <?php echo apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing'), $invoice); ?> |
|
| 156 | 156 | </h4> |
| 157 | 157 | |
| 158 | - <?php getpaid_invoice_meta( $invoice ); ?> |
|
| 158 | + <?php getpaid_invoice_meta($invoice); ?> |
|
| 159 | 159 | |
| 160 | 160 | </div> |
| 161 | 161 | |
| 162 | - <?php echo getpaid_display_invoice_subscriptions( $invoice ); ?> |
|
| 162 | + <?php echo getpaid_display_invoice_subscriptions($invoice); ?> |
|
| 163 | 163 | |
| 164 | - <?php do_action( 'wpinv_receipt_end', $invoice ); ?> |
|
| 164 | + <?php do_action('wpinv_receipt_end', $invoice); ?> |
|
| 165 | 165 | |
| 166 | 166 | </div> |
| 167 | 167 | |
| 168 | 168 | <?php |
| 169 | 169 | |
| 170 | 170 | // @deprecated |
| 171 | -do_action( 'wpinv_success_content_after', $invoice ); |
|
| 172 | -do_action( 'wpinv_after_receipt', $invoice ); |
|
| 171 | +do_action('wpinv_success_content_after', $invoice); |
|
| 172 | +do_action('wpinv_after_receipt', $invoice); |
|
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Daily maintenance class. |
@@ -15,19 +15,19 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Class constructor. |
| 17 | 17 | */ |
| 18 | - public function __construct(){ |
|
| 18 | + public function __construct() { |
|
| 19 | 19 | |
| 20 | 20 | // Clear deprecated events. |
| 21 | - add_action( 'wp', array( $this, 'maybe_clear_deprecated_events' ) ); |
|
| 21 | + add_action('wp', array($this, 'maybe_clear_deprecated_events')); |
|
| 22 | 22 | |
| 23 | 23 | // (Maybe) schedule a cron that runs daily. |
| 24 | - add_action( 'wp', array( $this, 'maybe_create_scheduled_event' ) ); |
|
| 24 | + add_action('wp', array($this, 'maybe_create_scheduled_event')); |
|
| 25 | 25 | |
| 26 | 26 | // Fired everyday at 7 a.m (this might vary for sites with few visitors) |
| 27 | - add_action( 'getpaid_daily_maintenance', array( $this, 'log_cron_run' ) ); |
|
| 28 | - add_action( 'getpaid_daily_maintenance', array( $this, 'backwards_compat' ) ); |
|
| 29 | - add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_expire_subscriptions' ) ); |
|
| 30 | - add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_update_geoip_databases' ) ); |
|
| 27 | + add_action('getpaid_daily_maintenance', array($this, 'log_cron_run')); |
|
| 28 | + add_action('getpaid_daily_maintenance', array($this, 'backwards_compat')); |
|
| 29 | + add_action('getpaid_daily_maintenance', array($this, 'maybe_expire_subscriptions')); |
|
| 30 | + add_action('getpaid_daily_maintenance', array($this, 'maybe_update_geoip_databases')); |
|
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function maybe_create_scheduled_event() { |
| 39 | 39 | |
| 40 | - if ( ! wp_next_scheduled( 'getpaid_daily_maintenance' ) ) { |
|
| 41 | - $timestamp = strtotime( 'tomorrow 07:00:00', current_time( 'timestamp' ) ); |
|
| 42 | - wp_schedule_event( $timestamp, 'daily', 'getpaid_daily_maintenance' ); |
|
| 40 | + if (!wp_next_scheduled('getpaid_daily_maintenance')) { |
|
| 41 | + $timestamp = strtotime('tomorrow 07:00:00', current_time('timestamp')); |
|
| 42 | + wp_schedule_event($timestamp, 'daily', 'getpaid_daily_maintenance'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | } |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function maybe_clear_deprecated_events() { |
| 52 | 52 | |
| 53 | - if ( ! get_option( 'wpinv_cleared_old_events' ) ) { |
|
| 54 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' ); |
|
| 55 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' ); |
|
| 56 | - update_option( 'wpinv_cleared_old_events', 1 ); |
|
| 53 | + if (!get_option('wpinv_cleared_old_events')) { |
|
| 54 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily'); |
|
| 55 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_daily'); |
|
| 56 | + update_option('wpinv_cleared_old_events', 1); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | */ |
| 65 | 65 | public function backwards_compat() { |
| 66 | - do_action( 'wpinv_register_schedule_event_daily' ); |
|
| 66 | + do_action('wpinv_register_schedule_event_daily'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function maybe_expire_subscriptions() { |
| 74 | 74 | |
| 75 | 75 | // Fetch expired subscriptions (skips those that expire today). |
| 76 | - $args = array( |
|
| 76 | + $args = array( |
|
| 77 | 77 | 'number' => -1, |
| 78 | 78 | 'count_total' => false, |
| 79 | 79 | 'status' => 'trialling active failing cancelled', |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | ), |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - $subscriptions = new GetPaid_Subscriptions_Query( $args ); |
|
| 86 | + $subscriptions = new GetPaid_Subscriptions_Query($args); |
|
| 87 | 87 | |
| 88 | - foreach ( $subscriptions->get_results() as $subscription ) { |
|
| 89 | - if ( apply_filters( 'getpaid_daily_maintenance_should_expire_subscription', true, $subscription ) ) { |
|
| 90 | - $subscription->set_status( 'expired' ); |
|
| 88 | + foreach ($subscriptions->get_results() as $subscription) { |
|
| 89 | + if (apply_filters('getpaid_daily_maintenance_should_expire_subscription', true, $subscription)) { |
|
| 90 | + $subscription->set_status('expired'); |
|
| 91 | 91 | $subscription->save(); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | */ |
| 101 | 101 | public function log_cron_run() { |
| 102 | - wpinv_error_log( 'GetPaid Daily Cron', false ); |
|
| 102 | + wpinv_error_log('GetPaid Daily Cron', false); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | */ |
| 109 | 109 | public function maybe_update_geoip_databases() { |
| 110 | - $updated = get_transient( 'getpaid_updated_geoip_databases' ); |
|
| 110 | + $updated = get_transient('getpaid_updated_geoip_databases'); |
|
| 111 | 111 | |
| 112 | - if ( false === $updated ) { |
|
| 113 | - set_transient( 'getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS ); |
|
| 114 | - do_action( 'getpaid_update_geoip_databases' ); |
|
| 112 | + if (false === $updated) { |
|
| 113 | + set_transient('getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS); |
|
| 114 | + do_action('getpaid_update_geoip_databases'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | } |