Passed
Push — master ( c9008f...f9a8bb )
by Brian
04:54
created
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'addons' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'addons' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51 51
 
52 52
     }
53 53
 
54 54
     /**
55
-	 * Process Payment.
56
-	 *
57
-	 *
58
-	 * @param WPInv_Invoice $invoice Invoice.
59
-	 * @param array $submission_data Posted checkout fields.
60
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
-	 * @return array
62
-	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
55
+     * Process Payment.
56
+     *
57
+     *
58
+     * @param WPInv_Invoice $invoice Invoice.
59
+     * @param array $submission_data Posted checkout fields.
60
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
+     * @return array
62
+     */
63
+    public function process_payment( $invoice, $submission_data, $submission ) {
64 64
 
65 65
         // Add a transaction id.
66 66
         $invoice->set_transaction_id( $invoice->generate_key('trans_') );
@@ -81,66 +81,66 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     /**
84
-	 * Output for the order received page.
85
-	 *
86
-	 * @param WPInv_Invoice $invoice Invoice.
87
-	 */
88
-	public function thankyou_page( $invoice ) {
84
+     * Output for the order received page.
85
+     *
86
+     * @param WPInv_Invoice $invoice Invoice.
87
+     */
88
+    public function thankyou_page( $invoice ) {
89 89
 
90 90
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
91 91
 
92
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
92
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94 94
             if ( ! empty( $this->instructions ) ) {
95 95
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
96
-			}
96
+            }
97 97
 
98
-			$this->bank_details( $invoice );
98
+            $this->bank_details( $invoice );
99 99
 
100
-			echo '</div>';
100
+            echo '</div>';
101 101
 
102 102
         }
103 103
 
104
-	}
104
+    }
105 105
 
106 106
     /**
107
-	 * Add content to the WPI emails.
108
-	 *
109
-	 * @param WPInv_Invoice $invoice Invoice.
110
-	 * @param string     $email_type Email format: plain text or HTML.
111
-	 * @param bool     $sent_to_admin Sent to admin.
112
-	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
107
+     * Add content to the WPI emails.
108
+     *
109
+     * @param WPInv_Invoice $invoice Invoice.
110
+     * @param string     $email_type Email format: plain text or HTML.
111
+     * @param bool     $sent_to_admin Sent to admin.
112
+     */
113
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116 116
 
117
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
117
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+            if ( $this->instructions ) {
120
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+            $this->bank_details( $invoice );
124 124
 			
125
-			echo '</div>';
125
+            echo '</div>';
126 126
 
127
-		}
127
+        }
128 128
 
129 129
     }
130 130
     
131 131
     /**
132
-	 * Get bank details and place into a list format.
133
-	 *
134
-	 * @param WPInv_Invoice $invoice Invoice.
135
-	 */
136
-	protected function bank_details( $invoice ) {
132
+     * Get bank details and place into a list format.
133
+     *
134
+     * @param WPInv_Invoice $invoice Invoice.
135
+     */
136
+    protected function bank_details( $invoice ) {
137 137
 
138
-		// Get the invoice country and country $locale.
139
-		$country = $invoice->get_country();
140
-		$locale  = $this->get_country_locale();
138
+        // Get the invoice country and country $locale.
139
+        $country = $invoice->get_country();
140
+        $locale  = $this->get_country_locale();
141 141
 
142
-		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
142
+        // Get sortcode label in the $locale array and use appropriate one.
143
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
144 144
 
145 145
         $bank_fields = array(
146 146
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -169,144 +169,144 @@  discard block
 block discarded – undo
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
173 173
 
174
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
174
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+        foreach ( $bank_info as $key => $data ) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+            $key   = sanitize_html_class( $key );
179
+            $label = wp_kses_post( $data['label'] );
180
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
181 181
 
182
-			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
-		}
182
+            echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
+        }
184 184
 
185
-		echo '</table>';
185
+        echo '</table>';
186 186
 
187 187
     }
188 188
     
189 189
     /**
190
-	 * Get country locale if localized.
191
-	 *
192
-	 * @return array
193
-	 */
194
-	public function get_country_locale() {
195
-
196
-		if ( empty( $this->locale ) ) {
197
-
198
-			// Locale information to be used - only those that are not 'Sort Code'.
199
-			$this->locale = apply_filters(
200
-				'getpaid_get_bank_transfer_locale',
201
-				array(
202
-					'AU' => array(
203
-						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
205
-						),
206
-					),
207
-					'CA' => array(
208
-						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
210
-						),
211
-					),
212
-					'IN' => array(
213
-						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
215
-						),
216
-					),
217
-					'IT' => array(
218
-						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
220
-						),
221
-					),
222
-					'NZ' => array(
223
-						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
225
-						),
226
-					),
227
-					'SE' => array(
228
-						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
230
-						),
231
-					),
232
-					'US' => array(
233
-						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
235
-						),
236
-					),
237
-					'ZA' => array(
238
-						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
240
-						),
241
-					),
242
-				)
243
-			);
244
-
245
-		}
246
-
247
-		return $this->locale;
248
-
249
-	}
250
-
251
-	/**
252
-	 * Filters the gateway settings.
253
-	 * 
254
-	 * @param array $admin_settings
255
-	 */
256
-	public function admin_settings( $admin_settings ) {
190
+     * Get country locale if localized.
191
+     *
192
+     * @return array
193
+     */
194
+    public function get_country_locale() {
195
+
196
+        if ( empty( $this->locale ) ) {
197
+
198
+            // Locale information to be used - only those that are not 'Sort Code'.
199
+            $this->locale = apply_filters(
200
+                'getpaid_get_bank_transfer_locale',
201
+                array(
202
+                    'AU' => array(
203
+                        'sortcode' => array(
204
+                            'label' => __( 'BSB', 'invoicing' ),
205
+                        ),
206
+                    ),
207
+                    'CA' => array(
208
+                        'sortcode' => array(
209
+                            'label' => __( 'Bank transit number', 'invoicing' ),
210
+                        ),
211
+                    ),
212
+                    'IN' => array(
213
+                        'sortcode' => array(
214
+                            'label' => __( 'IFSC', 'invoicing' ),
215
+                        ),
216
+                    ),
217
+                    'IT' => array(
218
+                        'sortcode' => array(
219
+                            'label' => __( 'Branch sort', 'invoicing' ),
220
+                        ),
221
+                    ),
222
+                    'NZ' => array(
223
+                        'sortcode' => array(
224
+                            'label' => __( 'Bank code', 'invoicing' ),
225
+                        ),
226
+                    ),
227
+                    'SE' => array(
228
+                        'sortcode' => array(
229
+                            'label' => __( 'Bank code', 'invoicing' ),
230
+                        ),
231
+                    ),
232
+                    'US' => array(
233
+                        'sortcode' => array(
234
+                            'label' => __( 'Routing number', 'invoicing' ),
235
+                        ),
236
+                    ),
237
+                    'ZA' => array(
238
+                        'sortcode' => array(
239
+                            'label' => __( 'Branch code', 'invoicing' ),
240
+                        ),
241
+                    ),
242
+                )
243
+            );
244
+
245
+        }
246
+
247
+        return $this->locale;
248
+
249
+    }
250
+
251
+    /**
252
+     * Filters the gateway settings.
253
+     * 
254
+     * @param array $admin_settings
255
+     */
256
+    public function admin_settings( $admin_settings ) {
257 257
 
258 258
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
259
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+        $locale  = $this->get_country_locale();
262 262
 
263
-		// Get sortcode label in the $locale array and use appropriate one.
264
-		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
263
+        // Get sortcode label in the $locale array and use appropriate one.
264
+        $country  = wpinv_default_billing_country();
265
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
266 266
 
267
-		$admin_settings['bank_transfer_ac_name'] = array(
267
+        $admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270 270
             'name' => __( 'Account Name', 'invoicing' ),
271
-		);
271
+        );
272 272
 		
273
-		$admin_settings['bank_transfer_ac_no'] = array(
273
+        $admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276 276
             'name' => __( 'Account Number', 'invoicing' ),
277
-		);
277
+        );
278 278
 		
279
-		$admin_settings['bank_transfer_bank_name'] = array(
279
+        $admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282 282
             'name' => __( 'Bank Name', 'invoicing' ),
283
-		);
283
+        );
284 284
 
285
-		$admin_settings['bank_transfer_ifsc'] = array(
285
+        $admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288 288
             'name' => __( 'IFSC Code', 'invoicing' ),
289
-		);
289
+        );
290 290
 
291
-		$admin_settings['bank_transfer_iban'] = array(
291
+        $admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294 294
             'name' => __( 'IBAN', 'invoicing' ),
295
-		);
295
+        );
296 296
 
297
-		$admin_settings['bank_transfer_bic'] = array(
297
+        $admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300 300
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
301
-		);
301
+        );
302 302
 		
303
-		$admin_settings['bank_transfer_sort_code'] = array(
304
-			'type' => 'text',
305
-			'id'   => 'bank_transfer_sort_code',
306
-			'name' => $sortcode,
307
-		);
303
+        $admin_settings['bank_transfer_sort_code'] = array(
304
+            'type' => 'text',
305
+            'id'   => 'bank_transfer_sort_code',
306
+            'name' => $sortcode,
307
+        );
308 308
 
309
-		$admin_settings['bank_transfer_info'] = array(
309
+        $admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311 311
             'name' => __( 'Instructions', 'invoicing' ),
312 312
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
             'rows' => 5
317 317
         );
318 318
 
319
-		return $admin_settings;
320
-	}
319
+        return $admin_settings;
320
+    }
321 321
 
322
-	/**
323
-	 * Processes invoice addons.
324
-	 *
325
-	 * @param WPInv_Invoice $invoice
326
-	 * @param GetPaid_Form_Item[] $items
327
-	 * @return WPInv_Invoice
328
-	 */
329
-	public function process_addons( $invoice, $items ) {
322
+    /**
323
+     * Processes invoice addons.
324
+     *
325
+     * @param WPInv_Invoice $invoice
326
+     * @param GetPaid_Form_Item[] $items
327
+     * @return WPInv_Invoice
328
+     */
329
+    public function process_addons( $invoice, $items ) {
330 330
 
331 331
         foreach ( $items as $item ) {
332 332
             $invoice->add_item( $item );
@@ -334,6 +334,6 @@  discard block
 block discarded – undo
334 334
 
335 335
         $invoice->recalculate_total();
336 336
         $invoice->save();
337
-	}
337
+    }
338 338
 
339 339
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Bank transfer Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected $supports = array( 'addons' );
27
+	protected $supports = array('addons');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
43
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
44
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
42
+        $this->title                = __('Direct bank transfer', 'invoicing');
43
+        $this->method_title         = __('Bank transfer', 'invoicing');
44
+        $this->checkout_button_text = __('Proceed', 'invoicing');
45
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
48
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
49
+		add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11);
50
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
51 51
 
