Passed
Push — master ( a15c21...706a80 )
by Stiofan
04:34
created
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-items.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
     }
320 320
 
321 321
     /**
322
-	 * Output the metabox.
323
-	 *
324
-	 * @param WP_Post $post
325
-	 */
322
+     * Output the metabox.
323
+     *
324
+     * @param WP_Post $post
325
+     */
326 326
     public static function output2( $post ) {
327 327
 
328 328
         // Prepare the invoice.
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -16,78 +16,78 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class GetPaid_Meta_Box_Invoice_Items {
18 18
 
19
-    public static function get_columns( $invoice ) {
19
+    public static function get_columns($invoice) {
20 20
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
21 21
         $columns            = array(
22
-            'id'     => __( 'ID', 'invoicing' ),
23
-            'title'  => __( 'Item', 'invoicing' ),
22
+            'id'     => __('ID', 'invoicing'),
23
+            'title'  => __('Item', 'invoicing'),
24 24
             'price'  => sprintf(
25 25
                 '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span>
26 26
                 <span class="getpaid-hide-if-hours hide-if-amount">%s</span>
27 27
                 <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>',
28
-                __( 'Amount', 'invoicing' ),
29
-                __( 'Price', 'invoicing' ),
30
-                __( 'Rate', 'invoicing' )
28
+                __('Amount', 'invoicing'),
29
+                __('Price', 'invoicing'),
30
+                __('Rate', 'invoicing')
31 31
             ),
32 32
             'qty'    => sprintf(
33 33
                 '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>',
34
-                __( 'Quantity', 'invoicing' ),
35
-                __( 'Hours', 'invoicing' )
34
+                __('Quantity', 'invoicing'),
35
+                __('Hours', 'invoicing')
36 36
             ),
37
-            'total'  => __( 'Total', 'invoicing' ),
38
-            'tax'    => __( 'Tax (%)', 'invoicing' ),
37
+            'total'  => __('Total', 'invoicing'),
38
+            'tax'    => __('Tax (%)', 'invoicing'),
39 39
             'action' => '',
40 40
         );
41 41
 
42
-        if ( ! $use_taxes ) {
43
-            unset( $columns['tax'] );
42
+        if (!$use_taxes) {
43
+            unset($columns['tax']);
44 44
         }
45 45
 
46 46
         return $columns;
47 47
     }
48 48
 
49
-    public static function output( $post, $invoice = false ) {
49
+    public static function output($post, $invoice = false) {
50 50
 
51
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
52
-        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id );
51
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
52
+        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id);
53 53
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
54
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
55
-        $columns            = self::get_columns( $invoice );
56
-        $cols               = count( $columns );
54
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
55
+        $columns            = self::get_columns($invoice);
56
+        $cols               = count($columns);
57 57
         $class              = '';
58 58
 
59
-        unset( $item_types['adv'] );
60
-        unset( $item_types['package'] );
59
+        unset($item_types['adv']);
60
+        unset($item_types['package']);
61 61
 
62
-        if ( $invoice->is_paid() ) {
62
+        if ($invoice->is_paid()) {
63 63
             $class .= ' wpinv-paid';
64 64
         }
65 65
 
66
-        if ( $invoice->is_refunded() ) {
66
+        if ($invoice->is_refunded()) {
67 67
             $class .= ' wpinv-refunded';
68 68
         }
69 69
 
70
-        if ( $invoice->is_recurring() ) {
70
+        if ($invoice->is_recurring()) {
71 71
             $class .= ' wpi-recurring';
72 72
         }
73 73
 
74 74
     ?>
75 75
 
76
-        <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>">
76
+        <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>">
77 77
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
78 78
 
79 79
                 <thead>
80 80
                     <tr>
81
-                        <?php foreach ( $columns as $key => $label ) : ?>
82
-                            <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th>
81
+                        <?php foreach ($columns as $key => $label) : ?>
82
+                            <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th>
83 83
                         <?php endforeach; ?>
84 84
                     </tr>
85 85
                 </thead>
86 86
 
87 87
                 <tbody class="wpinv-line-items">
88 88
                     <?php
89
-                        foreach ( $invoice->get_items() as $int => $item ) {
90
-                            self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' );
89
+                        foreach ($invoice->get_items() as $int => $item) {
90
+                            self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd');
91 91
                         }
92 92
                     ?>
93 93
                 </tbody>
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                                             <div class="wp-clearfix">
105 105
                                                 <label class="wpi-item-name">
106 106
                                                     <span class="input-text-wrap">
107
-                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
107
+                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
108 108
                                                     </span>
109 109
                                                 </label>
110 110
                                             </div>
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
                                             <div class="wp-clearfix">
113 113
                                                 <label class="wpi-item-price">
114 114
                                                     <span class="input-text-wrap">
115
-                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
116
-                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
115
+                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
116
+                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
117 117
                                                     </span>
118 118
                                                 </label>
119 119
                                             </div>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                                             <div class="wp-clearfix">
122 122
                                                 <label class="wpi-item-name">
123 123
                                                     <span class="input-text-wrap">
124
-                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
124
+                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
125 125
                                                     </span>
126 126
                                                 </label>
127 127
                                             </div>
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                                             <div class="wp-clearfix">
130 130
                                                 <label class="wpi-item-type">
131 131
                                                     <span class="input-text-wrap">
132
-                                                        <?php echo wpinv_html_select( array(
132
+                                                        <?php echo wpinv_html_select(array(
133 133
                                                             'options'          => $item_types,
134 134
                                                             'name'             => '_wpinv_quick[type]',
135 135
                                                             'id'               => '_wpinv_quick_type',
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
                                                             'show_option_all'  => false,
138 138
                                                             'show_option_none' => false,
139 139
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type',
140
-                                                        ) ); ?>
140
+                                                        )); ?>
141 141
                                                     </span>
142 142
                                                 </label>
143 143
                                             </div>
144 144
 
145
-                                            <?php if ( $use_taxes ) : ?>
145
+                                            <?php if ($use_taxes) : ?>
146 146
                                                 <div class="wp-clearfix">
147 147
                                                     <label class="wpi-vat-rule">
148 148
                                                         <span class="input-text-wrap">
149 149
                                                             <?php
150
-                                                                echo wpinv_html_select( array(
150
+                                                                echo wpinv_html_select(array(
151 151
                                                                     'options'          => array_merge(
152
-                                                                        array( '' => __( 'Select VAT Rule', 'invoicing' ) ),
152
+                                                                        array('' => __('Select VAT Rule', 'invoicing')),
153 153
                                                                         getpaid_get_tax_rules()
154 154
                                                                     ),
155 155
                                                                     'name'             => '_wpinv_quick[vat_rule]',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                                                                     'show_option_all'  => false,
158 158
                                                                     'show_option_none' => false,
159 159
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
160
-                                                                ) );
160
+                                                                ));
161 161
                                                             ?>
162 162
                                                         </span>
163 163
                                                     </label>
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
                                                     <label class="wpi-vat-class">
167 167
                                                         <span class="input-text-wrap">
168 168
                                                             <?php
169
-                                                                echo wpinv_html_select( array(
169
+                                                                echo wpinv_html_select(array(
170 170
                                                                     'options'          => array_merge(
171
-                                                                        array( '' => __( 'Select VAT Class', 'invoicing' ) ),
171
+                                                                        array('' => __('Select VAT Class', 'invoicing')),
172 172
                                                                         getpaid_get_tax_classes()
173 173
                                                                     ),
174 174
                                                                     'name'             => '_wpinv_quick[vat_class]',
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                                                                     'show_option_all'  => false,
177 177
                                                                     'show_option_none' => false,
178 178
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
179
-                                                                ) );
179
+                                                                ));
180 180
                                                             ?>
181 181
                                                         </span>
182 182
                                                     </label>
@@ -197,29 +197,29 @@  discard block
 block discarded – undo
197 197
                         </td>
198 198
                     </tr>
199 199
                     <tr class="totals">
200
-                        <td colspan="<?php echo ( $cols - 4 ); ?>"></td>
200
+                        <td colspan="<?php echo ($cols - 4); ?>"></td>
201 201
                         <td colspan="4">
202 202
                             <table cellspacing="0" cellpadding="0">
203 203
                                 <tr class="subtotal">
204
-                                    <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td>
205
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td>
204
+                                    <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td>
205
+                                    <td class="total"><?php echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td>
206 206
                                     <td class="action"></td>
207 207
                                 </tr>
208 208
                                 <tr class="discount">
209
-                                    <td class="name"><?php _e( 'Discount:', 'invoicing' ) ; ?></td>
210
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td>
209
+                                    <td class="name"><?php _e('Discount:', 'invoicing'); ?></td>
210
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td>
211 211
                                     <td class="action"></td>
212 212
                                 </tr>
213
-                                <?php if ( $use_taxes ) : ?>
213
+                                <?php if ($use_taxes) : ?>
214 214
                                 <tr class="tax">
215
-                                    <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td>
216
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td>
215
+                                    <td class="name"><?php _e('Tax:', 'invoicing'); ?></td>
216
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td>
217 217
                                     <td class="action"></td>
218 218
                                 </tr>
219 219
                                 <?php endif; ?>
220 220
                                 <tr class="total">
221
-                                    <td class="name"><?php _e( 'Total:', 'invoicing' );?></td>
222
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total(), $invoice->get_currency() );?></td>
221
+                                    <td class="name"><?php _e('Total:', 'invoicing'); ?></td>
222
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total(), $invoice->get_currency()); ?></td>
223 223
                                     <td class="action"></td>
224 224
                                 </tr>
225 225
                             </table>
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             </table>
231 231
             <div class="wpinv-actions">
232 232
                 <?php
233
-                    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
233
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
234 234
                         echo wpinv_item_dropdown(
235 235
                             array(
236 236
                                 'name'             => 'wpinv_invoice_item',
@@ -240,61 +240,61 @@  discard block
 block discarded – undo
240 240
                             )
241 241
                         );
242 242
 
243
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), $invoice->get_label() ) . '</button>';
244
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>';
245
-                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>';
243
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), $invoice->get_label()) . '</button>';
244
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>';
245
+                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>';
246 246
 
247 247
                     }
248 248
                 ?>
249
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
249
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
250 250
             </div>
251 251
         </div>
252 252
         <?php
253 253
     }
254 254
 
