Passed
Pull Request — master (#42)
by Farhan
05:05
created
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Details {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         $currency_symbol    = wpinv_currency_symbol();
10 10
         $statuses           = wpinv_get_invoice_statuses();
11 11
         
12
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
13
-        $invoice            = new WPInv_Invoice( $post_id );
12
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
13
+        $invoice            = new WPInv_Invoice($post_id);
14 14
         
15
-        $status             = $invoice->get_status( false ); // Current status    
15
+        $status             = $invoice->get_status(false); // Current status    
16 16
         $discount           = $invoice->get_discount();
17 17
         $discount_code      = $discount > 0 ? $invoice->get_discount_code() : '';
18 18
         $invoice_number     = $invoice->get_number();
19 19
         
20 20
         $date_created       = $invoice->get_created_date();
21
-        $datetime_created   = strtotime( $date_created );
22
-        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : '';
21
+        $datetime_created   = strtotime($date_created);
22
+        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : '';
23 23
         $date_completed     = $invoice->get_completed_date();
24
-        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a';
25
-        $title['status'] = __( 'Invoice Status:', 'invoicing' );
26
-        $title['number'] = __( 'Invoice Number:', 'invoicing' );
27
-        $mail_notice = esc_attr__( 'After save invoice this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing' );
24
+        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a';
25
+        $title['status'] = __('Invoice Status:', 'invoicing');
26
+        $title['number'] = __('Invoice Number:', 'invoicing');
27
+        $mail_notice = esc_attr__('After save invoice this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing');
28 28
         
29 29
         $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice);
30 30
         $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice);
@@ -34,29 +34,29 @@  discard block
 block discarded – undo
34 34
 <div class="gdmbx2-wrap form-table">
35 35
     <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details">
36 36
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created">
37
-            <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div>
38
-            <div class="gdmbx-td"><?php echo $date_created;?></div>
37
+            <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div>
38
+            <div class="gdmbx-td"><?php echo $date_created; ?></div>
39 39
         </div>
40
-        <?php if ( wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft' ) ) ) ) { ?>
40
+        <?php if (wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft')))) { ?>
41 41
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue">
42
-            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div>
42
+            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div>
43 43
             <div class="gdmbx-td">
44
-                <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd">
44
+                <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd">
45 45
             </div>
46 46
         </div>
47 47
         <?php } ?>
48
-        <?php if ( $date_completed && $date_completed != 'n/a' ) { ?>
48
+        <?php if ($date_completed && $date_completed != 'n/a') { ?>
49 49
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed">
50
-            <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div>
51
-            <div class="gdmbx-td"><?php echo $date_completed;?></div>
50
+            <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div>
51
+            <div class="gdmbx-td"><?php echo $date_completed; ?></div>
52 52
         </div>
53 53
         <?php } ?>
54 54
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status">
55 55
             <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div>
56 56
             <div class="gdmbx-td">
57 57
                 <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select">
58
-                    <?php foreach ( $statuses as $value => $label ) { ?>
59
-                    <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option>
58
+                    <?php foreach ($statuses as $value => $label) { ?>
59
+                    <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option>
60 60
                     <?php } ?>
61 61
                 </select>
62 62
             </div>
@@ -64,107 +64,107 @@  discard block
 block discarded – undo
64 64
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout">
65 65
             <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div>
66 66
             <div class="gdmbx-td">
67
-                <input type="text" placeholder="<?php echo esc_attr( wpinv_format_invoice_number( 1 ) ); ?>" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text">
67
+                <input type="text" placeholder="<?php echo esc_attr(wpinv_format_invoice_number(1)); ?>" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text">
68 68
             </div>
69 69
         </div>
70
-        <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); ?>
71
-        <?php if ( !( $is_paid = $invoice->is_paid() ) || $discount_code ) { ?>
70
+        <?php do_action('wpinv_meta_box_details_inner', $post_id); ?>
71
+        <?php if (!($is_paid = $invoice->is_paid()) || $discount_code) { ?>
72 72
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout">
73
-            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div>
73
+            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div>
74 74
             <div class="gdmbx-td">
75
-                <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
75
+                <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
76 76
             </div>
77 77
         </div>
78 78
         <?php } ?>
79 79
     </div>
80 80
 </div>
81 81
 <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout">
82
-    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label>
82
+    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label>
83 83
         <select id="wpi_save_send" name="wpi_save_send">
84
-            <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option>
85
-            <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option>
84
+            <option value="1"><?php _e('Yes', 'invoicing'); ?></option>
85
+            <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option>
86 86
         </select>
87 87
     </p>
88 88
     <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p>
89 89
 </div>
90
-<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?>
90
+<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?>
91 91
         <?php
92 92
     }
93 93
     
94
-    public static function resend_invoice( $post ) {
94
+    public static function resend_invoice($post) {
95 95
         global $wpi_mb_invoice;
96 96
         
97
-        if ( empty( $wpi_mb_invoice ) ) {
97
+        if (empty($wpi_mb_invoice)) {
98 98
             return;
99 99
         }
100 100
         
101 101
         $text = array(
102
-            'message'       => esc_attr__( 'This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing' ),
103
-            'button_text'   =>  __( 'Resend Invoice', 'invoicing' ),
102
+            'message'       => esc_attr__('This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing'),
103
+            'button_text'   =>  __('Resend Invoice', 'invoicing'),
104 104
         );
105 105
             
106 106
         $text = apply_filters('wpinv_resend_invoice_metabox_text', $text);
107
-        do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice );
107
+        do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice);
108 108
         
109
-        if ( $email = $wpi_mb_invoice->get_email() ) {
109
+        if ($email = $wpi_mb_invoice->get_email()) {
110 110
             $email_actions = array();
111
-            $email_actions['email_url']      = add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) );
112
-            $email_actions['reminder_url']   = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) );
111
+            $email_actions['email_url']      = add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID));
112
+            $email_actions['reminder_url']   = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID));
113 113
             