52 52
     }
53 53
 
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61 61
 	 * @return array
62 62
 	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
63
+	public function process_payment($invoice, $submission_data, $submission) {
64 64
 
65 65
         // Add a transaction id.
66
-        $invoice->set_transaction_id( $invoice->generate_key('trans_') );
66
+        $invoice->set_transaction_id($invoice->generate_key('trans_'));
67 67
 
68 68
         // Set it as pending payment.
69
-        if ( ! $invoice->needs_payment() ) {
69
+        if (!$invoice->needs_payment()) {
70 70
             $invoice->mark_paid();
71
-        } else if ( ! $invoice->is_paid() ) {
72
-            $invoice->set_status( 'wpi-onhold' );
71
+        } else if (!$invoice->is_paid()) {
72
+            $invoice->set_status('wpi-onhold');
73 73
         }
74 74
 
75 75
         // Save it.
76 76
         $invoice->save();
77 77
 
78 78
         // Send to the success page.
79
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
79
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
80 80
 
81 81
     }
82 82
 
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param WPInv_Invoice $invoice Invoice.
87 87
 	 */
88
-	public function thankyou_page( $invoice ) {
88
+	public function thankyou_page($invoice) {
89 89
 
90
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
90
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
91 91
 
92 92
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94
-            if ( ! empty( $this->instructions ) ) {
95
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
94
+            if (!empty($this->instructions)) {
95
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
96 96
 			}
97 97
 
98
-			$this->bank_details( $invoice );
98
+			$this->bank_details($invoice);
99 99
 
100 100
 			echo '</div>';
101 101
 
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * @param string     $email_type Email format: plain text or HTML.
111 111
 	 * @param bool     $sent_to_admin Sent to admin.
112 112
 	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
113
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
116 116
 
117 117
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+			if ($this->instructions) {
120
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+			$this->bank_details($invoice);
124 124
 			
125 125
 			echo '</div>';
126 126
 
@@ -133,51 +133,51 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param WPInv_Invoice $invoice Invoice.
135 135
 	 */
136
-	protected function bank_details( $invoice ) {
136
+	protected function bank_details($invoice) {
137 137
 
138 138
 		// Get the invoice country and country $locale.
139 139
 		$country = $invoice->get_country();
140 140
 		$locale  = $this->get_country_locale();
141 141
 
142 142
 		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
144 144
 
145 145
         $bank_fields = array(
146
-            'ac_name'     => __( 'Account Name', 'invoicing' ),
147
-            'ac_no'       => __( 'Account Number', 'invoicing' ),
148
-            'bank_name'   => __( 'Bank Name', 'invoicing' ),
149
-            'ifsc'        => __( 'IFSC code', 'invoicing' ),
150
-            'iban'        => __( 'IBAN', 'invoicing' ),
151
-            'bic'         => __( 'BIC/Swift code', 'invoicing' ),
146
+            'ac_name'     => __('Account Name', 'invoicing'),
147
+            'ac_no'       => __('Account Number', 'invoicing'),
148
+            'bank_name'   => __('Bank Name', 'invoicing'),
149
+            'ifsc'        => __('IFSC code', 'invoicing'),
150
+            'iban'        => __('IBAN', 'invoicing'),
151
+            'bic'         => __('BIC/Swift code', 'invoicing'),
152 152
             'sort_code'   => $sortcode,
153 153
         );
154 154
 
155 155
         $bank_info = array();
156 156
 
157
-        foreach ( $bank_fields as $field => $label ) {
158
-            $value = $this->get_option( $field );
157
+        foreach ($bank_fields as $field => $label) {
158
+            $value = $this->get_option($field);
159 159
 
160
-            if ( ! empty( $value ) ) {
161
-                $bank_info[$field] = array( 'label' => $label, 'value' => $value );
160
+            if (!empty($value)) {
161
+                $bank_info[$field] = array('label' => $label, 'value' => $value);
162 162
             }
163 163
 
164 164
         }
165 165
 
166
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info );
166
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info);
167 167
 
168
-        if ( empty( $bank_info ) ) {
168
+        if (empty($bank_info)) {
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL;
173 173
 
174 174
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+		foreach ($bank_info as $key => $data) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+			$key   = sanitize_html_class($key);
179
+			$label = wp_kses_post($data['label']);
180
+			$value = wp_kses_post(wptexturize($data['value']));
181 181
 
182 182
 			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183 183
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function get_country_locale() {
195 195
 
196
-		if ( empty( $this->locale ) ) {
196
+		if (empty($this->locale)) {
197 197
 
198 198
 			// Locale information to be used - only those that are not 'Sort Code'.
199 199
 			$this->locale = apply_filters(
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
 				array(
202 202
 					'AU' => array(
203 203
 						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
204
+							'label' => __('BSB', 'invoicing'),
205 205
 						),
206 206
 					),
207 207
 					'CA' => array(
208 208
 						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
209
+							'label' => __('Bank transit number', 'invoicing'),
210 210
 						),
211 211
 					),
212 212
 					'IN' => array(
213 213
 						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
214
+							'label' => __('IFSC', 'invoicing'),
215 215
 						),
216 216
 					),
217 217
 					'IT' => array(
218 218
 						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
219
+							'label' => __('Branch sort', 'invoicing'),
220 220
 						),
221 221
 					),
222 222
 					'NZ' => array(
223 223
 						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
224
+							'label' => __('Bank code', 'invoicing'),
225 225
 						),
226 226
 					),
227 227
 					'SE' => array(
228 228
 						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
229
+							'label' => __('Bank code', 'invoicing'),
230 230
 						),
231 231
 					),
232 232
 					'US' => array(
233 233
 						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
234
+							'label' => __('Routing number', 'invoicing'),
235 235
 						),
236 236
 					),
237 237
 					'ZA' => array(
238 238
 						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
239
+							'label' => __('Branch code', 'invoicing'),
240 240
 						),
241 241
 					),
242 242
 				)
@@ -253,51 +253,51 @@  discard block
 block discarded – undo
253 253
 	 * 
254 254
 	 * @param array $admin_settings
255 255
 	 */
256
-	public function admin_settings( $admin_settings ) {
256
+	public function admin_settings($admin_settings) {
257 257
 
258
-        $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258
+        $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
259
+		$admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing');
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+		$locale = $this->get_country_locale();
262 262
 
263 263
 		// Get sortcode label in the $locale array and use appropriate one.
264 264
 		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
265
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
266 266
 
267 267
 		$admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270
-            'name' => __( 'Account Name', 'invoicing' ),
270
+            'name' => __('Account Name', 'invoicing'),
271 271
 		);
272 272
 		
273 273
 		$admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276
-            'name' => __( 'Account Number', 'invoicing' ),
276
+            'name' => __('Account Number', 'invoicing'),
277 277
 		);
278 278
 		
279 279
 		$admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282
-            'name' => __( 'Bank Name', 'invoicing' ),
282
+            'name' => __('Bank Name', 'invoicing'),
283 283
 		);
284 284
 
285 285
 		$admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288
-            'name' => __( 'IFSC Code', 'invoicing' ),
288
+            'name' => __('IFSC Code', 'invoicing'),
289 289
 		);
290 290
 
291 291
 		$admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294
-            'name' => __( 'IBAN', 'invoicing' ),
294
+            'name' => __('IBAN', 'invoicing'),
295 295
 		);
296 296
 
297 297
 		$admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
300
+            'name' => __('BIC/Swift Code', 'invoicing'),
301 301
 		);
302 302
 		
303 303
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 
309 309
 		$admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311
-            'name' => __( 'Instructions', 'invoicing' ),
312
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
311
+            'name' => __('Instructions', 'invoicing'),
312
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
313 313
             'type' => 'textarea',
314
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
314
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
315 315
             'cols' => 50,
316 316
             'rows' => 5
317 317
         );
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @param GetPaid_Form_Item[] $items
327 327
 	 * @return WPInv_Invoice
328 328
 	 */