255
-    public static function output_row( $columns, $item, $invoice, $class='even' ) {
255
+    public static function output_row($columns, $item, $invoice, $class = 'even') {
256 256
 
257 257
     ?>
258
-        <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>">
259
-            <?php foreach ( array_keys( $columns ) as $column ) : ?>
260
-                <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
258
+        <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>">
259
+            <?php foreach (array_keys($columns) as $column) : ?>
260
+                <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
261 261
                     <?php
262
-                        switch ( $column ) {
262
+                        switch ($column) {
263 263
                             case 'id':
264 264
                                 echo (int) $item->get_id();
265 265
                                 break;
266 266
                             case 'title':
267 267
                                 printf(
268 268
                                     '<a href="%s" target="_blank">%s</a>',
269
-                                    get_edit_post_link( $item->get_id() ),
270
-                                    esc_html( $item->get_raw_name() )
269
+                                    get_edit_post_link($item->get_id()),
270
+                                    esc_html($item->get_raw_name())
271 271
                                 );
272 272
 
273
-                                $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
274
-                                if ( $summary !== '' ) {
273
+                                $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
274
+                                if ($summary !== '') {
275 275
                                     printf(
276 276
                                         '<span class="meta">%s</span>',
277
-                                        wpautop( wp_kses_post( $summary ) )
277
+                                        wpautop(wp_kses_post($summary))
278 278
                                     );
279 279
                                 }
280 280
 
281 281
                                 printf(
282 282
                                     '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />',
283
-                                    esc_attr( $item->get_raw_name() ),
283
+                                    esc_attr($item->get_raw_name()),
284 284
                                     (int) $item->get_id()
285 285
                                 );
286 286
 
287 287
                                 printf(
288 288
                                     '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>',
289 289
                                     (int) $item->get_id(),
290
-                                    esc_attr( $item->get_description() )
290
+                                    esc_attr($item->get_description())
291 291
                                 );
292 292
 
293 293
                                 break;
294 294
                             case 'price':
295 295
                                 printf(
296 296
                                     '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />',
297
-                                    esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ),
297
+                                    esc_attr(getpaid_unstandardize_amount($item->get_price())),
298 298
                                     (int) $item->get_id()
299 299
                                 );
300 300
 
@@ -302,26 +302,26 @@  discard block
 block discarded – undo
302 302
                             case 'qty':
303 303
                                 printf(
304 304
                                     '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />',
305
-                                    floatval( $item->get_quantity() ),
305
+                                    floatval($item->get_quantity()),
306 306
                                     (int) $item->get_id()
307 307
                                 );
308 308
 
309 309
                                 break;
310 310
                             case 'total':
311
-                                echo wpinv_price( $item->get_sub_total(), $invoice->get_currency() );
311
+                                echo wpinv_price($item->get_sub_total(), $invoice->get_currency());
312 312
 
313 313
                                 break;
314 314
                             case 'tax':
315
-                                echo wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%';
315
+                                echo wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%';
316 316
 
317 317
                                 break;
318 318
                             case 'action':
319
-                                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
319
+                                if (!$invoice->is_paid() && !$invoice->is_refunded()) {
320 320
                                     echo '<i class="fa fa-trash wpinv-item-remove"></i>';
321 321
                                 }
322 322
                                 break;
323 323
                         }
324
-                        do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice );
324
+                        do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice);
325 325
                     ?>
326 326
                 </td>
327 327
             <?php endforeach; ?>
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 	 *
335 335
 	 * @param WP_Post $post
336 336
 	 */
337
-    public static function output2( $post ) {
337
+    public static function output2($post) {
338 338
 
339 339
         // Prepare the invoice.
340
-        $invoice = new WPInv_Invoice( $post );
340
+        $invoice = new WPInv_Invoice($post);
341 341
 
342 342
         // Invoice items.
343 343
         $items = $invoice->get_items();
@@ -345,28 +345,28 @@  discard block
 block discarded – undo
345 345
         $totals = array(
346 346
 
347 347
             'subtotal'  => array(
348
-                'label' => __( 'Items Subtotal', 'invoicing' ),
349
-                'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),
348
+                'label' => __('Items Subtotal', 'invoicing'),
349
+                'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),
350 350
             ),
351 351
 
352 352
             'discount'  => array(
353
-                'label' => __( 'Total Discount', 'invoicing' ),
354
-                'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
353
+                'label' => __('Total Discount', 'invoicing'),
354
+                'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
355 355
             ),
356 356
 
357 357
             'tax'       => array(
358
-                'label' => __( 'Total Tax', 'invoicing' ),
359
-                'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),
358
+                'label' => __('Total Tax', 'invoicing'),
359
+                'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),
360 360
             ),
361 361
 
362 362
             'total'     => array(
363
-                'label' => __( 'Invoice Total', 'invoicing' ),
364
-                'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
363
+                'label' => __('Invoice Total', 'invoicing'),
364
+                'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
365 365
             )
366 366
         );
367 367
 
368
-        if ( ! wpinv_use_taxes() ) {
369
-            unset( $totals['tax'] );
368
+        if (!wpinv_use_taxes()) {
369
+            unset($totals['tax']);
370 370
         }
371 371
 
372 372
         $item_args = array(
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             'orderby'        => 'title',
375 375
             'order'          => 'ASC',
376 376
             'posts_per_page' => -1,
377
-            'post_status'    => array( 'publish' ),
377
+            'post_status'    => array('publish'),
378 378
             'meta_query'     => array(
379 379
                 array(
380 380
                     'key'       => '_wpinv_type',
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
             }
399 399
         </style>
400 400
 
401
-                <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class( $invoice->get_template( 'edit' ) ); ?> <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem">
401
+                <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class($invoice->get_template('edit')); ?> <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem">
402 402
 
403
-                    <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
404
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
403
+                    <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
404
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
405 405
 
406 406
                         <div class="row">
407 407
                             <div class="col-12 col-sm-6">
@@ -410,15 +410,15 @@  discard block
 block discarded – undo
410 410
                                         array(
411 411
                                             'id'          => 'wpinv_template',
412 412
                                             'name'        => 'wpinv_template',
413
-                                            'label'       => __( 'Template', 'invoicing' ),
413
+                                            'label'       => __('Template', 'invoicing'),
414 414
                                             'label_type'  => 'vertical',
415
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
415
+                                            'placeholder' => __('Choose a template', 'invoicing'),
416 416
                                             'class'       => 'form-control-sm',
417
-                                            'value'       => $invoice->get_template( 'edit' ),
417
+                                            'value'       => $invoice->get_template('edit'),
418 418
                                             'options'     => array(
419
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
420
-                                                'hours'    => __( 'Hours', 'invoicing' ),
421
-                                                'amount'   => __( 'Amount Only', 'invoicing' ),
419
+                                                'quantity' => __('Quantity', 'invoicing'),
420
+                                                'hours'    => __('Hours', 'invoicing'),
421
+                                                'amount'   => __('Amount Only', 'invoicing'),
422 422
                                             ),
423 423
                                             'data-allow-clear' => 'false',
424 424
                                             'select2'          => true,
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
                                         array(
435 435
                                             'id'          => 'wpinv_currency',
436 436
                                             'name'        => 'wpinv_currency',
437
-                                            'label'       => __( 'Currency', 'invoicing' ),
437
+                                            'label'       => __('Currency', 'invoicing'),
438 438
                                             'label_type'  => 'vertical',
439
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
439
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
440 440
                                             'class'       => 'form-control-sm',
441
-                                            'value'       => $invoice->get_currency( 'edit' ),
441
+                                            'value'       => $invoice->get_currency('edit'),
442 442
                                             'required'    => false,
443 443
                                             'data-allow-clear' => 'false',
444 444
                                             'select2'          => true,
@@ -450,24 +450,24 @@  discard block
 block discarded – undo
450 450
                             </div>
451 451
                         </div>
452 452
 
453
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
453
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
454 454
                     <?php endif; ?>
455 455
 
456 456
                     <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">
457 457
                         <thead>
458 458
                             <tr>
459
-                                <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th>
459
+                                <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th>
460 460
                                 <th class="getpaid-quantity hide-if-amount text-right">
461
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
462
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
461
+                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
462
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
463 463
                                 </th>
464 464
                                 <th class="getpaid-price hide-if-amount text-right">
465
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span>
466
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span>
465
+                                    <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span>
466
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span>
467 467
                                 </th>
468 468
                                 <th class="getpaid-item-subtotal text-right">
469
-                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span>
470
-                                    <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span>
469
+                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span>
470
+                                    <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span>
471 471
                                 </th>
472 472
                                 <th class="getpaid-item-actions hide-if-not-editable" width="70px">&nbsp;</th>
473 473
                             </tr>
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 		                <tbody class="getpaid_invoice_line_items">
476 476
                             <tr class="hide-if-has-items hide-if-not-editable">
477 477
                                 <td colspan="2" class="pt-4 pb-4">
478
-                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button>
479
-                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button>
478
+                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button>
479
+                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button>
480 480
                                 </td>
481 481
                                 <td class="hide-if-amount">&nbsp;</th>
482 482
                                 <td class="hide-if-amount">&nbsp;</th>
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
                             <div class="col-12 col-sm-6 offset-sm-6">
509 509
                                 <table class="getpaid-invoice-totals text-right w-100">
510 510
                                     <tbody>
511
-                                        <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?>
512
-                                            <tr class="getpaid-totals-<?php echo sanitize_html_class( $key ); ?>">
513
-                                                <td class="label"><?php echo sanitize_text_field( $data['label'] ) ?>:</td>
511
+                                        <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?>
512
+                                            <tr class="getpaid-totals-<?php echo sanitize_html_class($key); ?>">
513
+                                                <td class="label"><?php echo sanitize_text_field($data['label']) ?>:</td>
514 514
                                                 <td width="1%"></td>
515
-                                                <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td>
515
+                                                <td class="value"><?php echo wp_kses_post($data['value']) ?></td>
516 516
                                             </tr>
517 517
                                         <?php endforeach; ?>
518 518
                                     </tbody>
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
                     <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable">
526 526
                         <div class="row">
527 527
                             <div class="text-left col-12 col-sm-8">
528
-                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button>
529
-                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button>
530
-                                <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>
528
+                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button>
529
+                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button>
530
+                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?>
531 531
                             </div>
532 532
                             <div class="text-right col-12 col-sm-4">
533
-                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button>
533
+                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button>
534 534
                             </div>
535 535
                         </div>
536 536
                     </div>
537 537
 
538 538
                     <div class="getpaid-invoice-item-actions hide-if-editable">
539
-                        <p class="description m-2 text-right text-muted"><?php _e( 'This invoice is no longer editable', 'invoicing' ); ?></p>
539
+                        <p class="description m-2 text-right text-muted"><?php _e('This invoice is no longer editable', 'invoicing'); ?></p>
540 540
                     </div>
541 541
 
542 542
                     <!-- Add items to an invoice -->
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
                         <div class="modal-dialog modal-dialog-centered" role="document">
545 545
                             <div class="modal-content">
546 546
                                 <div class="modal-header">
547
-                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5>
548
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
547
+                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5>
548
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
549 549
                                         <span aria-hidden="true">&times;</span>
550 550
                                     </button>
551 551
                                 </div>
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
                                     <table class="widefat">
554 554
                                         <thead>
555 555
                                             <tr>
556
-                                                <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th>
556
+                                                <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th>
557 557
                                                 <th class="pr-0 text-right hide-if-amount">
558
-                                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
559
-                                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
558
+                                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
559
+                                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
560 560
                                                 </th>
561 561
                                             </tr>
562 562
                                         </thead>
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 								            <tr>
565 565
 									            <td class="pl-0 text-left">
566 566
                                                     <select class="regular-text getpaid-add-invoice-item-select">
567
-                                                        <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option>
568
-                                                        <?php foreach ( get_posts( $item_args ) as $item ) : ?>
569
-                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags( $item->post_title ); ?></option>
567
+                                                        <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option>
568
+                                                        <?php foreach (get_posts($item_args) as $item) : ?>
569
+                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags($item->post_title); ?></option>
570 570
                                                         <?php endforeach; ?>
571 571
                                                     </select>
572 572
                                                 </td>
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
 						            </table>
579 579
                                 </div>
580 580
                                 <div class="modal-footer">
581
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
582
-                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button>
581
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
582
+                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button>
583 583
                                 </div>
584 584
                             </div>
585 585
                         </div>
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
                         <div class="modal-dialog modal-dialog-centered" role="document">
591 591
                             <div class="modal-content">
592 592
                                 <div class="modal-header">
593
-                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e( "Create Item", 'invoicing' ); ?></h5>
594
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
593
+                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e("Create Item", 'invoicing'); ?></h5>
594
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
595 595
                                         <span aria-hidden="true">&times;</span>
596 596
                                     </button>
597 597
                                 </div>
@@ -599,27 +599,27 @@  discard block
 block discarded – undo
599 599
                                     <div class="getpaid-create-item-div">
600 600
                                         <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id">
601 601
                                         <label class="form-group w-100">
602
-                                            <span><?php _e( 'Name', 'invoicing' ); ?></span>
603
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
602
+                                            <span><?php _e('Name', 'invoicing'); ?></span>
603
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
604 604
                                         </label>
605 605
                                         <label class="form-group w-100">
606
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span>
607
-                                            <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span>
608
-                                            <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
606
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span>
607
+                                            <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span>
608
+                                            <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
609 609
                                         </label>
610 610
                                         <label class="form-group w-100 hide-if-amount">
611
-                                            <span><?php _e( 'Quantity', 'invoicing' ); ?></span>
611
+                                            <span><?php _e('Quantity', 'invoicing'); ?></span>
612 612
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
613 613
                                         </label>
614 614
                                         <label class="form-group w-100">
615
-                                            <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
616
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
615
+                                            <span><?php _e('Item Description', 'invoicing'); ?></span>
616
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
617 617
                                         </label>
618 618
                                     </div>
619 619
                                 </div>
620 620
                                 <div class="modal-footer">
621
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
622
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Create', 'invoicing' ); ?></button>
621
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
622
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Create', 'invoicing'); ?></button>
623 623
                                 </div>
624 624
                             </div>
625 625
                         </div>
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
                         <div class="modal-dialog modal-dialog-centered" role="document">
631 631
                             <div class="modal-content">
632 632
                                 <div class="modal-header">
633
-                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5>
634
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
633
+                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5>
634
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
635 635
                                         <span aria-hidden="true">&times;</span>
636 636
                                     </button>
637 637
                                 </div>
@@ -639,27 +639,27 @@  discard block
 block discarded – undo
639 639
                                     <div class="getpaid-edit-item-div">
640 640
                                         <input type="hidden" name="id" class="form-control form-control-sm item-id">
641 641
                                         <label class="form-group w-100">
642
-                                            <span><?php _e( 'Name', 'invoicing' ); ?></span>
643
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
642
+                                            <span><?php _e('Name', 'invoicing'); ?></span>
643
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
644 644
                                         </label>
645 645
                                         <label class="form-group w-100">
646
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span>
647
-                                            <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span>
648
-                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
646
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span>
647
+                                            <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span>
648
+                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
649 649
                                         </label>
650 650
                                         <label class="form-group w-100 hide-if-amount">
651
-                                            <span><?php _e( 'Quantity', 'invoicing' ); ?></span>
651
+                                            <span><?php _e('Quantity', 'invoicing'); ?></span>
652 652
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
653 653
                                         </label>
654 654
                                         <label class="form-group w-100">
655
-                                            <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
656
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
655
+                                            <span><?php _e('Item Description', 'invoicing'); ?></span>
656
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
657 657
                                         </label>
658 658
                                     </div>
659 659
                                 </div>
660 660
                                 <div class="modal-footer">
661
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
662
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button>
661
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
662
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button>
663 663
                                 </div>
664 664
                             </div>
665 665
                         </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-thank-you.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,68 +4,68 @@
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
11 11
 <div class="card shadow-sm my-5">
12 12
 	<div class="text-center card-body">
13
-		<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to Get Paid', 'invoicing' ); ?></h1>
13
+		<h1 class="h3"><?php esc_html_e('Awesome, you are ready to Get Paid', 'invoicing'); ?></h1>
14 14
 
15 15
 		<div class="geodirectory-message geodirectory-tracker">
16
-			<p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p>
16
+			<p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p>
17 17
 		</div>
18 18
 
19 19
 		<div class="gp-setup-next-steps">
20 20
 			<div class="gp-setup-next-steps-first mb-4">
21 21
 				<div>
22
-					<h2 class="h3"><i class="fas fa-arrow-down"></i> <?php esc_html_e( 'Watch This', 'invoicing' ); ?> <i class="fas fa-arrow-down"></i></h2>
22
+					<h2 class="h3"><i class="fas fa-arrow-down"></i> <?php esc_html_e('Watch This', 'invoicing'); ?> <i class="fas fa-arrow-down"></i></h2>
23 23
 					<div class="embed-responsive embed-responsive-16by9 mb-4">
24 24
 						<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/TXZuPXHjt9E?rel=0" allowfullscreen></iframe>
25 25
 					</div>
26 26
 				</div>
27
-				<h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2>
27
+				<h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2>
28 28
 
29 29
 				<div class="d-flex justify-content-between">
30 30
 					<a
31 31
 						class="btn btn-outline-primary btn-sm"
32
-						href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>">
32
+						href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>">
33 33
 						<span class="h1 d-block"><i class="fas fa-box-open"></i></span>
34
-						<?php esc_html_e( 'Create Item', 'invoicing' ); ?>
34
+						<?php esc_html_e('Create Item', 'invoicing'); ?>
35 35
 					</a>
36 36
 					<a
37 37
 						class="btn btn-outline-primary btn-sm"
38
-						href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_payment_form' ) ); ?>">
38
+						href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_payment_form')); ?>">
39 39
 						<span class="h1 d-block"><i class="fas fa-align-justify"></i></span>
40
-						<?php esc_html_e( 'Create Payment Form', 'invoicing' ); ?>
40
+						<?php esc_html_e('Create Payment Form', 'invoicing'); ?>
41 41
 					</a>
42 42
 					<a
43 43
 						class="btn btn-outline-primary btn-sm"
44
-						href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_invoice' ) ); ?>">
44
+						href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_invoice')); ?>">
45 45
 						<span class="h1 d-block"><i class="fas fa-file-alt"></i></span>
46
-						<?php esc_html_e( 'Create Invoice', 'invoicing' ); ?>
46
+						<?php esc_html_e('Create Invoice', 'invoicing'); ?>
47 47
 					</a>
48 48
 				</div>
49 49
 
50 50
 
51 51
 
52
-						<h2 class="h3 mt-4"><?php _e( 'Learn more', 'invoicing' ); ?></h2>
52
+						<h2 class="h3 mt-4"><?php _e('Learn more', 'invoicing'); ?></h2>
53 53
 				<div class="gp-setup-next-steps-last mt-2 d-flex justify-content-between">
54 54
 						<a
55 55
 							class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin"
56
-							target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a>
56
+							target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a>
57 57
 						<a
58 58
 							class="btn btn-outline-primary btn-sm"
59 59
 							href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin"
60
-							target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
60
+							target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
61 61
 						<a
62 62
 							class="btn btn-outline-primary btn-sm"
63 63
 							href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin"
64
-							target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a>
64
+							target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a>
65 65
 						<a
66 66
 							class="btn btn-outline-primary btn-sm"
67 67
 							href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin"
68
-							target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a>
68
+							target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a>
69 69
 					</div>
70 70
 			</div>
71 71
 		</div>
Please login to merge, or discard this patch.
vendor/ayecode/wp-deactivation-survey/plugin.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
  */
16 16
 
17 17
 if ( ! defined( 'ABSPATH' ) ) {
18
-	exit;
18
+    exit;
19 19
 }
20 20
 
21 21
 if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) {
22
-	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" );
22
+    // include the class if needed
23
+    include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" );
24 24
 }
25 25
 
26 26
 
@@ -36,6 +36,6 @@  discard block
 block discarded – undo
36 36
 //});
37 37
 
38 38
 AyeCode_Deactivation_Survey::instance(array(
39
-	'slug'		=> 'ayecode-deactivation-survey-testing',
40
-	'version'	=> '1.0.0'
39
+    'slug'		=> 'ayecode-deactivation-survey-testing',
40
+    'version'	=> '1.0.0'
41 41
 ));
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
  * Tested up to: 5.8
15 15
  */
16 16
 
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21
-if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) {
21
+if (!class_exists('AyeCode_Deactivation_Survey')) {
22 22
 	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" );
23
+	include_once(dirname(__FILE__) . "/wp-deactivation-survey.php");
24 24
 }
25 25
 
26 26
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-deactivation-survey/wp-deactivation-survey.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,102 +1,102 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit;
4
+    exit;
5 5
 }
6 6
 
7 7
 if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) {
8 8
 
9
-	class AyeCode_Deactivation_Survey {
9
+    class AyeCode_Deactivation_Survey {
10 10
 
11
-		/**
12
-		 * AyeCode_Deactivation_Survey instance.
13
-		 *
14
-		 * @access private
15
-		 * @since  1.0.0
16
-		 * @var    AyeCode_Deactivation_Survey There can be only one!
17
-		 */
18
-		private static $instance = null;
11
+        /**
12
+         * AyeCode_Deactivation_Survey instance.
13
+         *
14
+         * @access private
15
+         * @since  1.0.0
16
+         * @var    AyeCode_Deactivation_Survey There can be only one!
17
+         */
18
+        private static $instance = null;
19 19
 
20
-		public static $plugins;
20
+        public static $plugins;
21 21
 
22
-		public $version = "1.0.3";
22
+        public $version = "1.0.3";
23 23
 
24
-		public static function instance( $plugin = array() ) {
25
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) {
26
-				self::$instance = new AyeCode_Deactivation_Survey;
27
-				self::$plugins = array();
24
+        public static function instance( $plugin = array() ) {
25
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) {
26
+                self::$instance = new AyeCode_Deactivation_Survey;
27
+                self::$plugins = array();
28 28
 
29
-				add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) );
29
+                add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) );
30 30
 
31
-				do_action( 'ayecode_deactivation_survey_loaded' );
32
-			}
31
+                do_action( 'ayecode_deactivation_survey_loaded' );
32
+            }
33 33
 
34
-			if(!empty($plugin)){
35
-				self::$plugins[] = (object)$plugin;
36
-			}
34
+            if(!empty($plugin)){
35
+                self::$plugins[] = (object)$plugin;
36
+            }
37 37
 
38
-			return self::$instance;
39
-		}
38
+            return self::$instance;
39
+        }
40 40
 
41
-		public function scripts() {
42
-			global $pagenow;
41
+        public function scripts() {
42
+            global $pagenow;
43 43
 
44
-			// Bail if we are not on the plugins page
45
-			if ( $pagenow != "plugins.php" ) {
46
-				return;
47
-			}
44
+            // Bail if we are not on the plugins page
45
+            if ( $pagenow != "plugins.php" ) {
46
+                return;
47
+            }
48 48
 
49
-			// Enqueue scripts
50
-			add_thickbox();
51
-			wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js');
49
+            // Enqueue scripts
50
+            add_thickbox();
51
+            wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js');
52 52
 
53
-			/*
53
+            /*
54 54
 			 * Localized strings. Strings can be localised by plugins using this class.
55 55
 			 * We deliberately don't add textdomains here so that double textdomain warning is not given in theme review.
56 56
 			 */
57
-			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array(
58
-				'quick_feedback'			=> 'Quick Feedback',
59
-				'foreword'					=> 'If you would be kind enough, please tell us why you\'re deactivating?',
60
-				'better_plugins_name'		=> 'Please tell us which plugin?',
61
-				'please_tell_us'			=> 'Please tell us the reason so we can improve the plugin',
62
-				'do_not_attach_email'		=> 'Do not send my e-mail address with this feedback',
63
-				'brief_description'			=> 'Please give us any feedback that could help us improve',
64
-				'cancel'					=> 'Cancel',
65
-				'skip_and_deactivate'		=> 'Skip &amp; Deactivate',
66
-				'submit_and_deactivate'		=> 'Submit &amp; Deactivate',
67
-				'please_wait'				=> 'Please wait',
68
-				'get_support'				=> 'Get Support',
69
-				'documentation'				=> 'Documentation',
70
-				'thank_you'					=> 'Thank you!',
71
-			));
72
-
73
-			// Plugins
74
-			$plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins);
75
-
76
-			// Reasons
77
-			$defaultReasons = array(
78
-				'suddenly-stopped-working'	=> 'The plugin suddenly stopped working',
79
-				'plugin-broke-site'			=> 'The plugin broke my site',
80
-				'plugin-setup-difficult'	=> 'Too difficult to setup',
81
-				'no-longer-needed'			=> 'I don\'t need this plugin any more',
82
-				'found-better-plugin'		=> 'I found a better plugin',
83
-				'temporary-deactivation'	=> 'It\'s a temporary deactivation, I\'m troubleshooting',
84
-				'other'						=> 'Other',
85
-			);
86
-
87
-			foreach($plugins as $plugin)
88
-			{
89
-				$plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin);
90
-				$plugin->url = home_url();
91
-				$plugin->activated = 0;
92
-			}
93
-
94
-			// Send plugin data
95
-			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins);
96
-
97
-		}
57
+            wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array(
58
+                'quick_feedback'			=> 'Quick Feedback',
59
+                'foreword'					=> 'If you would be kind enough, please tell us why you\'re deactivating?',
60
+                'better_plugins_name'		=> 'Please tell us which plugin?',
61
+                'please_tell_us'			=> 'Please tell us the reason so we can improve the plugin',
62
+                'do_not_attach_email'		=> 'Do not send my e-mail address with this feedback',
63
+                'brief_description'			=> 'Please give us any feedback that could help us improve',
64
+                'cancel'					=> 'Cancel',
65
+                'skip_and_deactivate'		=> 'Skip &amp; Deactivate',
66
+                'submit_and_deactivate'		=> 'Submit &amp; Deactivate',
67
+                'please_wait'				=> 'Please wait',
68
+                'get_support'				=> 'Get Support',
69
+                'documentation'				=> 'Documentation',
70
+                'thank_you'					=> 'Thank you!',
71
+            ));
72
+
73
+            // Plugins
74
+            $plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins);
75
+
76
+            // Reasons
77
+            $defaultReasons = array(
78
+                'suddenly-stopped-working'	=> 'The plugin suddenly stopped working',
79
+                'plugin-broke-site'			=> 'The plugin broke my site',
80
+                'plugin-setup-difficult'	=> 'Too difficult to setup',
81
+                'no-longer-needed'			=> 'I don\'t need this plugin any more',
82
+                'found-better-plugin'		=> 'I found a better plugin',
83
+                'temporary-deactivation'	=> 'It\'s a temporary deactivation, I\'m troubleshooting',
84
+                'other'						=> 'Other',
85
+            );
86
+
87
+            foreach($plugins as $plugin)
88
+            {
89
+                $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin);
90
+                $plugin->url = home_url();
91
+                $plugin->activated = 0;
92
+            }
93
+
94
+            // Send plugin data
95
+            wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins);
96
+
97
+        }
98 98
 		