114
-            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions );
114
+            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions);
115 115
         ?>
116 116
         <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p>
117
-        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
118
-        <?php if ( wpinv_get_option( 'overdue_active' ) && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?>
119
-        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p>
117
+        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
118
+        <?php if (wpinv_get_option('overdue_active') && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?>
119
+        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p>
120 120
         <?php } ?>
121 121
         <?php
122 122
         }
123 123
         
124
-        do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice );
124
+        do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice);
125 125
     }
126 126
     
127
-    public static function subscriptions( $post ) {
127
+    public static function subscriptions($post) {
128 128
         global $wpi_mb_invoice;
129 129
         
130 130
         $invoice = $wpi_mb_invoice;
131 131
         
132
-        if ( !empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) {
132
+        if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) {
133 133
             $payments       = $invoice->get_child_payments();
134 134
             
135 135
             $total_payments = (int)$invoice->get_total_payments();
136 136
             $subscription   = $invoice->get_subscription_data();
137 137
 
138
-            $billing_cycle  = wpinv_get_billing_cycle( $subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency() );
139
-            $times_billed   = $total_payments . ' / ' . ( ( (int)$subscription['bill_times'] == 0 ) ? __( 'Until cancelled', 'invoicing' ) : $subscription['bill_times'] );
138
+            $billing_cycle  = wpinv_get_billing_cycle($subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency());
139
+            $times_billed   = $total_payments . ' / ' . (((int)$subscription['bill_times'] == 0) ? __('Until cancelled', 'invoicing') : $subscription['bill_times']);
140 140
             $subscription_status = $invoice->get_subscription_status();
141 141
             ?>
142
-            <p class="wpi-meta-row wpi-sub-label"><?php _e( 'Recurring Payment', 'invoicing' );?></p>
143
-            <?php if ( $subscription_id = $invoice->get_subscription_id() ) { ?>
144
-            <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $subscription_id; ?></p>
142
+            <p class="wpi-meta-row wpi-sub-label"><?php _e('Recurring Payment', 'invoicing'); ?></p>
143
+            <?php if ($subscription_id = $invoice->get_subscription_id()) { ?>
144
+            <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $subscription_id; ?></p>
145 145
             <?php } ?>
146
-            <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e( 'Billing Cycle:', 'invoicing' );?> </label><?php echo $billing_cycle; ?></p>
147
-            <p class="wpi-meta-row wpi-billed-times"><label><?php _e( 'Times Billed:', 'invoicing' );?> </label><?php echo $times_billed; ?></p>
148
-            <?php if ( !empty( $payments ) || $invoice->is_paid() ) { ?>
149
-                <p class="wpi-meta-row wpi-start-date"><label><?php _e( 'Start Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_start(); ?></p>
150
-                <p class="wpi-meta-row wpi-end-date"><label><?php _e( 'Expiration Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_end(); ?></p>
151
-                <?php if ( $status_label = $invoice->get_subscription_status_label( $subscription_status ) ) { ?>
152
-                <p class="wpi-meta-row wpi-sub-status"><label><?php _e( 'Subscription Status:', 'invoicing' );?> </label><?php echo $status_label; ?></p>
146
+            <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php echo $billing_cycle; ?></p>
147
+            <p class="wpi-meta-row wpi-billed-times"><label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $times_billed; ?></p>
148
+            <?php if (!empty($payments) || $invoice->is_paid()) { ?>
149
+                <p class="wpi-meta-row wpi-start-date"><label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_start(); ?></p>
150
+                <p class="wpi-meta-row wpi-end-date"><label><?php _e('Expiration Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_end(); ?></p>
151
+                <?php if ($status_label = $invoice->get_subscription_status_label($subscription_status)) { ?>
152
+                <p class="wpi-meta-row wpi-sub-status"><label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $status_label; ?></p>
153 153
                 <?php } ?>
154
-                <?php if ( $subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date() ) { ?>
155
-                <p class="wpi-meta-row wpi-trial-date"><label><?php _e( 'Trial Until:', 'invoicing' );?> </label><?php echo $trial_end_date; ?></p>
154
+                <?php if ($subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date()) { ?>
155
+                <p class="wpi-meta-row wpi-trial-date"><label><?php _e('Trial Until:', 'invoicing'); ?> </label><?php echo $trial_end_date; ?></p>
156 156
                 <?php } ?>
157
-                <?php if ( $cancelled_date = $invoice->get_cancelled_date() ) { ?>
158
-                <p class="wpi-meta-row wpi-cancel-date"><label><?php _e( 'Cancelled On:', 'invoicing' );?> </label><?php echo $cancelled_date; ?></p>
157
+                <?php if ($cancelled_date = $invoice->get_cancelled_date()) { ?>
158
+                <p class="wpi-meta-row wpi-cancel-date"><label><?php _e('Cancelled On:', 'invoicing'); ?> </label><?php echo $cancelled_date; ?></p>
159 159
                 <?php } ?>
160
-                <?php if ( !empty( $payments ) ) { ?>
161
-                <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p>
160
+                <?php if (!empty($payments)) { ?>
161
+                <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p>
162 162
                 <ul id="wpi-sub-payments">
163
-                <?php foreach ( $payments as $invoice_id ) { ?>
163
+                <?php foreach ($payments as $invoice_id) { ?>
164 164
                     <li>
165
-                        <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a>&nbsp;&ndash;&nbsp;
166
-                        <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?>&nbsp;&ndash;&nbsp;</span>
167
-                        <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span>
165
+                        <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a>&nbsp;&ndash;&nbsp;
166
+                        <span><?php echo wpinv_get_invoice_date($invoice_id); ?>&nbsp;&ndash;&nbsp;</span>
167
+                        <span><?php echo wpinv_payment_total($invoice_id, true); ?></span>
168 168
                     </li>
169 169
                 <?php } ?>
170 170
                 </ul>
@@ -172,47 +172,47 @@  discard block
 block discarded – undo
172 172
         }
173 173
     }
174 174
     
175
-    public static function renewals( $post ) {
175
+    public static function renewals($post) {
176 176
         global $wpi_mb_invoice;
177 177
         
178
-        if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) {
179
-            $parent_url = get_edit_post_link( $wpi_mb_invoice->parent_invoice );
180
-            $parent_id  = wpinv_get_invoice_number( $wpi_mb_invoice->parent_invoice );
178
+        if (wpinv_is_subscription_payment($wpi_mb_invoice)) {
179
+            $parent_url = get_edit_post_link($wpi_mb_invoice->parent_invoice);
180
+            $parent_id  = wpinv_get_invoice_number($wpi_mb_invoice->parent_invoice);
181 181
         ?>
182
-        <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p>
183
-        <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p>
182
+        <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p>
183
+        <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p>
184 184
         <?php
185 185
         }
186 186
     }
187 187
     
188
-    public static function payment_meta( $post ) {
188
+    public static function payment_meta($post) {
189 189
         global $wpi_mb_invoice;
190 190
 
191
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
192
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() ) {
191
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
192
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid()) {
193 193
             $set_dateway = true;
194 194
         }
195 195
         
196 196
         ?>
197 197
         <p class="wpi-meta-row">
198
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
199
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
198
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
199
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
200 200
             <select required="required" id="wpinv_gateway" name="wpinv_gateway">
201
-                <?php foreach ( $gateways as $name => $gateway ) {
202
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
201
+                <?php foreach ($gateways as $name => $gateway) {
202
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
203 203
                         continue;
204 204
                     }
205 205
                     ?>
206
-                <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
206
+                <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
207 207
                 <?php } ?>
208 208
             </select>
209 209
         <?php } else { 
210
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_checkout_label( $wpi_mb_invoice->gateway ) );
210
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_checkout_label($wpi_mb_invoice->gateway));
211 211
         } ?>
212 212
         </p>
213
-        <?php if ( $wpi_mb_invoice->is_paid() ) { ?>
214
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $wpi_mb_invoice->get_key() ); ?></p>
215
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
213
+        <?php if ($wpi_mb_invoice->is_paid()) { ?>
214
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $wpi_mb_invoice->get_key()); ?></p>
215
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
216 216
         <?php } ?>
217 217
         <?php
218 218
     }
Please login to merge, or discard this patch.