329
-	public function process_addons( $invoice, $items ) {
329
+	public function process_addons($invoice, $items) {
330 330
 
331
-        foreach ( $items as $item ) {
332
-            $invoice->add_item( $item );
331
+        foreach ($items as $item) {
332
+            $invoice->add_item($item);
333 333
         }
334 334
 
335 335
         $invoice->recalculate_total();
Please login to merge, or discard this patch.
includes/class-wpinv.php 2 patches
Indentation   +504 added lines, -504 removed lines patch added patch discarded remove patch
@@ -14,547 +14,547 @@
 block discarded – undo
14 14
  */
15 15
 class WPInv_Plugin {
16 16
 
17
-	/**
18
-	 * GetPaid version.
19
-	 *
20
-	 * @var string
21
-	 */
22
-	public $version;
23
-
24
-	/**
25
-	 * Data container.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	protected $data = array();
30
-
31
-	/**
32
-	 * Form elements instance.
33
-	 *
34
-	 * @var WPInv_Payment_Form_Elements
35
-	 */
36
-	public $form_elements;
37
-
38
-	/**
39
-	 * @param array An array of payment gateways.
40
-	 */
41
-	public $gateways;
42
-
43
-	/**
44
-	 * Class constructor.
45
-	 */
46
-	public function __construct() {
47
-		$this->define_constants();
48
-		$this->includes();
49
-		$this->init_hooks();
50
-		$this->set_properties();
51
-	}
52
-
53
-	/**
54
-	 * Sets a custom data property.
55
-	 * 
56
-	 * @param string $prop The prop to set.
57
-	 * @param mixed $value The value to retrieve.
58
-	 */
59
-	public function set( $prop, $value ) {
60
-		$this->data[ $prop ] = $value;
61
-	}
62
-
63
-	/**
64
-	 * Gets a custom data property.
65
-	 *
66
-	 * @param string $prop The prop to set.
67
-	 * @return mixed The value.
68
-	 */
69
-	public function get( $prop ) {
70
-
71
-		if ( isset( $this->data[ $prop ] ) ) {
72
-			return $this->data[ $prop ];
73
-		}
74
-
75
-		return null;
76
-	}
77
-
78
-	/**
79
-	 * Define class properties.
80
-	 */
81
-	public function set_properties() {
82
-
83
-		// Sessions.
84
-		$this->set( 'session', new WPInv_Session_Handler() );
85
-		$GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
86
-		$GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
87
-
88
-		// Init other objects.
89
-		$this->set( 'session', new WPInv_Session_Handler() );
90
-		$this->set( 'notes', new WPInv_Notes() );
91
-		$this->set( 'api', new WPInv_API() );
92
-		$this->set( 'post_types', new GetPaid_Post_Types() );
93
-		$this->set( 'template', new GetPaid_Template() );
94
-		$this->set( 'admin', new GetPaid_Admin() );
95
-		$this->set( 'subscriptions', new WPInv_Subscriptions() );
96
-		$this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
97
-		$this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
98
-		$this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
99
-		$this->set( 'payment_forms', new GetPaid_Payment_Forms() );
100
-		$this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
101
-
102
-	}
103
-
104
-	 /**
105
-	 * Define plugin constants.
106
-	 */
107
-	public function define_constants() {
108
-		define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
109
-		define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
110
-		$this->version = WPINV_VERSION;
111
-	}
112
-
113
-	/**
114
-	 * Hook into actions and filters.
115
-	 *
116
-	 * @since 1.0.19
117
-	 */
118
-	protected function init_hooks() {
119
-		/* Internationalize the text strings used. */
120
-		add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
121
-
122
-		// Init the plugin after WordPress inits.
123
-		add_action( 'init', array( $this, 'init' ), 1 );
124
-		add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
125
-		add_action( 'init', array( $this, 'wpinv_actions' ) );
126
-		add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
127
-
128
-		if ( class_exists( 'BuddyPress' ) ) {
129
-			add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
130
-		}
131
-
132
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
133
-		add_action( 'wp_footer', array( $this, 'wp_footer' ) );
134
-		add_action( 'wp_head', array( $this, 'wp_head' ) );
135
-		add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
136
-		add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
137
-		add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
138
-
139
-		// Fires after registering actions.
140
-		do_action( 'wpinv_actions', $this );
141
-		do_action( 'getpaid_actions', $this );
142
-
143
-	}
144
-
145
-	public function plugins_loaded() {
146
-		/* Internationalize the text strings used. */
147
-		$this->load_textdomain();
148
-
149
-		do_action( 'wpinv_loaded' );
150
-
151
-		// Fix oxygen page builder conflict
152
-		if ( function_exists( 'ct_css_output' ) ) {
153
-			wpinv_oxygen_fix_conflict();
154
-		}
155
-	}
156
-
157
-	/**
158
-	 * Load the translation of the plugin.
159
-	 *
160
-	 * @since 1.0
161
-	 */
162
-	public function load_textdomain( $locale = NULL ) {
163
-		if ( empty( $locale ) ) {
164
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
165
-		}
166
-
167
-		$locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
168
-
169
-		unload_textdomain( 'invoicing' );
170
-		load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
171
-		load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
172
-
173
-		/**
174
-		 * Define language constants.
175
-		 */
176
-		require_once( WPINV_PLUGIN_DIR . 'language.php' );
177
-	}
178
-
179
-	/**
180
-	 * Include required core files used in admin and on the frontend.
181
-	 */
182
-	public function includes() {
183
-
184
-		// Start with the settings.
185
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
186
-
187
-		// Packages/libraries.
188
-		require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
189
-		require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
190
-
191
-		// Load functions.
192
-		require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' );
193
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
194
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
195
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
196
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
197
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
198
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
199
-		require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' );
200
-		require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' );
201
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
202
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
203
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
204
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
205
-		require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' );
206
-		require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' );
207
-
208
-		// Register autoloader.
209
-		try {
210
-			spl_autoload_register( array( $this, 'autoload' ), true );
211
-		} catch ( Exception $e ) {
212
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
213
-		}
214
-
215
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
216
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
217
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
218
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
219
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
220
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
221
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
222
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
223
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
224
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
225
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
226
-		require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
227
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
228
-		require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
229
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
230
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
231
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
232
-		require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
233
-		require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
234
-		require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
235
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
236
-
237
-		if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
238
-			GetPaid_Post_Types_Admin::init();
239
-
240
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
241
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
242
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
243
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
244
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
245
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
246
-			// load the user class only on the users.php page
247
-			global $pagenow;
248
-			if($pagenow=='users.php'){
249
-				new WPInv_Admin_Users();
250
-			}
251
-		}
252
-
253
-		// Register cli commands
254
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
255
-			require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
256
-			WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
257
-		}
258
-
259
-	}
260
-
261
-	/**
262
-	 * Class autoloader
263
-	 *
264
-	 * @param       string $class_name The name of the class to load.
265
-	 * @access      public
266
-	 * @since       1.0.19
267
-	 * @return      void
268
-	 */
269
-	public function autoload( $class_name ) {
270
-
271
-		// Normalize the class name...
272
-		$class_name  = strtolower( $class_name );
273
-
274
-		// ... and make sure it is our class.
275
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
276
-			return;
277
-		}
278
-
279
-		// Next, prepare the file name from the class.
280
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
281
-
282
-		// Base path of the classes.
283
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
284
-
285
-		// And an array of possible locations in order of importance.
286
-		$locations = array(
287
-			"$plugin_path/includes",
288
-			"$plugin_path/includes/data-stores",
289
-			"$plugin_path/includes/gateways",
290
-			"$plugin_path/includes/payments",
291
-			"$plugin_path/includes/geolocation",
292
-			"$plugin_path/includes/reports",
293
-			"$plugin_path/includes/api",
294
-			"$plugin_path/includes/admin",
295
-			"$plugin_path/includes/admin/meta-boxes",
296
-		);
297
-
298
-		foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
299
-
300
-			if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
301
-				include trailingslashit( $location ) . $file_name;
302
-				break;
303
-			}
304
-
305
-		}
306
-
307
-	}
308
-
309
-	/**
310
-	 * Inits hooks etc.
311
-	 */
312
-	public function init() {
313
-
314
-		// Fires before getpaid inits.
315
-		do_action( 'before_getpaid_init', $this );
316
-
317
-		// Maybe upgrade.
318
-		$this->maybe_upgrade_database();
319
-
320
-		// Load default gateways.
321
-		$gateways = apply_filters(
322
-			'getpaid_default_gateways',
323
-			array(
324
-				'manual'        => 'GetPaid_Manual_Gateway',
325
-				'paypal'        => 'GetPaid_Paypal_Gateway',
326
-				'worldpay'      => 'GetPaid_Worldpay_Gateway',
327
-				'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway',
328
-				'authorizenet'  => 'GetPaid_Authorize_Net_Gateway',
329
-			)
330
-		);
331
-
332
-		foreach ( $gateways as $id => $class ) {
333
-			$this->gateways[ $id ] = new $class();
334
-		}
335
-
336
-		// Fires after getpaid inits.
337
-		do_action( 'getpaid_init', $this );
338
-
339
-	}
340
-
341
-	/**
342
-	 * Checks if this is an IPN request and processes it.
343
-	 */
344
-	public function maybe_process_ipn() {
345
-
346
-		// Ensure that this is an IPN request.
347
-		if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
348
-			return;
349
-		}
350
-
351
-		$gateway = wpinv_clean( $_GET['wpi-gateway'] );
352
-
353
-		do_action( 'wpinv_verify_payment_ipn', $gateway );
354
-		do_action( "wpinv_verify_{$gateway}_ipn" );
355
-		exit;
356
-
357
-	}
358
-
359
-	public function enqueue_scripts() {
360
-
361
-		// Fires before adding scripts.
362
-		do_action( 'getpaid_enqueue_scripts' );
363
-
364
-		$localize                         = array();
365
-		$localize['ajax_url']             = admin_url( 'admin-ajax.php' );
366
-		$localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
367
-		$localize['txtComplete']          = __( 'Continue', 'invoicing' );
368
-		$localize['UseTaxes']             = wpinv_use_taxes();
369
-		$localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
370
-		$localize['loading']              = __( 'Loading...', 'invoicing' );
371
-		$localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
372
-
373
-		$localize = apply_filters( 'wpinv_front_js_localize', $localize );
374
-
375
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
376
-		wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ),  $version, true );
377
-		wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
378
-	}
379
-
380
-	public function wpinv_actions() {
381
-		if ( isset( $_REQUEST['wpi_action'] ) ) {
382
-			do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
383
-		}
384
-	}
385
-
386
-	/**
17
+    /**
18
+     * GetPaid version.
19
+     *
20
+     * @var string
21
+     */
22
+    public $version;
23
+
24
+    /**
25
+     * Data container.
26
+     *
27
+     * @var array
28
+     */
29
+    protected $data = array();
30
+
31
+    /**
32
+     * Form elements instance.
33
+     *
34
+     * @var WPInv_Payment_Form_Elements
35
+     */
36
+    public $form_elements;
37
+
38
+    /**
39
+     * @param array An array of payment gateways.
40
+     */
41
+    public $gateways;
42
+
43
+    /**
44
+     * Class constructor.
45
+     */
46
+    public function __construct() {
47
+        $this->define_constants();
48
+        $this->includes();
49
+        $this->init_hooks();
50
+        $this->set_properties();
51
+    }
52
+
53
+    /**
54
+     * Sets a custom data property.
55
+     * 
56
+     * @param string $prop The prop to set.
57
+     * @param mixed $value The value to retrieve.
58
+     */
59
+    public function set( $prop, $value ) {
60
+        $this->data[ $prop ] = $value;
61
+    }
62
+
63
+    /**
64
+     * Gets a custom data property.
65
+     *
66
+     * @param string $prop The prop to set.
67
+     * @return mixed The value.
68
+     */
69
+    public function get( $prop ) {
70
+
71
+        if ( isset( $this->data[ $prop ] ) ) {
72
+            return $this->data[ $prop ];
73
+        }
74
+
75
+        return null;
76
+    }
77
+
78
+    /**
79
+     * Define class properties.
80
+     */
81
+    public function set_properties() {
82
+
83
+        // Sessions.
84
+        $this->set( 'session', new WPInv_Session_Handler() );
85
+        $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
86
+        $GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
87
+
88
+        // Init other objects.
89
+        $this->set( 'session', new WPInv_Session_Handler() );
90
+        $this->set( 'notes', new WPInv_Notes() );
91
+        $this->set( 'api', new WPInv_API() );
92
+        $this->set( 'post_types', new GetPaid_Post_Types() );
93
+        $this->set( 'template', new GetPaid_Template() );
94
+        $this->set( 'admin', new GetPaid_Admin() );
95
+        $this->set( 'subscriptions', new WPInv_Subscriptions() );
96
+        $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
97
+        $this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
98
+        $this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
99
+        $this->set( 'payment_forms', new GetPaid_Payment_Forms() );
100
+        $this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
101
+
102
+    }
103
+
104
+        /**
105
+         * Define plugin constants.
106
+         */
107
+    public function define_constants() {
108
+        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
109
+        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
110
+        $this->version = WPINV_VERSION;
111
+    }
112
+
113
+    /**
114
+     * Hook into actions and filters.
115
+     *
116
+     * @since 1.0.19
117
+     */
118
+    protected function init_hooks() {
119
+        /* Internationalize the text strings used. */
120
+        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
121
+
122
+        // Init the plugin after WordPress inits.
123
+        add_action( 'init', array( $this, 'init' ), 1 );
124
+        add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
125
+        add_action( 'init', array( $this, 'wpinv_actions' ) );
126
+        add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
127
+
128
+        if ( class_exists( 'BuddyPress' ) ) {
129
+            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
130
+        }
131
+
132
+        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
133
+        add_action( 'wp_footer', array( $this, 'wp_footer' ) );
134
+        add_action( 'wp_head', array( $this, 'wp_head' ) );
135
+        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
136
+        add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
137
+        add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
138
+
139
+        // Fires after registering actions.
140
+        do_action( 'wpinv_actions', $this );
141
+        do_action( 'getpaid_actions', $this );
142
+
143
+    }
144
+
145
+    public function plugins_loaded() {
146
+        /* Internationalize the text strings used. */
147
+        $this->load_textdomain();
148
+
149
+        do_action( 'wpinv_loaded' );
150
+
151
+        // Fix oxygen page builder conflict
152
+        if ( function_exists( 'ct_css_output' ) ) {
153
+            wpinv_oxygen_fix_conflict();
154
+        }
155
+    }
156
+
157
+    /**
158
+     * Load the translation of the plugin.
159
+     *
160
+     * @since 1.0
161
+     */
162
+    public function load_textdomain( $locale = NULL ) {
163
+        if ( empty( $locale ) ) {
164
+            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
165
+        }
166
+
167
+        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
168
+
169
+        unload_textdomain( 'invoicing' );
170
+        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
171
+        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
172
+
173
+        /**
174
+         * Define language constants.
175
+         */
176
+        require_once( WPINV_PLUGIN_DIR . 'language.php' );
177
+    }
178
+
179
+    /**
180
+     * Include required core files used in admin and on the frontend.
181
+     */
182
+    public function includes() {
183
+
184
+        // Start with the settings.
185
+        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
186
+
187
+        // Packages/libraries.
188
+        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
189
+        require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
190
+
191
+        // Load functions.
192
+        require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' );
193
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
194
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
195
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
196
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
197
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
198
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
199
+        require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' );
200
+        require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' );
201
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
202
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
203
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
204
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
205
+        require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' );
206
+        require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' );
207
+
208
+        // Register autoloader.
209
+        try {
210
+            spl_autoload_register( array( $this, 'autoload' ), true );
211
+        } catch ( Exception $e ) {
212
+            wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
213
+        }
214
+
215
+        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
216
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
217
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
218
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
219
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
220
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
221
+        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
222
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
223
+        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
224
+        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
225
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
226
+        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
227
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
228
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
229
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
230
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
231
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
232
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
233
+        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
234
+        require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
235
+        require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
236
+
237
+        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
238
+            GetPaid_Post_Types_Admin::init();
239
+
240
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
241
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
242
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
243
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
244
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
245
+            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
246
+            // load the user class only on the users.php page
247
+            global $pagenow;
248
+            if($pagenow=='users.php'){
249
+                new WPInv_Admin_Users();
250
+            }
251
+        }
252
+
253
+        // Register cli commands
254
+        if ( defined( 'WP_CLI' ) && WP_CLI ) {
255
+            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
256
+            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
257
+        }
258
+
259
+    }
260
+
261
+    /**
262
+     * Class autoloader
263
+     *
264
+     * @param       string $class_name The name of the class to load.
265
+     * @access      public
266
+     * @since       1.0.19
267
+     * @return      void
268
+     */
269
+    public function autoload( $class_name ) {
270
+
271
+        // Normalize the class name...
272
+        $class_name  = strtolower( $class_name );
273
+
274
+        // ... and make sure it is our class.
275
+        if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
276
+            return;
277
+        }
278
+
279
+        // Next, prepare the file name from the class.
280
+        $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
281
+
282
+        // Base path of the classes.
283
+        $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
284
+
285
+        // And an array of possible locations in order of importance.
286
+        $locations = array(
287
+            "$plugin_path/includes",
288
+            "$plugin_path/includes/data-stores",
289
+            "$plugin_path/includes/gateways",
290
+            "$plugin_path/includes/payments",
291
+            "$plugin_path/includes/geolocation",
292
+            "$plugin_path/includes/reports",
293
+            "$plugin_path/includes/api",
294
+            "$plugin_path/includes/admin",
295
+            "$plugin_path/includes/admin/meta-boxes",
296
+        );
297
+
298
+        foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
299
+
300
+            if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
301
+                include trailingslashit( $location ) . $file_name;
302
+                break;
303
+            }
304
+
305
+        }
306
+
307
+    }
308
+
309
+    /**
310
+     * Inits hooks etc.
311
+     */
312
+    public function init() {
313
+
314
+        // Fires before getpaid inits.
315
+        do_action( 'before_getpaid_init', $this );
316
+
317
+        // Maybe upgrade.
318
+        $this->maybe_upgrade_database();
319
+
320
+        // Load default gateways.
321
+        $gateways = apply_filters(
322
+            'getpaid_default_gateways',
323
+            array(
324
+                'manual'        => 'GetPaid_Manual_Gateway',
325
+                'paypal'        => 'GetPaid_Paypal_Gateway',
326
+                'worldpay'      => 'GetPaid_Worldpay_Gateway',
327
+                'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway',
328
+                'authorizenet'  => 'GetPaid_Authorize_Net_Gateway',
329
+            )
330
+        );
331
+
332
+        foreach ( $gateways as $id => $class ) {
333
+            $this->gateways[ $id ] = new $class();
334
+        }
335
+
336
+        // Fires after getpaid inits.
337
+        do_action( 'getpaid_init', $this );
338
+
339
+    }
340
+
341
+    /**
342
+     * Checks if this is an IPN request and processes it.
343
+     */
344
+    public function maybe_process_ipn() {
345
+
346
+        // Ensure that this is an IPN request.
347
+        if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
348
+            return;
349
+        }
350
+
351
+        $gateway = wpinv_clean( $_GET['wpi-gateway'] );
352
+
353
+        do_action( 'wpinv_verify_payment_ipn', $gateway );
354
+        do_action( "wpinv_verify_{$gateway}_ipn" );
355
+        exit;
356
+
357
+    }
358
+
359
+    public function enqueue_scripts() {
360
+
361
+        // Fires before adding scripts.
362
+        do_action( 'getpaid_enqueue_scripts' );
363
+
364
+        $localize                         = array();
365
+        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
366
+        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
367
+        $localize['txtComplete']          = __( 'Continue', 'invoicing' );
368
+        $localize['UseTaxes']             = wpinv_use_taxes();
369
+        $localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
370
+        $localize['loading']              = __( 'Loading...', 'invoicing' );
371
+        $localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
372
+
373
+        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
374
+
375
+        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
376
+        wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ),  $version, true );
377
+        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
378
+    }
379
+
380
+    public function wpinv_actions() {
381
+        if ( isset( $_REQUEST['wpi_action'] ) ) {
382
+            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
383
+        }
384
+    }
385
+
386
+    /**
387 387
      * Fires an action after verifying that a user can fire them.
388
-	 *
389
-	 * Note: If the action is on an invoice, subscription etc, esure that the
390
-	 * current user owns the invoice/subscription.
388
+     *
389
+     * Note: If the action is on an invoice, subscription etc, esure that the
390
+     * current user owns the invoice/subscription.
391 391
      */