99 99
 
100
-	}
100
+    }
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit;
5 5
 }
6 6
 
7
-if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) {
7
+if (!class_exists('AyeCode_Deactivation_Survey')) {
8 8
 
9 9
 	class AyeCode_Deactivation_Survey {
10 10
 
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 
22 22
 		public $version = "1.0.3";
23 23
 
24
-		public static function instance( $plugin = array() ) {
25
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) {
24
+		public static function instance($plugin = array()) {
25
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_Deactivation_Survey)) {
26 26
 				self::$instance = new AyeCode_Deactivation_Survey;
27 27
 				self::$plugins = array();
28 28
 
29
-				add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) );
29
+				add_action('admin_enqueue_scripts', array(self::$instance, 'scripts'));
30 30
 
31
-				do_action( 'ayecode_deactivation_survey_loaded' );
31
+				do_action('ayecode_deactivation_survey_loaded');
32 32
 			}
33 33
 
34
-			if(!empty($plugin)){
35
-				self::$plugins[] = (object)$plugin;
34
+			if (!empty($plugin)) {
35
+				self::$plugins[] = (object) $plugin;
36 36
 			}
37 37
 
38 38
 			return self::$instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			global $pagenow;
43 43
 
44 44
 			// Bail if we are not on the plugins page
45
-			if ( $pagenow != "plugins.php" ) {
45
+			if ($pagenow != "plugins.php") {
46 46
 				return;
47 47
 			}
48 48
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 				'other'						=> 'Other',
85 85
 			);
86 86
 
87
-			foreach($plugins as $plugin)
87
+			foreach ($plugins as $plugin)
88 88
 			{
89 89
 				$plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin);
90 90
 				$plugin->url = home_url();
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php',
11 11
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
12 12
     );
13 13
 
14
-    public static $prefixLengthsPsr4 = array (
14
+    public static $prefixLengthsPsr4 = array(
15 15
         'M' => 
16
-        array (
16
+        array(
17 17
             'MaxMind\\Db\\' => 11,
18 18
         ),
19 19
         'C' => 
20
-        array (
20
+        array(
21 21
             'Composer\\Installers\\' => 20,
22 22
         ),
23 23
     );
24 24
 
25
-    public static $prefixDirsPsr4 = array (
25
+    public static $prefixDirsPsr4 = array(
26 26
         'MaxMind\\Db\\' => 
27
-        array (
27
+        array(
28 28
             0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
29 29
         ),
30 30
         'Composer\\Installers\\' => 
31
-        array (
31
+        array(
32 32
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
33 33
         ),
34 34
     );
35 35
 
36
-    public static $classMap = array (
36
+    public static $classMap = array(
37 37
         'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php',
38 38
         'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php',
39 39
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public static function getInitializer(ClassLoader $loader)
44 44
     {
45
-        return \Closure::bind(function () use ($loader) {
45
+        return \Closure::bind(function() use ($loader) {
46 46
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
47 47
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
48 48
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.
vendor/composer/InstalledVersions.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 class InstalledVersions
13 13
 {
14 14
 private static $installed = array (
15
-  'root' => 
16
-  array (
15
+    'root' => 
16
+    array (
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
@@ -21,96 +21,96 @@  discard block
 block discarded – undo
21 21
     ),
22 22
     'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
23 23
     'name' => 'ayecode/invoicing',
24
-  ),
25
-  'versions' => 
26
-  array (
24
+    ),
25
+    'versions' => 
26
+    array (
27 27
     'ayecode/ayecode-connect-helper' => 
28 28
     array (
29
-      'pretty_version' => '1.0.3',
30
-      'version' => '1.0.3.0',
31
-      'aliases' => 
32
-      array (
33
-      ),
34
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
29
+        'pretty_version' => '1.0.3',
30
+        'version' => '1.0.3.0',
31
+        'aliases' => 
32
+        array (
33
+        ),
34
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37 37
     array (
38
-      'pretty_version' => 'dev-master',
39
-      'version' => 'dev-master',
40
-      'aliases' => 
41
-      array (
42
-      ),
43
-      'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
38
+        'pretty_version' => 'dev-master',
39
+        'version' => 'dev-master',
40
+        'aliases' => 
41
+        array (
42
+        ),
43
+        'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46 46
     array (
47
-      'pretty_version' => '0.1.51',
48
-      'version' => '0.1.51.0',
49
-      'aliases' => 
50
-      array (
51
-      ),
52
-      'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
47
+        'pretty_version' => '0.1.51',
48
+        'version' => '0.1.51.0',
49
+        'aliases' => 
50
+        array (
51
+        ),
52
+        'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
53 53
     ),
54 54
     'ayecode/wp-deactivation-survey' => 
55 55
     array (
56
-      'pretty_version' => '1.0.3',
57
-      'version' => '1.0.3.0',
58
-      'aliases' => 
59
-      array (
60
-      ),
61
-      'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
56
+        'pretty_version' => '1.0.3',
57
+        'version' => '1.0.3.0',
58
+        'aliases' => 
59
+        array (
60
+        ),
61
+        'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
62 62
     ),
63 63
     'ayecode/wp-font-awesome-settings' => 
64 64
     array (
65
-      'pretty_version' => '1.0.12',
66
-      'version' => '1.0.12.0',
67
-      'aliases' => 
68
-      array (
69
-      ),
70
-      'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
65
+        'pretty_version' => '1.0.12',
66
+        'version' => '1.0.12.0',
67
+        'aliases' => 
68
+        array (
69
+        ),
70
+        'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
71 71
     ),
72 72
     'ayecode/wp-super-duper' => 
73 73
     array (
74
-      'pretty_version' => '1.0.26',
75
-      'version' => '1.0.26.0',
76
-      'aliases' => 
77
-      array (
78
-      ),
79
-      'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
74
+        'pretty_version' => '1.0.26',
75
+        'version' => '1.0.26.0',
76
+        'aliases' => 
77
+        array (
78
+        ),
79
+        'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
80 80
     ),
81 81
     'composer/installers' => 
82 82
     array (
83
-      'pretty_version' => 'v1.11.0',
84
-      'version' => '1.11.0.0',
85
-      'aliases' => 
86
-      array (
87
-      ),
88
-      'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
83
+        'pretty_version' => 'v1.11.0',
84
+        'version' => '1.11.0.0',
85
+        'aliases' => 
86
+        array (
87
+        ),
88
+        'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
89 89
     ),
90 90
     'maxmind-db/reader' => 
91 91
     array (
92
-      'pretty_version' => 'v1.6.0',
93
-      'version' => '1.6.0.0',
94
-      'aliases' => 
95
-      array (
96
-      ),
97
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
92
+        'pretty_version' => 'v1.6.0',
93
+        'version' => '1.6.0.0',
94
+        'aliases' => 
95
+        array (
96
+        ),
97
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
98 98
     ),
99 99
     'roundcube/plugin-installer' => 
100 100
     array (
101
-      'replaced' => 
102
-      array (
101
+        'replaced' => 
102
+        array (
103 103
         0 => '*',
104
-      ),
104
+        ),
105 105
     ),
106 106
     'shama/baton' => 
107 107
     array (
108
-      'replaced' => 
109
-      array (
108
+        'replaced' => 
109
+        array (
110 110
         0 => '*',
111
-      ),
111
+        ),
112
+    ),
112 113
     ),
113
-  ),
114 114
 );
115 115
 
116 116
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,102 +11,102 @@
 block discarded – undo
11 11
 
12 12
 class InstalledVersions
13 13
 {
14
-private static $installed = array (
14
+private static $installed = array(
15 15
   'root' => 
16
-  array (
16
+  array(
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
20
-    array (
20
+    array(
21 21
     ),
22 22
     'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
23 23
     'name' => 'ayecode/invoicing',
24 24
   ),
25 25
   'versions' => 
26
-  array (
26
+  array(
27 27
     'ayecode/ayecode-connect-helper' => 
28
-    array (
28
+    array(
29 29
       'pretty_version' => '1.0.3',
30 30
       'version' => '1.0.3.0',
31 31
       'aliases' => 
32
-      array (
32
+      array(
33 33
       ),
34 34
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37
-    array (
37
+    array(
38 38
       'pretty_version' => 'dev-master',
39 39
       'version' => 'dev-master',
40 40
       'aliases' => 
41
-      array (
41
+      array(
42 42
       ),
43 43
       'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46
-    array (
46
+    array(
47 47
       'pretty_version' => '0.1.51',
48 48
       'version' => '0.1.51.0',
49 49
       'aliases' => 
50
-      array (
50
+      array(
51 51
       ),
52 52
       'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
53 53
     ),
54 54
     'ayecode/wp-deactivation-survey' => 
55
-    array (
55
+    array(
56 56
       'pretty_version' => '1.0.3',
57 57
       'version' => '1.0.3.0',
58 58
       'aliases' => 
59
-      array (
59
+      array(
60 60
       ),
61 61
       'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
62 62
     ),
63 63
     'ayecode/wp-font-awesome-settings' => 
64
-    array (
64
+    array(
65 65
       'pretty_version' => '1.0.12',
66 66
       'version' => '1.0.12.0',
67 67
       'aliases' => 
68
-      array (
68
+      array(
69 69
       ),
70 70
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
71 71
     ),
72 72
     'ayecode/wp-super-duper' => 
73
-    array (
73
+    array(
74 74
       'pretty_version' => '1.0.26',
75 75
       'version' => '1.0.26.0',
76 76
       'aliases' => 
77
-      array (
77
+      array(
78 78
       ),
79 79
       'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
80 80
     ),
81 81
     'composer/installers' => 
82
-    array (
82
+    array(
83 83
       'pretty_version' => 'v1.11.0',
84 84
       'version' => '1.11.0.0',
85 85
       'aliases' => 
86
-      array (
86
+      array(
87 87
       ),
88 88
       'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
89 89
     ),
90 90
     'maxmind-db/reader' => 
91
-    array (
91
+    array(
92 92
       'pretty_version' => 'v1.6.0',
93 93
       'version' => '1.6.0.0',
94 94
       'aliases' => 
95
-      array (
95
+      array(
96 96
       ),
97 97
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
98 98
     ),
99 99
     'roundcube/plugin-installer' => 
100
-    array (
100
+    array(
101 101
       'replaced' => 
102
-      array (
102
+      array(
103 103
         0 => '*',
104 104
       ),
105 105
     ),
106 106
     'shama/baton' => 
107
-    array (
107
+    array(
108 108
       'replaced' => 
109
-      array (
109
+      array(
110 110
         0 => '*',
111 111
       ),
112 112
     ),
Please login to merge, or discard this patch.
vendor/composer/installed.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php return array (
2
-  'root' => 
3
-  array (
2
+    'root' => 
3
+    array (
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
@@ -8,94 +8,94 @@  discard block
 block discarded – undo
8 8
     ),
9 9
     'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
10 10
     'name' => 'ayecode/invoicing',
11
-  ),
12
-  'versions' => 
13
-  array (
11
+    ),
12
+    'versions' => 
13
+    array (
14 14
     'ayecode/ayecode-connect-helper' => 
15 15
     array (
16
-      'pretty_version' => '1.0.3',
17
-      'version' => '1.0.3.0',
18
-      'aliases' => 
19
-      array (
20
-      ),
21
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
16
+        'pretty_version' => '1.0.3',
17
+        'version' => '1.0.3.0',
18
+        'aliases' => 
19
+        array (
20
+        ),
21
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24 24
     array (
25
-      'pretty_version' => 'dev-master',
26
-      'version' => 'dev-master',
27
-      'aliases' => 
28
-      array (
29
-      ),
30
-      'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
25
+        'pretty_version' => 'dev-master',
26
+        'version' => 'dev-master',
27
+        'aliases' => 
28
+        array (
29
+        ),
30
+        'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33 33
     array (
34
-      'pretty_version' => '0.1.51',
35
-      'version' => '0.1.51.0',
36
-      'aliases' => 
37
-      array (
38
-      ),
39
-      'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
34
+        'pretty_version' => '0.1.51',
35
+        'version' => '0.1.51.0',
36
+        'aliases' => 
37
+        array (
38
+        ),
39
+        'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42 42
     array (
43
-      'pretty_version' => '1.0.3',
44
-      'version' => '1.0.3.0',
45
-      'aliases' => 
46
-      array (
47
-      ),
48
-      'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
43
+        'pretty_version' => '1.0.3',
44
+        'version' => '1.0.3.0',
45
+        'aliases' => 
46
+        array (
47
+        ),
48
+        'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51 51
     array (
52
-      'pretty_version' => '1.0.12',
53
-      'version' => '1.0.12.0',
54
-      'aliases' => 
55
-      array (
56
-      ),
57
-      'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
52
+        'pretty_version' => '1.0.12',
53
+        'version' => '1.0.12.0',
54
+        'aliases' => 
55
+        array (
56
+        ),
57
+        'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60 60
     array (
61
-      'pretty_version' => '1.0.26',
62
-      'version' => '1.0.26.0',
63
-      'aliases' => 
64
-      array (
65
-      ),
66
-      'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
61
+        'pretty_version' => '1.0.26',
62
+        'version' => '1.0.26.0',
63
+        'aliases' => 
64
+        array (
65
+        ),
66
+        'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
67 67
     ),
68 68
     'composer/installers' => 
69 69
     array (
70
-      'pretty_version' => 'v1.11.0',
71
-      'version' => '1.11.0.0',
72
-      'aliases' => 
73
-      array (
74
-      ),
75
-      'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
70
+        'pretty_version' => 'v1.11.0',
71
+        'version' => '1.11.0.0',
72
+        'aliases' => 
73
+        array (
74
+        ),
75
+        'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78 78
     array (
79
-      'pretty_version' => 'v1.6.0',
80
-      'version' => '1.6.0.0',
81
-      'aliases' => 
82
-      array (
83
-      ),
84
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
79
+        'pretty_version' => 'v1.6.0',
80
+        'version' => '1.6.0.0',
81
+        'aliases' => 
82
+        array (
83
+        ),
84
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87 87
     array (
88
-      'replaced' => 
89
-      array (
88
+        'replaced' => 
89
+        array (
90 90
         0 => '*',
91
-      ),
91
+        ),
92 92
     ),
93 93
     'shama/baton' => 
94 94
     array (
95
-      'replaced' => 
96
-      array (
95
+        'replaced' => 
96
+        array (
97 97
         0 => '*',
98
-      ),
98
+        ),
99
+    ),
99 100
     ),
100
-  ),
101 101
 );
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,99 +1,99 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'root' => 
3
-  array (
3
+  array(
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
7
-    array (
7
+    array(
8 8
     ),
9 9
     'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
10 10
     'name' => 'ayecode/invoicing',
11 11
   ),
12 12
   'versions' => 
13
-  array (
13
+  array(
14 14
     'ayecode/ayecode-connect-helper' => 
15
-    array (
15
+    array(
16 16
       'pretty_version' => '1.0.3',
17 17
       'version' => '1.0.3.0',
18 18
       'aliases' => 
19
-      array (
19
+      array(
20 20
       ),
21 21
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24
-    array (
24
+    array(
25 25
       'pretty_version' => 'dev-master',
26 26
       'version' => 'dev-master',
27 27
       'aliases' => 
28
-      array (
28
+      array(
29 29
       ),
30 30
       'reference' => '63ce670a999b41e694ef7c693194e6a76bcb2048',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.51',
35 35
       'version' => '0.1.51.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => 'bcd4413ac3cc6513b852aabbe74f940a7dee0814',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42
-    array (
42
+    array(
43 43
       'pretty_version' => '1.0.3',
44 44
       'version' => '1.0.3.0',
45 45
       'aliases' => 
46
-      array (
46
+      array(
47 47
       ),
48 48
       'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51
-    array (
51
+    array(
52 52
       'pretty_version' => '1.0.12',
53 53
       'version' => '1.0.12.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => '1.0.26',
62 62
       'version' => '1.0.26.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
67 67
     ),
68 68
     'composer/installers' => 
69
-    array (
69
+    array(
70 70
       'pretty_version' => 'v1.11.0',
71 71
       'version' => '1.11.0.0',
72 72
       'aliases' => 
73
-      array (
73
+      array(
74 74
       ),
75 75
       'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78
-    array (
78
+    array(
79 79
       'pretty_version' => 'v1.6.0',
80 80
       'version' => '1.6.0.0',
81 81
       'aliases' => 
82
-      array (
82
+      array(
83 83
       ),
84 84
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87
-    array (
87
+    array(
88 88
       'replaced' => 
89
-      array (
89
+      array(
90 90
         0 => '*',
91 91
       ),
92 92
     ),
93 93
     'shama/baton' => 
94
-    array (
94
+    array(
95 95
       'replaced' => 
96
-      array (
96
+      array(
97 97
         0 => '*',
98 98
       ),
99 99
     ),
Please login to merge, or discard this patch.
includes/admin/class-getpaid-installer.php 2 patches
Indentation   +375 added lines, -375 removed lines patch added patch discarded remove patch
@@ -20,228 +20,228 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class GetPaid_Installer {
22 22
 
23
-	/**
24
-	 * Upgrades the install.
25
-	 *
26
-	 * @param string $upgrade_from The current invoicing version.
27
-	 */
28
-	public function upgrade_db( $upgrade_from ) {
29
-
30
-		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
32
-
33
-		// Setup the invoice Custom Post Type.
34
-		GetPaid_Post_Types::register_post_types();
35
-
36
-		// Clear the permalinks
37
-		flush_rewrite_rules();
38
-
39
-		// Maybe create new/missing pages.
40
-		$this->create_pages();
41
-
42
-		// Maybe re(add) admin capabilities.
43
-		$this->add_capabilities();
44
-
45
-		// Maybe create the default payment form.
46
-		wpinv_get_default_payment_form();
47
-
48
-		// Create any missing database tables.
49
-		$method = "upgrade_from_$upgrade_from";
50
-
51
-		$installed = get_option( 'gepaid_installed_on' );
52
-
53
-		if ( empty( $installed ) ) {
54
-			update_option( 'gepaid_installed_on', time() );
55
-		}
56
-
57
-		if ( method_exists( $this, $method ) ) {
58
-			$this->$method();
59
-		}
60
-
61
-	}
62
-
63
-	/**
64
-	 * Do a fresh install.
65
-	 *
66
-	 */
67
-	public function upgrade_from_0() {
68
-		$this->create_subscriptions_table();
69
-		$this->create_invoices_table();
70
-		$this->create_invoice_items_table();
71
-
72
-		// Save default tax rates.
73
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
74
-	}
75
-
76
-	/**
77
-	 * Upgrade to 0.0.5
78
-	 *
79
-	 */
80
-	public function upgrade_from_004() {
81
-		global $wpdb;
82
-
83
-		// Invoices.
84
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
-		if ( ! empty( $results ) ) {
86
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
87
-
88
-			// Clean post cache
89
-			foreach ( $results as $row ) {
90
-				clean_post_cache( $row->ID );
91
-			}
92
-
93
-		}
94
-
95
-		// Item meta key changes
96
-		$query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
97
-		$results = $wpdb->get_results( $query );
98
-
99
-		if ( ! empty( $results ) ) {
100
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
101
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
102
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
103
-
104
-			foreach ( $results as $row ) {
105
-				clean_post_cache( $row->post_id );
106
-			}
107
-
108
-		}
109
-
110
-		$this->upgrade_from_102();
111
-	}
112
-
113
-	/**
114
-	 * Upgrade to 1.0.3
115
-	 *
116
-	 */
117
-	public function upgrade_from_102() {
118
-		$this->create_subscriptions_table();
119
-		$this->upgrade_from_118();
120
-	}
121
-
122
-	/**
123
-	 * Upgrade to version 2.0.0.
124
-	 *
125
-	 */
126
-	public function upgrade_from_118() {
127
-		$this->create_invoices_table();
128
-		$this->create_invoice_items_table();
129
-		$this->migrate_old_invoices();
130
-	}
131
-
132
-	/**
133
-	 * Upgrade to version 2.0.8.
134
-	 *
135
-	 */
136
-	public function upgrade_from_207() {
137
-		global $wpdb;
138
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
139
-	}
140
-
141
-	/**
142
-	 * Give administrators the capability to manage GetPaid.
143
-	 *
144
-	 */
145
-	public function add_capabilities() {
146
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
147
-	}
148
-
149
-	/**
150
-	 * Retreives GetPaid pages.
151
-	 *
152
-	 */
153
-	public static function get_pages() {
154
-
155
-		return apply_filters(
156
-			'wpinv_create_pages',
157
-			array(
158
-
159
-				// Checkout page.
160
-				'checkout_page' => array(
161
-					'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
162
-					'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
163
-					'content'   => '
23
+    /**
24
+     * Upgrades the install.
25
+     *
26
+     * @param string $upgrade_from The current invoicing version.
27
+     */
28
+    public function upgrade_db( $upgrade_from ) {
29
+
30
+        // Save the current invoicing version.
31
+        update_option( 'wpinv_version', WPINV_VERSION );
32
+
33
+        // Setup the invoice Custom Post Type.
34
+        GetPaid_Post_Types::register_post_types();
35
+
36
+        // Clear the permalinks
37
+        flush_rewrite_rules();
38
+
39
+        // Maybe create new/missing pages.
40
+        $this->create_pages();
41
+
42
+        // Maybe re(add) admin capabilities.
43
+        $this->add_capabilities();
44
+
45
+        // Maybe create the default payment form.
46
+        wpinv_get_default_payment_form();
47
+
48
+        // Create any missing database tables.
49
+        $method = "upgrade_from_$upgrade_from";
50
+
51
+        $installed = get_option( 'gepaid_installed_on' );
52
+
53
+        if ( empty( $installed ) ) {
54
+            update_option( 'gepaid_installed_on', time() );
55
+        }
56
+
57
+        if ( method_exists( $this, $method ) ) {
58
+            $this->$method();
59
+        }
60
+
61
+    }
62
+
63
+    /**
64
+     * Do a fresh install.
65
+     *
66
+     */
67
+    public function upgrade_from_0() {
68
+        $this->create_subscriptions_table();
69
+        $this->create_invoices_table();
70
+        $this->create_invoice_items_table();
71
+
72
+        // Save default tax rates.
73
+        update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
74
+    }
75
+
76
+    /**
77
+     * Upgrade to 0.0.5
78
+     *
79
+     */
80
+    public function upgrade_from_004() {
81
+        global $wpdb;
82
+
83
+        // Invoices.
84
+        $results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
+        if ( ! empty( $results ) ) {
86
+            $wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
87
+
88
+            // Clean post cache
89
+            foreach ( $results as $row ) {
90
+                clean_post_cache( $row->ID );
91
+            }
92
+
93
+        }
94
+
95
+        // Item meta key changes
96
+        $query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
97
+        $results = $wpdb->get_results( $query );
98
+
99
+        if ( ! empty( $results ) ) {
100
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
101
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
102
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
103
+
104
+            foreach ( $results as $row ) {
105
+                clean_post_cache( $row->post_id );
106
+            }
107
+
108
+        }
109
+
110
+        $this->upgrade_from_102();
111
+    }
112
+
113
+    /**
114
+     * Upgrade to 1.0.3
115
+     *
116
+     */
117
+    public function upgrade_from_102() {
118
+        $this->create_subscriptions_table();
119
+        $this->upgrade_from_118();
120
+    }
121
+
122
+    /**
123
+     * Upgrade to version 2.0.0.
124
+     *
125
+     */
126
+    public function upgrade_from_118() {
127
+        $this->create_invoices_table();
128
+        $this->create_invoice_items_table();
129
+        $this->migrate_old_invoices();
130
+    }
131
+
132
+    /**
133
+     * Upgrade to version 2.0.8.
134
+     *
135
+     */
136
+    public function upgrade_from_207() {
137
+        global $wpdb;
138
+        $wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
139
+    }
140
+
141
+    /**
142
+     * Give administrators the capability to manage GetPaid.
143
+     *
144
+     */
145
+    public function add_capabilities() {
146
+        $GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
147
+    }
148
+
149
+    /**
150
+     * Retreives GetPaid pages.
151
+     *
152
+     */
153
+    public static function get_pages() {
154
+
155
+        return apply_filters(
156
+            'wpinv_create_pages',
157
+            array(
158
+
159
+                // Checkout page.
160
+                'checkout_page' => array(
161
+                    'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
162
+                    'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
163
+                    'content'   => '
164 164
 						<!-- wp:shortcode -->
165 165
 						[wpinv_checkout]
166 166
 						<!-- /wp:shortcode -->
167 167
 					',
168
-					'parent'    => '',
169
-				),
170
-
171
-				// Invoice history page.
172
-				'invoice_history_page' => array(
173
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
174
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
175
-					'content' => '
168
+                    'parent'    => '',
169
+                ),
170
+
171
+                // Invoice history page.
172
+                'invoice_history_page' => array(
173
+                    'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
174
+                    'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
175
+                    'content' => '
176 176
 					<!-- wp:shortcode -->
177 177
 					[wpinv_history]
178 178
 					<!-- /wp:shortcode -->
179 179
 				',
180
-					'parent'  => '',
181
-				),
182
-
183
-				// Success page content.
184
-				'success_page' => array(
185
-					'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
186
-					'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
187
-					'content'  => '
180
+                    'parent'  => '',
181
+                ),
182
+
183
+                // Success page content.
184
+                'success_page' => array(
185
+                    'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
186
+                    'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
187
+                    'content'  => '
188 188
 					<!-- wp:shortcode -->
189 189
 					[wpinv_receipt]
190 190
 					<!-- /wp:shortcode -->
191 191
 				',
192
-					'parent'   => 'gp-checkout',
193
-				),
194
-
195
-				// Failure page content.
196
-				'failure_page' => array(
197
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
198
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
199
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
200
-					'parent'  => 'gp-checkout',
201
-				),
202
-
203
-				// Subscriptions history page.
204
-				'invoice_subscription_page' => array(
205
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
206
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
207
-					'content' => '
192
+                    'parent'   => 'gp-checkout',
193
+                ),
194
+
195
+                // Failure page content.
196
+                'failure_page' => array(
197
+                    'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
198
+                    'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
199
+                    'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
200
+                    'parent'  => 'gp-checkout',
201
+                ),
202
+
203
+                // Subscriptions history page.
204
+                'invoice_subscription_page' => array(
205
+                    'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
206
+                    'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
207
+                    'content' => '
208 208
 					<!-- wp:shortcode -->
209 209
 					[wpinv_subscriptions]
210 210
 					<!-- /wp:shortcode -->
211 211
 				',
212
-					'parent' => '',
213
-				),
212
+                    'parent' => '',
213
+                ),
214 214
 
215
-			)
216
-		);
215
+            )
216
+        );
217 217
 
218
-	}
218
+    }
219 219
 
220
-	/**
221
-	 * Re-create GetPaid pages.
222
-	 *
223
-	 */
224
-	public function create_pages() {
220
+    /**
221
+     * Re-create GetPaid pages.
222
+     *
223
+     */
224
+    public function create_pages() {
225 225
 
226
-		foreach ( self::get_pages() as $key => $page ) {
227
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
228
-		}
226
+        foreach ( self::get_pages() as $key => $page ) {
227
+            wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
228
+        }
229 229
 
230
-	}
230
+    }
231 231
 
232
-	/**
233
-	 * Create subscriptions table.
234
-	 *
235
-	 */
236
-	public function create_subscriptions_table() {
232
+    /**
233
+     * Create subscriptions table.
234
+     *
235
+     */
236
+    public function create_subscriptions_table() {
237 237
 
238
-		global $wpdb;
238
+        global $wpdb;
239 239
 
240
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
240
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
241 241
 
242
-		// Create tables.
243
-		$charset_collate = $wpdb->get_charset_collate();
244
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
242
+        // Create tables.
243
+        $charset_collate = $wpdb->get_charset_collate();
244
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
245 245
 			id bigint(20) unsigned NOT NULL auto_increment,
246 246
 			customer_id bigint(20) NOT NULL,
247 247
 			frequency int(11) NOT NULL DEFAULT '1',
@@ -264,22 +264,22 @@  discard block
 block discarded – undo
264 264
 			KEY customer_and_status (customer_id, status)
265 265
 		  ) $charset_collate;";
266 266
 
267
-		dbDelta( $sql );
267
+        dbDelta( $sql );
268 268
 
269
-	}
269
+    }
270 270
 
271
-	/**
272
-	 * Create invoices table.
273
-	 *
274
-	 */
275
-	public function create_invoices_table() {
276
-		global $wpdb;
271
+    /**
272
+     * Create invoices table.
273
+     *
274
+     */
275
+    public function create_invoices_table() {
276
+        global $wpdb;
277 277
 
278
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
278
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
279 279
 
280
-		// Create tables.
281
-		$charset_collate = $wpdb->get_charset_collate();
282
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
280
+        // Create tables.
281
+        $charset_collate = $wpdb->get_charset_collate();
282
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
283 283
 			post_id BIGINT(20) NOT NULL,
284 284
             `number` VARCHAR(100),
285 285
             `key` VARCHAR(100),
@@ -315,22 +315,22 @@  discard block
 block discarded – undo
315 315
 			KEY `key` (`key`)
316 316
 		  ) $charset_collate;";
317 317
 
318
-		dbDelta( $sql );
318
+        dbDelta( $sql );
319 319
 
320
-	}
320
+    }
321 321
 
322
-	/**
323
-	 * Create invoice items table.
324
-	 *
325
-	 */
326
-	public function create_invoice_items_table() {
327
-		global $wpdb;
322
+    /**
323
+     * Create invoice items table.
324
+     *
325
+     */
326
+    public function create_invoice_items_table() {
327
+        global $wpdb;
328 328
 
329
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
329
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
330 330
 
331
-		// Create tables.
332
-		$charset_collate = $wpdb->get_charset_collate();
333
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
331
+        // Create tables.
332
+        $charset_collate = $wpdb->get_charset_collate();
333
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
334 334
 			ID BIGINT(20) NOT NULL AUTO_INCREMENT,
335 335
             post_id BIGINT(20) NOT NULL,
336 336
             item_id BIGINT(20) NOT NULL,
@@ -352,159 +352,159 @@  discard block
 block discarded – undo
352 352
 			KEY post_id (post_id)
353 353
 		  ) $charset_collate;";
354 354
 
355
-		dbDelta( $sql );
356
-
357
-	}
358
-
359
-	/**
360
-	 * Migrates old invoices to new invoices.
361
-	 *
362
-	 */
363
-	public function migrate_old_invoices() {
364
-		global $wpdb;
365
-
366
-		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
367
-		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
368
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
369
-		$invoices            = array_unique(
370
-			get_posts(
371
-				array(
372
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
373
-					'posts_per_page' => -1,
374
-					'fields'         => 'ids',
375
-					'post_status'    => array_keys( get_post_stati() ),
376
-					'exclude'        => (array) $migrated,
377
-				)
378
-			)
379
-		);
380
-
381
-		// Abort if we do not have any invoices.
382
-		if ( empty( $invoices ) ) {
383
-			return;
384
-		}
385
-
386
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
387
-
388
-		$invoice_rows = array();
389
-		foreach ( $invoices as $invoice ) {
390
-
391
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
392
-
393
-			if ( empty( $invoice->ID ) ) {
394
-				return;
395
-			}
396
-
397
-			$fields = array (
398
-				'post_id'        => $invoice->ID,
399
-				'number'         => $invoice->get_number(),
400
-				'key'            => $invoice->get_key(),
401
-				'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
402
-				'mode'           => $invoice->mode,
403
-				'user_ip'        => $invoice->get_ip(),
404
-				'first_name'     => $invoice->get_first_name(),
405
-				'last_name'      => $invoice->get_last_name(),
406
-				'address'        => $invoice->get_address(),
407
-				'city'           => $invoice->city,
408
-				'state'          => $invoice->state,
409
-				'country'        => $invoice->country,
410
-				'zip'            => $invoice->zip,
411
-				'adddress_confirmed' => (int) $invoice->adddress_confirmed,
412
-				'gateway'        => $invoice->get_gateway(),
413
-				'transaction_id' => $invoice->get_transaction_id(),
414
-				'currency'       => $invoice->get_currency(),
415
-				'subtotal'       => $invoice->get_subtotal(),
416
-				'tax'            => $invoice->get_tax(),
417
-				'fees_total'     => $invoice->get_fees_total(),
418
-				'total'          => $invoice->get_total(),
419
-				'discount'       => $invoice->get_discount(),
420
-				'discount_code'  => $invoice->get_discount_code(),
421
-				'disable_taxes'  => $invoice->disable_taxes,
422
-				'due_date'       => $invoice->get_due_date(),
423
-				'completed_date' => $invoice->get_completed_date(),
424
-				'company'        => $invoice->company,
425
-				'vat_number'     => $invoice->vat_number,
426
-				'vat_rate'       => $invoice->vat_rate,
427
-				'custom_meta'    => $invoice->payment_meta
428
-			);
429
-
430
-			foreach ( $fields as $key => $val ) {
431
-				if ( is_null( $val ) ) {
432
-					$val = '';
433
-				}
434
-				$val = maybe_serialize( $val );
435
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
436
-			}
437
-
438
-			$fields = implode( ', ', $fields );
439
-			$invoice_rows[] = "($fields)";
440
-
441
-			$item_rows    = array();
442
-			$item_columns = array();
443
-			foreach ( $invoice->get_cart_details() as $details ) {
444
-				$fields = array(
445
-					'post_id'          => $invoice->ID,
446
-					'item_id'          => $details['id'],
447
-					'item_name'        => $details['name'],
448
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
449
-					'vat_rate'         => $details['vat_rate'],
450
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
451
-					'tax'              => $details['tax'],
452
-					'item_price'       => $details['item_price'],
453
-					'custom_price'     => $details['custom_price'],
454
-					'quantity'         => $details['quantity'],
455
-					'discount'         => $details['discount'],
456
-					'subtotal'         => $details['subtotal'],
457
-					'price'            => $details['price'],
458
-					'meta'             => $details['meta'],
459
-					'fees'             => $details['fees'],
460
-				);
461
-
462
-				$item_columns = array_keys ( $fields );
463
-
464
-				foreach ( $fields as $key => $val ) {
465
-					if ( is_null( $val ) ) {
466
-						$val = '';
467
-					}
468
-					$val = maybe_serialize( $val );
469
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
470
-				}
471
-
472
-				$fields = implode( ', ', $fields );
473
-				$item_rows[] = "($fields)";
474
-			}
475
-
476
-			$item_rows    = implode( ', ', $item_rows );
477
-			$item_columns = implode( ', ', $item_columns );
478
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
479
-		}
480
-
481
-		if ( empty( $invoice_rows ) ) {
482
-			return;
483
-		}
484
-
485
-		$invoice_rows = implode( ', ', $invoice_rows );
486
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
487
-
488
-	}
489
-
490
-	/**
491
-	 * Migrates old invoices to new invoices.
492
-	 *
493
-	 */
494
-	public static function rename_gateways_label() {
495
-		global $wpdb;
496
-
497
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
498
-
499
-			$wpdb->update(
500
-				$wpdb->prefix . 'getpaid_invoices',
501
-				array( 'gateway' => $gateway ),
502
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
503
-				'%s',
504
-				'%s'
505
-			);
506
-
507
-		}
508
-	}
355
+        dbDelta( $sql );
356
+
357
+    }
358
+
359
+    /**
360
+     * Migrates old invoices to new invoices.
361
+     *
362
+     */
363
+    public function migrate_old_invoices() {
364
+        global $wpdb;
365
+
366
+        $invoices_table      = $wpdb->prefix . 'getpaid_invoices';
367
+        $invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
368
+        $migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
369
+        $invoices            = array_unique(
370
+            get_posts(
371
+                array(
372
+                    'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
373
+                    'posts_per_page' => -1,
374
+                    'fields'         => 'ids',
375
+                    'post_status'    => array_keys( get_post_stati() ),
376
+                    'exclude'        => (array) $migrated,
377
+                )
378
+            )
379
+        );
380
+
381
+        // Abort if we do not have any invoices.
382
+        if ( empty( $invoices ) ) {
383
+            return;
384
+        }
385
+
386
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
387
+
388
+        $invoice_rows = array();
389
+        foreach ( $invoices as $invoice ) {
390
+
391
+            $invoice = new WPInv_Legacy_Invoice( $invoice );
392
+
393
+            if ( empty( $invoice->ID ) ) {
394
+                return;
395
+            }
396
+
397
+            $fields = array (
398
+                'post_id'        => $invoice->ID,
399
+                'number'         => $invoice->get_number(),
400
+                'key'            => $invoice->get_key(),
401
+                'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
402
+                'mode'           => $invoice->mode,
403
+                'user_ip'        => $invoice->get_ip(),
404
+                'first_name'     => $invoice->get_first_name(),
405
+                'last_name'      => $invoice->get_last_name(),
406
+                'address'        => $invoice->get_address(),
407
+                'city'           => $invoice->city,
408
+                'state'          => $invoice->state,
409
+                'country'        => $invoice->country,
410
+                'zip'            => $invoice->zip,
411
+                'adddress_confirmed' => (int) $invoice->adddress_confirmed,
412
+                'gateway'        => $invoice->get_gateway(),
413
+                'transaction_id' => $invoice->get_transaction_id(),
414
+                'currency'       => $invoice->get_currency(),
415
+                'subtotal'       => $invoice->get_subtotal(),
416
+                'tax'            => $invoice->get_tax(),
417
+                'fees_total'     => $invoice->get_fees_total(),
418
+                'total'          => $invoice->get_total(),
419
+                'discount'       => $invoice->get_discount(),
420
+                'discount_code'  => $invoice->get_discount_code(),
421
+                'disable_taxes'  => $invoice->disable_taxes,
422
+                'due_date'       => $invoice->get_due_date(),
423
+                'completed_date' => $invoice->get_completed_date(),
424
+                'company'        => $invoice->company,
425
+                'vat_number'     => $invoice->vat_number,
426
+                'vat_rate'       => $invoice->vat_rate,
427
+                'custom_meta'    => $invoice->payment_meta
428
+            );
429
+
430
+            foreach ( $fields as $key => $val ) {
431
+                if ( is_null( $val ) ) {
432
+                    $val = '';
433
+                }
434
+                $val = maybe_serialize( $val );
435
+                $fields[ $key ] = $wpdb->prepare( '%s', $val );
436
+            }
437
+
438
+            $fields = implode( ', ', $fields );
439
+            $invoice_rows[] = "($fields)";
440
+
441
+            $item_rows    = array();
442
+            $item_columns = array();
443
+            foreach ( $invoice->get_cart_details() as $details ) {
444
+                $fields = array(
445
+                    'post_id'          => $invoice->ID,
446
+                    'item_id'          => $details['id'],
447
+                    'item_name'        => $details['name'],
448
+                    'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
449
+                    'vat_rate'         => $details['vat_rate'],
450
+                    'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
451
+                    'tax'              => $details['tax'],
452
+                    'item_price'       => $details['item_price'],
453
+                    'custom_price'     => $details['custom_price'],
454
+                    'quantity'         => $details['quantity'],
455
+                    'discount'         => $details['discount'],
456
+                    'subtotal'         => $details['subtotal'],
457
+                    'price'            => $details['price'],
458
+                    'meta'             => $details['meta'],
459
+                    'fees'             => $details['fees'],
460
+                );
461
+
462
+                $item_columns = array_keys ( $fields );
463
+
464
+                foreach ( $fields as $key => $val ) {
465
+                    if ( is_null( $val ) ) {
466
+                        $val = '';
467
+                    }
468
+                    $val = maybe_serialize( $val );
469
+                    $fields[ $key ] = $wpdb->prepare( '%s', $val );
470
+                }
471
+
472
+                $fields = implode( ', ', $fields );
473
+                $item_rows[] = "($fields)";
474
+            }
475
+
476
+            $item_rows    = implode( ', ', $item_rows );
477
+            $item_columns = implode( ', ', $item_columns );
478
+            $wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
479
+        }
480
+
481
+        if ( empty( $invoice_rows ) ) {
482
+            return;
483
+        }
484
+
485
+        $invoice_rows = implode( ', ', $invoice_rows );
486
+        $wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
487
+
488
+    }
489
+
490
+    /**
491
+     * Migrates old invoices to new invoices.
492
+     *
493
+     */
494
+    public static function rename_gateways_label() {
495
+        global $wpdb;
496
+
497
+        foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
498
+
499
+            $wpdb->update(
500
+                $wpdb->prefix . 'getpaid_invoices',
501
+                array( 'gateway' => $gateway ),
502
+                array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
503
+                '%s',
504
+                '%s'
505
+            );
506
+
507
+        }
508
+    }
509 509
 
510 510
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since   2.0.2
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 /**
14 14
  * The main installer/updater class.
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param string $upgrade_from The current invoicing version.
27 27
 	 */
28
-	public function upgrade_db( $upgrade_from ) {
28
+	public function upgrade_db($upgrade_from) {
29 29
 
30 30
 		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
31
+		update_option('wpinv_version', WPINV_VERSION);
32 32
 
33 33
 		// Setup the invoice Custom Post Type.
34 34
 		GetPaid_Post_Types::register_post_types();
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		// Create any missing database tables.
49 49
 		$method = "upgrade_from_$upgrade_from";
50 50
 
51
-		$installed = get_option( 'gepaid_installed_on' );
51
+		$installed = get_option('gepaid_installed_on');
52 52
 
53
-		if ( empty( $installed ) ) {
54
-			update_option( 'gepaid_installed_on', time() );
53
+		if (empty($installed)) {
54
+			update_option('gepaid_installed_on', time());
55 55
 		}
56 56
 
57
-		if ( method_exists( $this, $method ) ) {
57
+		if (method_exists($this, $method)) {
58 58
 			$this->$method();
59 59
 		}
60 60
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$this->create_invoice_items_table();
71 71
 
72 72
 		// Save default tax rates.
73
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
73
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
74 74
 	}
75 75
 
76 76
 	/**
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
 		global $wpdb;
82 82
 
83 83
 		// Invoices.
84
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
-		if ( ! empty( $results ) ) {
86
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
84
+		$results = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
85
+		if (!empty($results)) {
86
+			$wpdb->query("UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
87 87
 
88 88
 			// Clean post cache
89
-			foreach ( $results as $row ) {
90
-				clean_post_cache( $row->ID );
89
+			foreach ($results as $row) {
90
+				clean_post_cache($row->ID);
91 91
 			}
92 92
 
93 93
 		}
94 94
 
95 95
 		// Item meta key changes
96 96
 		$query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
97
-		$results = $wpdb->get_results( $query );
97
+		$results = $wpdb->get_results($query);
98 98
 
99
-		if ( ! empty( $results ) ) {
100
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
101
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
102
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
99
+		if (!empty($results)) {
100
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )");
101
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'");
102
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'");
103 103
 
104
-			foreach ( $results as $row ) {
105
-				clean_post_cache( $row->post_id );
104
+			foreach ($results as $row) {
105
+				clean_post_cache($row->post_id);
106 106
 			}
107 107
 
108 108
 		}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function upgrade_from_207() {
137 137
 		global $wpdb;
138
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
138
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);");
139 139
 	}
140 140
 
141 141
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 */
145 145
 	public function add_capabilities() {
146
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
146
+		$GLOBALS['wp_roles']->add_cap('administrator', 'manage_invoicing');
147 147
 	}
148 148
 
149 149
 	/**
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 				// Checkout page.
160 160
 				'checkout_page' => array(
161
-					'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
162
-					'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
161
+					'name'      => _x('gp-checkout', 'Page slug', 'invoicing'),
162
+					'title'     => _x('Checkout', 'Page title', 'invoicing'),
163 163
 					'content'   => '
164 164
 						<!-- wp:shortcode -->
165 165
 						[wpinv_checkout]
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
 				// Invoice history page.
172 172
 				'invoice_history_page' => array(
173
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
174
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
173
+					'name'    => _x('gp-invoices', 'Page slug', 'invoicing'),
174
+					'title'   => _x('My Invoices', 'Page title', 'invoicing'),
175 175
 					'content' => '
176 176
 					<!-- wp:shortcode -->
177 177
 					[wpinv_history]
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 
183 183
 				// Success page content.
184 184
 				'success_page' => array(
185
-					'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
186
-					'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
185
+					'name'     => _x('gp-receipt', 'Page slug', 'invoicing'),
186
+					'title'    => _x('Payment Confirmation', 'Page title', 'invoicing'),
187 187
 					'content'  => '
188 188
 					<!-- wp:shortcode -->
189 189
 					[wpinv_receipt]
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
 
195 195
 				// Failure page content.
196 196
 				'failure_page' => array(
197
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
198
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
199
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
197
+					'name'    => _x('gp-transaction-failed', 'Page slug', 'invoicing'),
198
+					'title'   => _x('Transaction Failed', 'Page title', 'invoicing'),
199
+					'content' => __('Your transaction failed, please try again or contact site support.', 'invoicing'),
200 200
 					'parent'  => 'gp-checkout',
201 201
 				),
202 202
 
203 203
 				// Subscriptions history page.
204 204
 				'invoice_subscription_page' => array(
205
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
206
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
205
+					'name'    => _x('gp-subscriptions', 'Page slug', 'invoicing'),
206
+					'title'   => _x('My Subscriptions', 'Page title', 'invoicing'),
207 207
 					'content' => '
208 208
 					<!-- wp:shortcode -->
209 209
 					[wpinv_subscriptions]
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function create_pages() {
225 225
 
226
-		foreach ( self::get_pages() as $key => $page ) {
227
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
226
+		foreach (self::get_pages() as $key => $page) {
227
+			wpinv_create_page(esc_sql($page['name']), $key, $page['title'], $page['content'], $page['parent']);
228 228
 		}
229 229
 
230 230
 	}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 		global $wpdb;
239 239
 
240
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
240
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
241 241
 
242 242
 		// Create tables.
243 243
 		$charset_collate = $wpdb->get_charset_collate();
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			KEY customer_and_status (customer_id, status)
265 265
 		  ) $charset_collate;";
266 266
 
267
-		dbDelta( $sql );
267
+		dbDelta($sql);
268 268
 
269 269
 	}
270 270
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	public function create_invoices_table() {
276 276
 		global $wpdb;
277 277
 
278
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
278
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
279 279
 
280 280
 		// Create tables.
281 281
 		$charset_collate = $wpdb->get_charset_collate();
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 			KEY `key` (`key`)
316 316
 		  ) $charset_collate;";
317 317
 
318
-		dbDelta( $sql );
318
+		dbDelta($sql);
319 319
 
320 320
 	}
321 321
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	public function create_invoice_items_table() {
327 327
 		global $wpdb;
328 328
 
329
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
329
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
330 330
 
331 331
 		// Create tables.
332 332
 		$charset_collate = $wpdb->get_charset_collate();
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			KEY post_id (post_id)
353 353
 		  ) $charset_collate;";
354 354
 
355
-		dbDelta( $sql );
355
+		dbDelta($sql);
356 356
 
357 357
 	}
358 358
 
@@ -365,40 +365,40 @@  discard block
 block discarded – undo
365 365
 
366 366
 		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
367 367
 		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
368
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
368
+		$migrated            = $wpdb->get_col("SELECT post_id FROM $invoices_table");
369 369
 		$invoices            = array_unique(
370 370
 			get_posts(
371 371
 				array(
372
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
372
+					'post_type'      => array('wpi_invoice', 'wpi_quote'),
373 373
 					'posts_per_page' => -1,
374 374
 					'fields'         => 'ids',
375
-					'post_status'    => array_keys( get_post_stati() ),
375
+					'post_status'    => array_keys(get_post_stati()),
376 376
 					'exclude'        => (array) $migrated,
377 377
 				)
378 378
 			)
379 379
 		);
380 380
 
381 381
 		// Abort if we do not have any invoices.
382
-		if ( empty( $invoices ) ) {
382
+		if (empty($invoices)) {
383 383
 			return;
384 384
 		}
385 385
 
386
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
386
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php');
387 387
 
388 388
 		$invoice_rows = array();
389
-		foreach ( $invoices as $invoice ) {
389
+		foreach ($invoices as $invoice) {
390 390
 
391
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
391
+			$invoice = new WPInv_Legacy_Invoice($invoice);
392 392
 
393
-			if ( empty( $invoice->ID ) ) {
393
+			if (empty($invoice->ID)) {
394 394
 				return;
395 395
 			}
396 396
 
397
-			$fields = array (
397
+			$fields = array(
398 398
 				'post_id'        => $invoice->ID,
399 399
 				'number'         => $invoice->get_number(),
400 400
 				'key'            => $invoice->get_key(),
401
-				'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
401
+				'type'           => str_replace('wpi_', '', $invoice->post_type),
402 402
 				'mode'           => $invoice->mode,
403 403
 				'user_ip'        => $invoice->get_ip(),
404 404
 				'first_name'     => $invoice->get_first_name(),
@@ -427,27 +427,27 @@  discard block
 block discarded – undo
427 427
 				'custom_meta'    => $invoice->payment_meta
428 428
 			);
429 429
 
430
-			foreach ( $fields as $key => $val ) {
431
-				if ( is_null( $val ) ) {
430
+			foreach ($fields as $key => $val) {
431
+				if (is_null($val)) {
432 432
 					$val = '';
433 433
 				}
434
-				$val = maybe_serialize( $val );
435
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
434
+				$val = maybe_serialize($val);
435
+				$fields[$key] = $wpdb->prepare('%s', $val);
436 436
 			}
437 437
 
438
-			$fields = implode( ', ', $fields );
438
+			$fields = implode(', ', $fields);
439 439
 			$invoice_rows[] = "($fields)";
440 440
 
441 441
 			$item_rows    = array();
442 442
 			$item_columns = array();
443
-			foreach ( $invoice->get_cart_details() as $details ) {
443
+			foreach ($invoice->get_cart_details() as $details) {
444 444
 				$fields = array(
445 445
 					'post_id'          => $invoice->ID,
446 446
 					'item_id'          => $details['id'],
447 447
 					'item_name'        => $details['name'],
448
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
448
+					'item_description' => empty($details['meta']['description']) ? '' : $details['meta']['description'],
449 449
 					'vat_rate'         => $details['vat_rate'],
450
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
450
+					'vat_class'        => empty($details['vat_class']) ? '_standard' : $details['vat_class'],
451 451
 					'tax'              => $details['tax'],
452 452
 					'item_price'       => $details['item_price'],
453 453
 					'custom_price'     => $details['custom_price'],
@@ -459,31 +459,31 @@  discard block
 block discarded – undo
459 459
 					'fees'             => $details['fees'],
460 460
 				);
461 461
 
462
-				$item_columns = array_keys ( $fields );
462
+				$item_columns = array_keys($fields);
463 463
 
464
-				foreach ( $fields as $key => $val ) {
465
-					if ( is_null( $val ) ) {
464
+				foreach ($fields as $key => $val) {
465
+					if (is_null($val)) {
466 466
 						$val = '';
467 467
 					}
468
-					$val = maybe_serialize( $val );
469
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
468
+					$val = maybe_serialize($val);
469
+					$fields[$key] = $wpdb->prepare('%s', $val);
470 470
 				}
471 471
 
472
-				$fields = implode( ', ', $fields );
472
+				$fields = implode(', ', $fields);
473 473
 				$item_rows[] = "($fields)";
474 474
 			}
475 475
 
476
-			$item_rows    = implode( ', ', $item_rows );
477
-			$item_columns = implode( ', ', $item_columns );
478
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
476
+			$item_rows    = implode(', ', $item_rows);
477
+			$item_columns = implode(', ', $item_columns);
478
+			$wpdb->query("INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows");
479 479
 		}
480 480
 
481
-		if ( empty( $invoice_rows ) ) {
481
+		if (empty($invoice_rows)) {
482 482
 			return;
483 483
 		}
484 484
 
485
-		$invoice_rows = implode( ', ', $invoice_rows );
486
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
485
+		$invoice_rows = implode(', ', $invoice_rows);
486
+		$wpdb->query("INSERT INTO $invoices_table VALUES $invoice_rows");
487 487
 
488 488
 	}
489 489
 
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 	public static function rename_gateways_label() {
495 495
 		global $wpdb;
496 496
 
497
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
497
+		foreach (array_keys(wpinv_get_payment_gateways()) as $gateway) {
498 498
 
499 499
 			$wpdb->update(
500 500
 				$wpdb->prefix . 'getpaid_invoices',
501
-				array( 'gateway' => $gateway ),
502
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
501
+				array('gateway' => $gateway),
502
+				array('gateway' => wpinv_get_gateway_admin_label($gateway)),
503 503
 				'%s',
504 504
 				'%s'
505 505
 			);
Please login to merge, or discard this patch.
templates/payment-forms/elements/email.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 echo aui()->input(
20 20
     array(
21
-        'name'       => esc_attr( $id ),
22
-        'id'         => esc_attr( $id ) . uniqid( '_' ),
23
-        'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ),
24
-        'required'   => ! empty( $required ),
21
+        'name'       => esc_attr($id),
22
+        'id'         => esc_attr($id) . uniqid('_'),
23
+        'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder),
24
+        'required'   => !empty($required),
25 25
         'label'      => $label,
26 26
         'label_type' => 'vertical',
27
-        'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
27
+        'help_text'  => empty($description) ? '' : wp_kses_post($description),
28 28
         'type'       => 'email',
29 29
         'class' => $label_class,
30 30
     )
Please login to merge, or discard this patch.