392 392
     public function maybe_do_authenticated_action() {
393 393
 
394
-		if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
394
+        if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
395 395
 
396
-			$key  = sanitize_key( $_REQUEST['getpaid-action'] );
397
-			$data = wp_unslash( $_REQUEST );
398
-			if ( is_user_logged_in() ) {
399
-				do_action( "getpaid_authenticated_action_$key", $data );
400
-			}
396
+            $key  = sanitize_key( $_REQUEST['getpaid-action'] );
397
+            $data = wp_unslash( $_REQUEST );
398
+            if ( is_user_logged_in() ) {
399
+                do_action( "getpaid_authenticated_action_$key", $data );
400
+            }
401 401
 
402
-			do_action( "getpaid_unauthenticated_action_$key", $data );
402
+            do_action( "getpaid_unauthenticated_action_$key", $data );
403 403
 
404
-		}
404
+        }
405
+
406
+    }
407
+
408
+    public function pre_get_posts( $wp_query ) {
409
+
410
+        if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
411
+            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
412
+        }
413
+
414
+        return $wp_query;
415
+    }
405 416
 
417
+    public function bp_invoicing_init() {
418
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
406 419
     }
407 420
 
408
-	public function pre_get_posts( $wp_query ) {
409
-
410
-		if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
411
-			$wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
412
-		}
413
-
414
-		return $wp_query;
415
-	}
416
-
417
-	public function bp_invoicing_init() {
418
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
419
-	}
420
-
421
-	/**
422
-	 * Register widgets
423
-	 *
424
-	 */
425
-	public function register_widgets() {
426
-
427
-		// Currently, UX Builder does not work particulaly well with SuperDuper.
428
-		// So we disable our widgets when editing a page with UX Builder.
429
-		if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
430
-			return;
431
-		}
432
-
433
-		$widgets = apply_filters(
434
-			'getpaid_widget_classes',
435
-			array(
436
-				'WPInv_Checkout_Widget',
437
-				'WPInv_History_Widget',
438
-				'WPInv_Receipt_Widget',
439
-				'WPInv_Subscriptions_Widget',
440
-				'WPInv_Buy_Item_Widget',
441
-				'WPInv_Messages_Widget',
442
-				'WPInv_GetPaid_Widget'
443
-			)
444
-		);
445
-
446
-		foreach ( $widgets as $widget ) {
447
-			register_widget( $widget );
448
-		}
421
+    /**
422
+     * Register widgets
423
+     *
424
+     */
425
+    public function register_widgets() {
426
+
427
+        // Currently, UX Builder does not work particulaly well with SuperDuper.
428
+        // So we disable our widgets when editing a page with UX Builder.
429
+        if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
430
+            return;
431
+        }
432
+
433
+        $widgets = apply_filters(
434
+            'getpaid_widget_classes',
435
+            array(
436
+                'WPInv_Checkout_Widget',
437
+                'WPInv_History_Widget',
438
+                'WPInv_Receipt_Widget',
439
+                'WPInv_Subscriptions_Widget',
440
+                'WPInv_Buy_Item_Widget',
441
+                'WPInv_Messages_Widget',
442
+                'WPInv_GetPaid_Widget'
443
+            )
444
+        );
445
+
446
+        foreach ( $widgets as $widget ) {
447
+            register_widget( $widget );
448
+        }
449 449
 		
450
-	}
450
+    }
451 451
 
452
-	/**
453
-	 * Upgrades the database.
454
-	 *
455
-	 * @since 2.0.2
456
-	 */
457
-	public function maybe_upgrade_database() {
452
+    /**
453
+     * Upgrades the database.
454
+     *
455
+     * @since 2.0.2
456
+     */
457
+    public function maybe_upgrade_database() {
458 458
 
459
-		$wpi_version = get_option( 'wpinv_version', 0 );
459
+        $wpi_version = get_option( 'wpinv_version', 0 );
460 460
 
461
-		if ( $wpi_version == WPINV_VERSION ) {
462
-			return;
463
-		}
461
+        if ( $wpi_version == WPINV_VERSION ) {
462
+            return;
463
+        }
464 464
 
465
-		$installer = new GetPaid_Installer();
465
+        $installer = new GetPaid_Installer();
466 466
 
467
-		if ( empty( $wpi_version ) ) {
468
-			return $installer->upgrade_db( 0 );
469
-		}
467
+        if ( empty( $wpi_version ) ) {
468
+            return $installer->upgrade_db( 0 );
469
+        }
470 470
 
471
-		$upgrades  = array(
472
-			'0.0.5' => '004',
473
-			'1.0.3' => '102',
474
-			'2.0.0' => '118',
475
-			'2.0.8' => '207',
476
-		);
471
+        $upgrades  = array(
472
+            '0.0.5' => '004',
473
+            '1.0.3' => '102',
474
+            '2.0.0' => '118',
475
+            '2.0.8' => '207',
476
+        );
477 477
 
478
-		foreach ( $upgrades as $key => $method ) {
478
+        foreach ( $upgrades as $key => $method ) {
479 479
 
480
-			if ( version_compare( $wpi_version, $key, '<' ) ) {
481
-				return $installer->upgrade_db( $method );
482
-			}
480
+            if ( version_compare( $wpi_version, $key, '<' ) ) {
481
+                return $installer->upgrade_db( $method );
482
+            }
483 483
 
484
-		}
484
+        }
485 485
 
486
-	}
486
+    }
487 487
 
488
-	/**
489
-	 * Flushes the permalinks if needed.
490
-	 *
491
-	 * @since 2.0.8
492
-	 */
493
-	public function maybe_flush_permalinks() {
488
+    /**
489
+     * Flushes the permalinks if needed.
490
+     *
491
+     * @since 2.0.8
492
+     */
493
+    public function maybe_flush_permalinks() {
494 494
 
495
-		$flush = get_option( 'wpinv_flush_permalinks', 0 );
495
+        $flush = get_option( 'wpinv_flush_permalinks', 0 );
496 496
 
497
-		if ( ! empty( $flush ) ) {
498
-			flush_rewrite_rules();
499
-			delete_option( 'wpinv_flush_permalinks' );
500
-		}
497
+        if ( ! empty( $flush ) ) {
498
+            flush_rewrite_rules();
499
+            delete_option( 'wpinv_flush_permalinks' );
500
+        }
501 501
 
502
-	}
502
+    }
503 503
 
504
-	/**
505
-	 * Remove our pages from yoast sitemaps.
506
-	 *
507
-	 * @since 1.0.19
508
-	 * @param int[] $excluded_posts_ids
509
-	 */
510
-	public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
504
+    /**
505
+     * Remove our pages from yoast sitemaps.
506
+     *
507
+     * @since 1.0.19
508
+     * @param int[] $excluded_posts_ids
509
+     */
510
+    public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
511 511
 
512
-		// Ensure that we have an array.
513
-		if ( ! is_array( $excluded_posts_ids ) ) {
514
-			$excluded_posts_ids = array();
515
-		}
512
+        // Ensure that we have an array.
513
+        if ( ! is_array( $excluded_posts_ids ) ) {
514
+            $excluded_posts_ids = array();
515
+        }
516 516
 
517
-		// Prepare our pages.
518
-		$our_pages = array();
517
+        // Prepare our pages.
518
+        $our_pages = array();
519 519
 
520
-		// Checkout page.
521
-		$our_pages[] = wpinv_get_option( 'checkout_page', false );
520
+        // Checkout page.
521
+        $our_pages[] = wpinv_get_option( 'checkout_page', false );
522 522
 
523
-		// Success page.
524
-		$our_pages[] = wpinv_get_option( 'success_page', false );
523
+        // Success page.
524
+        $our_pages[] = wpinv_get_option( 'success_page', false );
525 525
 
526
-		// Failure page.
527
-		$our_pages[] = wpinv_get_option( 'failure_page', false );
526
+        // Failure page.
527
+        $our_pages[] = wpinv_get_option( 'failure_page', false );
528 528
 
529
-		// History page.
530
-		$our_pages[] = wpinv_get_option( 'invoice_history_page', false );
529
+        // History page.
530
+        $our_pages[] = wpinv_get_option( 'invoice_history_page', false );
531 531
 
532
-		// Subscriptions page.
533
-		$our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
532
+        // Subscriptions page.
533
+        $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
534 534
 
535
-		$our_pages   = array_map( 'intval', array_filter( $our_pages ) );
535
+        $our_pages   = array_map( 'intval', array_filter( $our_pages ) );
536 536
 
537
-		$excluded_posts_ids = $excluded_posts_ids + $our_pages;
538
-		return array_unique( $excluded_posts_ids );
537
+        $excluded_posts_ids = $excluded_posts_ids + $our_pages;
538
+        return array_unique( $excluded_posts_ids );
539 539
 
540
-	}
540
+    }
541 541
 
542
-	/**
543
-	 * Displays additional footer code.
544
-	 * 
545
-	 * @since 2.0.0
546
-	 */
547
-	public function wp_footer() {
548
-		wpinv_get_template( 'frontend-footer.php' );
549
-	}
542
+    /**
543
+     * Displays additional footer code.
544
+     * 
545
+     * @since 2.0.0
546
+     */
547
+    public function wp_footer() {
548
+        wpinv_get_template( 'frontend-footer.php' );
549
+    }
550 550
 
551
-	/**
552
-	 * Displays additional header code.
553
-	 * 
554
-	 * @since 2.0.0
555
-	 */
556
-	public function wp_head() {
557
-		wpinv_get_template( 'frontend-head.php' );
558
-	}
551
+    /**
552
+     * Displays additional header code.
553
+     * 
554
+     * @since 2.0.0
555
+     */
556
+    public function wp_head() {
557
+        wpinv_get_template( 'frontend-head.php' );
558
+    }
559 559
 
560 560
 }
Please login to merge, or discard this patch.
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Main Invoicing class.
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param string $prop The prop to set.
57 57
 	 * @param mixed $value The value to retrieve.
58 58
 	 */
59
-	public function set( $prop, $value ) {
60
-		$this->data[ $prop ] = $value;
59
+	public function set($prop, $value) {
60
+		$this->data[$prop] = $value;
61 61
 	}
62 62
 
63 63
 	/**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	 * @param string $prop The prop to set.
67 67
 	 * @return mixed The value.
68 68
 	 */
69
-	public function get( $prop ) {
69
+	public function get($prop) {
70 70
 
71
-		if ( isset( $this->data[ $prop ] ) ) {
72
-			return $this->data[ $prop ];
71
+		if (isset($this->data[$prop])) {
72
+			return $this->data[$prop];
73 73
 		}
74 74
 
75 75
 		return null;
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
 	public function set_properties() {
82 82
 
83 83
 		// Sessions.
84
-		$this->set( 'session', new WPInv_Session_Handler() );
85
-		$GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
84
+		$this->set('session', new WPInv_Session_Handler());
85
+		$GLOBALS['wpi_session'] = $this->get('session'); // Backwards compatibility.
86 86
 		$GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
87 87
 
88 88
 		// Init other objects.
89
-		$this->set( 'session', new WPInv_Session_Handler() );
90
-		$this->set( 'notes', new WPInv_Notes() );
91
-		$this->set( 'api', new WPInv_API() );
92
-		$this->set( 'post_types', new GetPaid_Post_Types() );
93
-		$this->set( 'template', new GetPaid_Template() );
94
-		$this->set( 'admin', new GetPaid_Admin() );
95
-		$this->set( 'subscriptions', new WPInv_Subscriptions() );
96
-		$this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
97
-		$this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
98
-		$this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
99
-		$this->set( 'payment_forms', new GetPaid_Payment_Forms() );
100
-		$this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
89
+		$this->set('session', new WPInv_Session_Handler());
90
+		$this->set('notes', new WPInv_Notes());
91
+		$this->set('api', new WPInv_API());
92
+		$this->set('post_types', new GetPaid_Post_Types());
93
+		$this->set('template', new GetPaid_Template());
94
+		$this->set('admin', new GetPaid_Admin());
95
+		$this->set('subscriptions', new WPInv_Subscriptions());
96
+		$this->set('invoice_emails', new GetPaid_Invoice_Notification_Emails());
97
+		$this->set('subscription_emails', new GetPaid_Subscription_Notification_Emails());
98
+		$this->set('daily_maintenace', new GetPaid_Daily_Maintenance());
99
+		$this->set('payment_forms', new GetPaid_Payment_Forms());
100
+		$this->set('maxmind', new GetPaid_MaxMind_Geolocation());
101 101
 
102 102
 	}
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * Define plugin constants.
106 106
 	 */
107 107
 	public function define_constants() {
108
-		define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
109
-		define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
108
+		define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
109
+		define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
110 110
 		$this->version = WPINV_VERSION;
111 111
 	}
112 112
 
@@ -117,28 +117,28 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function init_hooks() {
119 119
 		/* Internationalize the text strings used. */
120
-		add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
120
+		add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
121 121
 
122 122
 		// Init the plugin after WordPress inits.
123
-		add_action( 'init', array( $this, 'init' ), 1 );
124
-		add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
125
-		add_action( 'init', array( $this, 'wpinv_actions' ) );
126
-		add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
123
+		add_action('init', array($this, 'init'), 1);
124
+		add_action('init', array($this, 'maybe_process_ipn'), 10);
125
+		add_action('init', array($this, 'wpinv_actions'));
126
+		add_action('init', array($this, 'maybe_do_authenticated_action'), 100);
127 127
 
128
-		if ( class_exists( 'BuddyPress' ) ) {
129
-			add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
128
+		if (class_exists('BuddyPress')) {
129
+			add_action('bp_include', array(&$this, 'bp_invoicing_init'));
130 130
 		}
131 131
 
132
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
133
-		add_action( 'wp_footer', array( $this, 'wp_footer' ) );
134
-		add_action( 'wp_head', array( $this, 'wp_head' ) );
135
-		add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
136
-		add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
137
-		add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
132
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 11);
133
+		add_action('wp_footer', array($this, 'wp_footer'));
134
+		add_action('wp_head', array($this, 'wp_head'));
135
+		add_action('widgets_init', array(&$this, 'register_widgets'));
136
+		add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids'));
137
+		add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
138 138
 
139 139
 		// Fires after registering actions.
140
-		do_action( 'wpinv_actions', $this );
141
-		do_action( 'getpaid_actions', $this );
140
+		do_action('wpinv_actions', $this);
141
+		do_action('getpaid_actions', $this);
142 142
 
143 143
 	}
144 144
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 		/* Internationalize the text strings used. */
147 147
 		$this->load_textdomain();
148 148
 
149
-		do_action( 'wpinv_loaded' );
149
+		do_action('wpinv_loaded');
150 150
 
151 151
 		// Fix oxygen page builder conflict
152
-		if ( function_exists( 'ct_css_output' ) ) {
152
+		if (function_exists('ct_css_output')) {
153 153
 			wpinv_oxygen_fix_conflict();
154 154
 		}
155 155
 	}
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @since 1.0
161 161
 	 */
162
-	public function load_textdomain( $locale = NULL ) {
163
-		if ( empty( $locale ) ) {
164
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
162
+	public function load_textdomain($locale = NULL) {
163
+		if (empty($locale)) {
164
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
165 165
 		}
166 166
 
167
-		$locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
167
+		$locale = apply_filters('plugin_locale', $locale, 'invoicing');
168 168
 
169
-		unload_textdomain( 'invoicing' );
170
-		load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
171
-		load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
169
+		unload_textdomain('invoicing');
170
+		load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
171
+		load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
172 172
 
173 173
 		/**
174 174
 		 * Define language constants.
175 175
 		 */
176
-		require_once( WPINV_PLUGIN_DIR . 'language.php' );
176
+		require_once(WPINV_PLUGIN_DIR . 'language.php');
177 177
 	}
178 178
 
179 179
 	/**
@@ -182,78 +182,78 @@  discard block
 block discarded – undo
182 182
 	public function includes() {
183 183
 
184 184
 		// Start with the settings.
185
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
185
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
186 186
 
187 187
 		// Packages/libraries.
188
-		require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
189
-		require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
188
+		require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
189
+		require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php');
190 190
 
191 191
 		// Load functions.
192
-		require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' );
193
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
194
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
195
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
196
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
197
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
198
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
199
-		require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' );
200
-		require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' );
201
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
202
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
203
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
204
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
205
-		require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' );
206
-		require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' );
192
+		require_once(WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php');
193
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
194
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
195
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
196
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
197
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
198
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
199
+		require_once(WPINV_PLUGIN_DIR . 'includes/invoice-functions.php');
200
+		require_once(WPINV_PLUGIN_DIR . 'includes/subscription-functions.php');
201
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
202
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
203
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
204
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
205
+		require_once(WPINV_PLUGIN_DIR . 'includes/user-functions.php');
206
+		require_once(WPINV_PLUGIN_DIR . 'includes/error-functions.php');
207 207
 
208 208
 		// Register autoloader.
209 209
 		try {
210
-			spl_autoload_register( array( $this, 'autoload' ), true );
211
-		} catch ( Exception $e ) {
212
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
210
+			spl_autoload_register(array($this, 'autoload'), true);
211
+		} catch (Exception $e) {
212
+			wpinv_error_log($e->getMessage(), '', __FILE__, 149, true);
213 213
 		}
214 214
 
215
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
216
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
217
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
218
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
219
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
220
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
221
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
222
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
223
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
224
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
225
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
226
-		require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
227
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
228
-		require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
229
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
230
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
231
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
232
-		require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
233
-		require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
234
-		require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
235
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
236
-
237
-		if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
215
+		require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
216
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
217
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
218
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
219
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
220
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
221
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
222
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
223
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
224
+		require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
225
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
226
+		require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
227
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
228
+		require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
229
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
230
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
231
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
232
+		require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
233
+		require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
234
+		require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php');
235
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
236
+
237
+		if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
238 238
 			GetPaid_Post_Types_Admin::init();
239 239
 
240
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
241
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
242
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
243
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
244
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
245
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
240
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
241
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
242
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
243
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
244
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
245
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php');
246 246
 			// load the user class only on the users.php page
247 247
 			global $pagenow;
248
-			if($pagenow=='users.php'){
248
+			if ($pagenow == 'users.php') {
249 249
 				new WPInv_Admin_Users();
250 250
 			}
251 251
 		}
252 252
 
253 253
 		// Register cli commands
254
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
255
-			require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
256
-			WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
254
+		if (defined('WP_CLI') && WP_CLI) {
255
+			require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
256
+			WP_CLI::add_command('invoicing', 'WPInv_CLI');
257 257
 		}
258 258
 
259 259
 	}
@@ -266,21 +266,21 @@  discard block
 block discarded – undo
266 266
 	 * @since       1.0.19
267 267
 	 * @return      void
268 268
 	 */
269
-	public function autoload( $class_name ) {
269
+	public function autoload($class_name) {
270 270
 
271 271
 		// Normalize the class name...
272
-		$class_name  = strtolower( $class_name );
272
+		$class_name = strtolower($class_name);
273 273
 
274 274
 		// ... and make sure it is our class.
275
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
275
+		if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) {
276 276
 			return;
277 277
 		}
278 278
 
279 279
 		// Next, prepare the file name from the class.
280
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
280
+		$file_name = 'class-' . str_replace('_', '-', $class_name) . '.php';
281 281
 
282 282
 		// Base path of the classes.
283
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
283
+		$plugin_path = untrailingslashit(WPINV_PLUGIN_DIR);
284 284
 
285 285
 		// And an array of possible locations in order of importance.
286 286
 		$locations = array(
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 			"$plugin_path/includes/admin/meta-boxes",
296 296
 		);
297 297
 
298
-		foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
298
+		foreach (apply_filters('getpaid_autoload_locations', $locations) as $location) {
299 299
 
300
-			if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
301
-				include trailingslashit( $location ) . $file_name;
300
+			if (file_exists(trailingslashit($location) . $file_name)) {
301
+				include trailingslashit($location) . $file_name;
302 302
 				break;
303 303
 			}
304 304
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	public function init() {
313 313
 
314 314
 		// Fires before getpaid inits.
315
-		do_action( 'before_getpaid_init', $this );
315
+		do_action('before_getpaid_init', $this);
316 316
 
317 317
 		// Maybe upgrade.
318 318
 		$this->maybe_upgrade_database();
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 			)
330 330
 		);
331 331
 
332
-		foreach ( $gateways as $id => $class ) {
333
-			$this->gateways[ $id ] = new $class();
332
+		foreach ($gateways as $id => $class) {
333
+			$this->gateways[$id] = new $class();
334 334
 		}
335 335
 
336 336
 		// Fires after getpaid inits.
337
-		do_action( 'getpaid_init', $this );
337
+		do_action('getpaid_init', $this);
338 338
 
339 339
 	}
340 340
 
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 	public function maybe_process_ipn() {
345 345
 
346 346
 		// Ensure that this is an IPN request.
347
-		if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
347
+		if (empty($_GET['wpi-listener']) || 'IPN' !== $_GET['wpi-listener'] || empty($_GET['wpi-gateway'])) {
348 348
 			return;
349 349
 		}
350 350
 
351
-		$gateway = wpinv_clean( $_GET['wpi-gateway'] );
351
+		$gateway = wpinv_clean($_GET['wpi-gateway']);
352 352
 
353
-		do_action( 'wpinv_verify_payment_ipn', $gateway );
354
-		do_action( "wpinv_verify_{$gateway}_ipn" );
353
+		do_action('wpinv_verify_payment_ipn', $gateway);
354
+		do_action("wpinv_verify_{$gateway}_ipn");
355 355
 		exit;
356 356
 
357 357
 	}
@@ -359,27 +359,27 @@  discard block
 block discarded – undo
359 359
 	public function enqueue_scripts() {
360 360
 
361 361
 		// Fires before adding scripts.
362
-		do_action( 'getpaid_enqueue_scripts' );
362
+		do_action('getpaid_enqueue_scripts');
363 363
 
364 364
 		$localize                         = array();
365
-		$localize['ajax_url']             = admin_url( 'admin-ajax.php' );
366
-		$localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
367
-		$localize['txtComplete']          = __( 'Continue', 'invoicing' );
365
+		$localize['ajax_url']             = admin_url('admin-ajax.php');
366
+		$localize['nonce']                = wp_create_nonce('wpinv-nonce');
367
+		$localize['txtComplete']          = __('Continue', 'invoicing');
368 368
 		$localize['UseTaxes']             = wpinv_use_taxes();
369
-		$localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
370
-		$localize['loading']              = __( 'Loading...', 'invoicing' );
371
-		$localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
369
+		$localize['formNonce']            = wp_create_nonce('getpaid_form_nonce');
370
+		$localize['loading']              = __('Loading...', 'invoicing');
371
+		$localize['connectionError']      = __('Could not establish a connection to the server.', 'invoicing');
372 372
 
373
-		$localize = apply_filters( 'wpinv_front_js_localize', $localize );
373
+		$localize = apply_filters('wpinv_front_js_localize', $localize);
374 374
 
375
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
376
-		wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ),  $version, true );
377
-		wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
375
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
376
+		wp_enqueue_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('jquery'), $version, true);
377
+		wp_localize_script('wpinv-front-script', 'WPInv', $localize);
378 378
 	}
379 379
 
380 380
 	public function wpinv_actions() {
381
-		if ( isset( $_REQUEST['wpi_action'] ) ) {
382
-			do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
381
+		if (isset($_REQUEST['wpi_action'])) {
382
+			do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
383 383
 		}
384 384
 	}
385 385
 
@@ -391,31 +391,31 @@  discard block
 block discarded – undo
391 391
      */
392 392
     public function maybe_do_authenticated_action() {
393 393
 
394
-		if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
394
+		if (isset($_REQUEST['getpaid-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
395 395
 
396
-			$key  = sanitize_key( $_REQUEST['getpaid-action'] );
397
-			$data = wp_unslash( $_REQUEST );
398
-			if ( is_user_logged_in() ) {
399
-				do_action( "getpaid_authenticated_action_$key", $data );
396
+			$key  = sanitize_key($_REQUEST['getpaid-action']);
397
+			$data = wp_unslash($_REQUEST);
398
+			if (is_user_logged_in()) {
399
+				do_action("getpaid_authenticated_action_$key", $data);
400 400
 			}
401 401
 
402
-			do_action( "getpaid_unauthenticated_action_$key", $data );
402
+			do_action("getpaid_unauthenticated_action_$key", $data);
403 403
 
404 404
 		}
405 405
 
406 406
     }
407 407
 
408
-	public function pre_get_posts( $wp_query ) {
408
+	public function pre_get_posts($wp_query) {
409 409
 
410
-		if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
411
-			$wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
410
+		if (!is_admin() && !empty($wp_query->query_vars['post_type']) && getpaid_is_invoice_post_type($wp_query->query_vars['post_type']) && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
411
+			$wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses(false, false, $wp_query->query_vars['post_type']));
412 412
 		}
413 413
 
414 414
 		return $wp_query;
415 415
 	}
416 416
 
417 417
 	public function bp_invoicing_init() {
418
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
418
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
419 419
 	}
420 420
 
421 421
 	/**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
 		// Currently, UX Builder does not work particulaly well with SuperDuper.
428 428
 		// So we disable our widgets when editing a page with UX Builder.
429
-		if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
429
+		if (function_exists('ux_builder_is_active') && ux_builder_is_active()) {
430 430
 			return;
431 431
 		}
432 432
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 			)
444 444
 		);
445 445
 
446
-		foreach ( $widgets as $widget ) {
447
-			register_widget( $widget );
446
+		foreach ($widgets as $widget) {
447
+			register_widget($widget);
448 448
 		}
449 449
 		
450 450
 	}
@@ -456,29 +456,29 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	public function maybe_upgrade_database() {
458 458
 
459
-		$wpi_version = get_option( 'wpinv_version', 0 );
459
+		$wpi_version = get_option('wpinv_version', 0);
460 460
 
461
-		if ( $wpi_version == WPINV_VERSION ) {
461
+		if ($wpi_version == WPINV_VERSION) {
462 462
 			return;
463 463
 		}
464 464
 
465 465
 		$installer = new GetPaid_Installer();
466 466
 
467
-		if ( empty( $wpi_version ) ) {
468
-			return $installer->upgrade_db( 0 );
467
+		if (empty($wpi_version)) {
468
+			return $installer->upgrade_db(0);
469 469
 		}
470 470
 
471
-		$upgrades  = array(
471
+		$upgrades = array(
472 472
 			'0.0.5' => '004',
473 473
 			'1.0.3' => '102',
474 474
 			'2.0.0' => '118',
475 475
 			'2.0.8' => '207',
476 476
 		);
477 477
 
478
-		foreach ( $upgrades as $key => $method ) {
478
+		foreach ($upgrades as $key => $method) {
479 479
 
480
-			if ( version_compare( $wpi_version, $key, '<' ) ) {
481
-				return $installer->upgrade_db( $method );
480
+			if (version_compare($wpi_version, $key, '<')) {
481
+				return $installer->upgrade_db($method);
482 482
 			}
483 483
 
484 484
 		}
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	 */
493 493
 	public function maybe_flush_permalinks() {
494 494
 
495
-		$flush = get_option( 'wpinv_flush_permalinks', 0 );
495
+		$flush = get_option('wpinv_flush_permalinks', 0);
496 496
 
497
-		if ( ! empty( $flush ) ) {
497
+		if (!empty($flush)) {
498 498
 			flush_rewrite_rules();
499
-			delete_option( 'wpinv_flush_permalinks' );
499
+			delete_option('wpinv_flush_permalinks');
500 500
 		}
501 501
 
502 502
 	}
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 	 * @since 1.0.19
508 508
 	 * @param int[] $excluded_posts_ids
509 509
 	 */
510
-	public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
510
+	public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) {
511 511
 
512 512
 		// Ensure that we have an array.
513
-		if ( ! is_array( $excluded_posts_ids ) ) {
513
+		if (!is_array($excluded_posts_ids)) {
514 514
 			$excluded_posts_ids = array();
515 515
 		}
516 516
 
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
 		$our_pages = array();
519 519
 
520 520
 		// Checkout page.
521
-		$our_pages[] = wpinv_get_option( 'checkout_page', false );
521
+		$our_pages[] = wpinv_get_option('checkout_page', false);
522 522
 
523 523
 		// Success page.
524
-		$our_pages[] = wpinv_get_option( 'success_page', false );
524
+		$our_pages[] = wpinv_get_option('success_page', false);
525 525
 
526 526
 		// Failure page.
527
-		$our_pages[] = wpinv_get_option( 'failure_page', false );
527
+		$our_pages[] = wpinv_get_option('failure_page', false);
528 528
 
529 529
 		// History page.
530
-		$our_pages[] = wpinv_get_option( 'invoice_history_page', false );
530
+		$our_pages[] = wpinv_get_option('invoice_history_page', false);
531 531
 
532 532
 		// Subscriptions page.
533
-		$our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
533
+		$our_pages[] = wpinv_get_option('invoice_subscription_page', false);
534 534
 
535
-		$our_pages   = array_map( 'intval', array_filter( $our_pages ) );
535
+		$our_pages   = array_map('intval', array_filter($our_pages));
536 536
 
537 537
 		$excluded_posts_ids = $excluded_posts_ids + $our_pages;
538
-		return array_unique( $excluded_posts_ids );
538
+		return array_unique($excluded_posts_ids);
539 539
 
540 540
 	}
541 541
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @since 2.0.0
546 546
 	 */
547 547
 	public function wp_footer() {
548
-		wpinv_get_template( 'frontend-footer.php' );
548
+		wpinv_get_template('frontend-footer.php');
549 549
 	}
550 550
 
551 551
 	/**
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 * @since 2.0.0
555 555
 	 */
556 556
 	public function wp_head() {
557
-		wpinv_get_template( 'frontend-head.php' );
557
+		wpinv_get_template('frontend-head.php');
558 558
 	}
559 559
 
560 560
 }
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -24,64 +24,64 @@  discard block
 block discarded – undo
24 24
 
25 25
 				<?php
26 26
 
27
-					// Fires before printing a line item column.
28
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
27
+                    // Fires before printing a line item column.
28
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29 29
 
30
-					// Item name.
31
-					if ( 'name' == $key ) {
30
+                    // Item name.
31
+                    if ( 'name' == $key ) {
32 32
 
33
-						// Display the name.
34
-						echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
33
+                        // Display the name.
34
+                        echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
35 35
 
36
-						// And an optional description.
36
+                        // And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39 39
                         if ( ! empty( $description ) ) {
40 40
                             $description = wp_kses_post( $description );
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42
-						}
42
+                        }
43 43
 
44
-						// Price help text.
44
+                        // Price help text.
45 45
                         $description = getpaid_item_recurring_price_help_text( $item, $currency );
46 46
                         if ( $description ) {
47 47
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
48
-						}
48
+                        }
49 49
 
50
-					}
50
+                    }
51 51
 
52
-					// Item price.
53
-					if ( 'price' == $key ) {
52
+                    // Item price.
53
+                    if ( 'price' == $key ) {
54 54
 
55
-						// Set the currency position.
56
-						$position = wpinv_currency_position();
55
+                        // Set the currency position.
56
+                        $position = wpinv_currency_position();
57 57
 
58
-						if ( $position == 'left_space' ) {
59
-							$position = 'left';
60
-						}
58
+                        if ( $position == 'left_space' ) {
59
+                            $position = 'left';
60
+                        }
61 61
 
62
-						if ( $position == 'right_space' ) {
63
-							$position = 'right';
64
-						}
62
+                        if ( $position == 'right_space' ) {
63
+                            $position = 'right';
64
+                        }
65 65
 
66
-						if ( $item->user_can_set_their_price() ) {
67
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
68
-							$minimum          = (float) $item->get_minimum_price();
69
-							$validate_minimum = '';
70
-							$class            = '';
71
-							$data_minimum     = '';
66
+                        if ( $item->user_can_set_their_price() ) {
67
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
68
+                            $minimum          = (float) $item->get_minimum_price();
69
+                            $validate_minimum = '';
70
+                            $class            = '';
71
+                            $data_minimum     = '';
72 72
 
73
-							if ( $minimum > 0 ) {
74
-								$validate_minimum = sprintf(
75
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
-									sanitize_text_field( wpinv_price( $minimum, $currency ) )
77
-								);
73
+                            if ( $minimum > 0 ) {
74
+                                $validate_minimum = sprintf(
75
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
+                                    sanitize_text_field( wpinv_price( $minimum, $currency ) )
77
+                                );
78 78
 
79
-								$class = 'getpaid-validate-minimum-amount';
79
+                                $class = 'getpaid-validate-minimum-amount';
80 80
 
81
-								$data_minimum     = "data-minimum-amount='$minimum'";
82
-							}
81
+                                $data_minimum     = "data-minimum-amount='$minimum'";
82
+                            }
83 83
 
84
-							?>
84
+                            ?>
85 85
 								<div class="input-group input-group-sm">
86 86
 									<?php if( 'left' == $position ) : ?>
87 87
 										<div class="input-group-prepend">
@@ -105,37 +105,37 @@  discard block
 block discarded – undo
105 105
 								</div>
106 106
 
107 107
 							<?php
108
-						} else {
109
-							echo wpinv_price( $item->get_price(), $currency );
110
-							?>
108
+                        } else {
109
+                            echo wpinv_price( $item->get_price(), $currency );
110
+                            ?>
111 111
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
112 112
 							<?php
113
-						}
114
-					}
113
+                        }
114
+                    }
115 115
 
116
-					// Item quantity.
117
-					if ( 'quantity' == $key ) {
116
+                    // Item quantity.
117
+                    if ( 'quantity' == $key ) {
118 118
 
119
-						if ( $item->allows_quantities() ) {
120
-							?>
119
+                        if ( $item->allows_quantities() ) {
120
+                            ?>
121 121
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required>
122 122
 							<?php
123
-						} else {
124
-							echo (float) $item->get_quantity();
125
-							echo '&nbsp;&nbsp;&nbsp;';
126
-							?>
123
+                        } else {
124
+                            echo (float) $item->get_quantity();
125
+                            echo '&nbsp;&nbsp;&nbsp;';
126
+                            ?>
127 127
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
128 128
 							<?php
129
-						}
130
-					}
129
+                        }
130
+                    }
131 131
 
132
-					// Item sub total.
133
-					if ( 'subtotal' == $key ) {
134
-						echo wpinv_price( $item->get_sub_total(), $currency );
135
-					}
132
+                    // Item sub total.
133
+                    if ( 'subtotal' == $key ) {
134
+                        echo wpinv_price( $item->get_sub_total(), $currency );
135
+                    }
136 136
 
137
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
138
-				?>
137
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
138
+                ?>
139 139
 
140 140
 			</div>
141 141
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,116 +7,116 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
12
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
13 13
 
14 14
 $currency = $form->get_currency();
15 15
 
16 16
 ?>
17
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
17
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
18 18
 
19 19
 	<div class="form-row needs-validation">
20 20
 
21
-		<?php foreach ( array_keys( $columns ) as $key ) : ?>
21
+		<?php foreach (array_keys($columns) as $key) : ?>
22 22
 
23
-			<div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>">
23
+			<div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $item->get_id(); ?>">
24 24
 
25 25
 				<?php
26 26
 
27 27
 					// Fires before printing a line item column.
28
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
28
+					do_action("getpaid_form_cart_item_before_$key", $item, $form);
29 29
 
30 30
 					// Item name.
31
-					if ( 'name' == $key ) {
31
+					if ('name' == $key) {
32 32
 
33 33
 						// Display the name.
34
-						echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
34
+						echo '<div class="mb-1">' . sanitize_text_field($item->get_name()) . '</div>';
35 35
 
36 36
 						// And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39
-                        if ( ! empty( $description ) ) {
40
-                            $description = wp_kses_post( $description );
39
+                        if (!empty($description)) {
40
+                            $description = wp_kses_post($description);
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42 42
 						}
43 43
 
44 44
 						// Price help text.
45
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
46
-                        if ( $description ) {
45
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
46
+                        if ($description) {
47 47
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
48 48
 						}
49 49
 
50 50
 					}
51 51
 
52 52
 					// Item price.
53
-					if ( 'price' == $key ) {
53
+					if ('price' == $key) {
54 54
 
55 55
 						// Set the currency position.
56 56
 						$position = wpinv_currency_position();
57 57
 
58
-						if ( $position == 'left_space' ) {
58
+						if ($position == 'left_space') {
59 59
 							$position = 'left';
60 60
 						}
61 61
 
62
-						if ( $position == 'right_space' ) {
62
+						if ($position == 'right_space') {
63 63
 							$position = 'right';
64 64
 						}
65 65
 
66
-						if ( $item->user_can_set_their_price() ) {
67
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
66
+						if ($item->user_can_set_their_price()) {
67
+							$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
68 68
 							$minimum          = (float) $item->get_minimum_price();
69 69
 							$validate_minimum = '';
70 70
 							$class            = '';
71 71
 							$data_minimum     = '';
72 72
 
73
-							if ( $minimum > 0 ) {
73
+							if ($minimum > 0) {
74 74
 								$validate_minimum = sprintf(
75
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
-									sanitize_text_field( wpinv_price( $minimum, $currency ) )
75
+									esc_attr__('The minimum allowed amount is %s', 'invoicing'),
76
+									sanitize_text_field(wpinv_price($minimum, $currency))
77 77
 								);
78 78
 
79 79
 								$class = 'getpaid-validate-minimum-amount';
80 80
 
81
-								$data_minimum     = "data-minimum-amount='$minimum'";
81
+								$data_minimum = "data-minimum-amount='$minimum'";
82 82
 							}
83 83
 
84 84
 							?>
85 85
 								<div class="input-group input-group-sm">
86
-									<?php if( 'left' == $position ) : ?>
86
+									<?php if ('left' == $position) : ?>
87 87
 										<div class="input-group-prepend">
88
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
88
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
89 89
 										</div>
90 90
 									<?php endif; ?>
91 91
 
92
-									<input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
92
+									<input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
93 93
 
94
-									<?php if ( ! empty( $validate_minimum ) ) : ?>
94
+									<?php if (!empty($validate_minimum)) : ?>
95 95
 										<div class="invalid-tooltip">
96 96
 											<?php echo $validate_minimum; ?>
97 97
 										</div>
98 98
 									<?php endif; ?>
99 99
 
100
-									<?php if( 'left' != $position ) : ?>
100
+									<?php if ('left' != $position) : ?>
101 101
 										<div class="input-group-append">
102
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
102
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
103 103
 										</div>
104 104
 									<?php endif; ?>
105 105
 								</div>
106 106
 
107 107
 							<?php
108 108
 						} else {
109
-							echo wpinv_price( $item->get_price(), $currency );
109
+							echo wpinv_price($item->get_price(), $currency);
110 110
 							?>
111
-								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
111
+								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
112 112
 							<?php
113 113
 						}
114 114
 					}
115 115
 
116 116
 					// Item quantity.
117
-					if ( 'quantity' == $key ) {
117
+					if ('quantity' == $key) {
118 118
 
119
-						if ( $item->allows_quantities() ) {
119
+						if ($item->allows_quantities()) {
120 120
 							?>
121 121
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required>
122 122
 							<?php
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 					}
131 131
 
132 132
 					// Item sub total.
133
-					if ( 'subtotal' == $key ) {
134
-						echo wpinv_price( $item->get_sub_total(), $currency );
133
+					if ('subtotal' == $key) {
134
+						echo wpinv_price($item->get_sub_total(), $currency);
135 135
 					}
136 136
 
137
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
137
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
138 138
 				?>
139 139
 
140 140
 			</div>
@@ -145,4 +145,4 @@  discard block
 block discarded – undo
145 145
 
146 146
 </div>
147 147
 <?php
148
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
148
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
templates/invoice/invoice-meta.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$class = ! is_singular( 'page' ) ? 'px-1' : '';
12
+$class = !is_singular('page') ? 'px-1' : '';
13 13
 ?>
14 14
 
15
-        <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?>
15
+        <?php do_action('getpaid_before_invoice_meta', $invoice); ?>
16 16
         <div class="getpaid-invoice-meta-data">
17 17
 
18
-            <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?>
18
+            <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?>
19 19
             <table class="table table-bordered">
20 20
                 <tbody>
21 21
 
22
-                    <?php do_action( "getpaid_before_invoice_meta_rows", $invoice ); ?>
23
-                    <?php foreach ( $meta as $key => $data ) : ?>
22
+                    <?php do_action("getpaid_before_invoice_meta_rows", $invoice); ?>
23
+                    <?php foreach ($meta as $key => $data) : ?>
24 24
 
25
-                        <?php if ( ! empty( $data['value'] ) ) : ?>
25
+                        <?php if (!empty($data['value'])) : ?>
26 26
 
27
-                            <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?>
27
+                            <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?>
28 28
 
29
-                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>">
29
+                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>">
30 30
 
31 31
                                 <th class="<?php echo $class; ?> font-weight-bold">
32
-                                    <?php echo sanitize_text_field( $data['label'] ); ?>
32
+                                    <?php echo sanitize_text_field($data['label']); ?>
33 33
                                 </th>
34 34
 
35 35
                                 <td class="<?php echo $class; ?> <?php echo $key == 'invoice_total' ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break w-75">
36
-                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span>
36
+                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span>
37 37
                                 </td>
38 38
 
39 39
                             </tr>
40 40
 
41
-                            <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?>
41
+                            <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?>
42 42
 
43 43
                         <?php endif; ?>
44 44
                     
45 45
                     <?php endforeach; ?>
46
-                    <?php do_action( "getpaid_after_invoice_meta_rows", $invoice ); ?>
46
+                    <?php do_action("getpaid_after_invoice_meta_rows", $invoice); ?>
47 47
 
48 48
                 </tbody>
49 49
             </table>
50
-            <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?>
50
+            <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?>
51 51
 
52 52
 
53 53
         </div>
54
-        <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?>
54
+        <?php do_action('getpaid_after_invoice_meta', $invoice); ?>
55 55
 
56 56
 <?php
Please login to merge, or discard this patch.
templates/frontend-head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
Please login to merge, or discard this patch.
templates/frontend-footer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		<div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;">
17 17
 			<div class="modal-content">
18 18
 				<div class="modal-body">
19
-					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__( 'Close', 'invoicing' ); ?>">
19
+					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__('Close', 'invoicing'); ?>">
20 20
 						<i class="fa fa-times" aria-hidden="true"></i>
21 21
 					</button>
22 22
 					<div class="modal-body-wrapper"></div>
Please login to merge, or discard this patch.