Passed
Push — master ( e33f3a...6fa934 )
by Stiofan
04:49
created
includes/payments/class-getpaid-payment-form-submission-taxes.php 2 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -12,210 +12,210 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Payment_Form_Submission_Taxes {
14 14
 
15
-	/**
16
-	 * Submission taxes.
17
-	 * @var array
18
-	 */
19
-	public $taxes = array();
15
+    /**
16
+     * Submission taxes.
17
+     * @var array
18
+     */
19
+    public $taxes = array();
20
+
21
+    /**
22
+     * Class constructor
23
+     *
24
+     * @param GetPaid_Payment_Form_Submission $submission
25
+     */
26
+    public function __construct( $submission ) {
27
+
28
+        // Validate VAT number.
29
+        $this->validate_vat( $submission );
30
+
31
+        foreach ( $submission->get_items() as $item ) {
32
+            $this->process_item_tax( $item, $submission );
33
+        }
34
+
35
+        // Process any existing invoice taxes.
36
+        if ( $submission->has_invoice() ) {
37
+            $this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes );
38
+        }
39
+
40
+    }
41
+
42
+    /**
43
+     * Maybe process tax.
44
+     *
45
+     * @since 1.0.19
46
+     * @param GetPaid_Form_Item $item
47
+     * @param GetPaid_Payment_Form_Submission $submission
48
+     */
49
+    public function process_item_tax( $item, $submission ) {
50
+
51
+        $rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
52
+        $rates    = getpaid_filter_item_tax_rates( $item, $rates );
53
+        $taxes    = getpaid_calculate_item_taxes( $item->get_sub_total(), $rates );
54
+        $r_taxes  = getpaid_calculate_item_taxes( $item->get_recurring_sub_total(), $rates );
55
+
56
+        foreach ( $taxes as $name => $amount ) {
57
+            $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
58
+            $tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
59
+
60
+            if ( ! isset( $this->taxes[ $name ] ) ) {
61
+                $this->taxes[ $name ] = $tax;
62
+                continue;
63
+            }
64
+
65
+            $this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
66
+            $this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
67
+
68
+        }
69
+
70
+    }
20 71
 
21 72
     /**
22
-	 * Class constructor
23
-	 *
24
-	 * @param GetPaid_Payment_Form_Submission $submission
25
-	 */
26
-	public function __construct( $submission ) {
27
-
28
-		// Validate VAT number.
29
-		$this->validate_vat( $submission );
30
-
31
-		foreach ( $submission->get_items() as $item ) {
32
-			$this->process_item_tax( $item, $submission );
33
-		}
34
-
35
-		// Process any existing invoice taxes.
36
-		if ( $submission->has_invoice() ) {
37
-			$this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes );
38
-		}
39
-
40
-	}
41
-
42
-	/**
43
-	 * Maybe process tax.
44
-	 *
45
-	 * @since 1.0.19
46
-	 * @param GetPaid_Form_Item $item
47
-	 * @param GetPaid_Payment_Form_Submission $submission
48
-	 */
49
-	public function process_item_tax( $item, $submission ) {
50
-
51
-		$rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
52
-		$rates    = getpaid_filter_item_tax_rates( $item, $rates );
53
-		$taxes    = getpaid_calculate_item_taxes( $item->get_sub_total(), $rates );
54
-		$r_taxes  = getpaid_calculate_item_taxes( $item->get_recurring_sub_total(), $rates );
55
-
56
-		foreach ( $taxes as $name => $amount ) {
57
-			$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
58
-			$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
59
-
60
-			if ( ! isset( $this->taxes[ $name ] ) ) {
61
-				$this->taxes[ $name ] = $tax;
62
-				continue;
63
-			}
64
-
65
-			$this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
66
-			$this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
67
-
68
-		}
69
-
70
-	}
71
-
72
-	/**
73
-	 * Checks if the submission has a digital item.
74
-	 *
75
-	 * @param GetPaid_Payment_Form_Submission $submission
76
-	 * @since 1.0.19
77
-	 * @return bool
78
-	 */
79
-	public function has_digital_item( $submission ) {
80
-
81
-		foreach ( $submission->get_items() as $item ) {
82
-
83
-			if ( 'digital' == $item->get_vat_rule() ) {
84
-				return true;
85
-			}
86
-
87
-		}
88
-
89
-		return false;
90
-	}
91
-
92
-	/**
93
-	 * Checks if this is an eu store.
94
-	 *
95
-	 * @since 1.0.19
96
-	 * @return bool
97
-	 */
98
-	public function is_eu_store() {
99
-		return $this->is_eu_country( wpinv_get_default_country() );
100
-	}
101
-
102
-	/**
103
-	 * Checks if this is an eu country.
104
-	 *
105
-	 * @param string $country
106
-	 * @since 1.0.19
107
-	 * @return bool
108
-	 */
109
-	public function is_eu_country( $country ) {
110
-		return getpaid_is_eu_state( $country ) || getpaid_is_gst_country( $country );
111
-	}
112
-
113
-	/**
114
-	 * Checks if this is an eu purchase.
115
-	 *
116
-	 * @param string $customer_country
117
-	 * @since 1.0.19
118
-	 * @return bool
119
-	 */
120
-	public function is_eu_transaction( $customer_country ) {
121
-		return $this->is_eu_country( $customer_country ) && $this->is_eu_store();
122
-	}
123
-
124
-	/**
125
-	 * Retrieves the vat number.
126
-	 *
127
-	 * @param GetPaid_Payment_Form_Submission $submission
128
-	 * @since 1.0.19
129
-	 * @return string
130
-	 */
131
-	public function get_vat_number( $submission ) {
132
-
133
-		// Retrieve from the posted number.
134
-		$vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
135
-		if ( ! empty( $vat_number ) ) {
136
-			return wpinv_clean( $vat_number );
137
-		}
138
-
139
-		// Retrieve from the invoice.
140
-		return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
141
-	}
142
-
143
-	/**
144
-	 * Retrieves the company.
145
-	 *
146
-	 * @param GetPaid_Payment_Form_Submission $submission
147
-	 * @since 1.0.19
148
-	 * @return string
149
-	 */
150
-	public function get_company( $submission ) {
151
-
152
-		// Retrieve from the posted data.
153
-		$company = $submission->get_field( 'wpinv_company', 'billing' );
154
-		if ( ! empty( $company ) ) {
155
-			return wpinv_clean( $company );
156
-		}
157
-
158
-		// Retrieve from the invoice.
159
-		return $submission->has_invoice() ? $submission->get_invoice()->get_company() : '';
160
-	}
161
-
162
-	/**
163
-	 * Checks if we require a VAT number.
164
-	 *
165
-	 * @param bool $ip_in_eu Whether the customer IP is from the EU
166
-	 * @param bool $country_in_eu Whether the customer country is from the EU
167
-	 * @since 1.0.19
168
-	 * @return string
169
-	 */
170
-	public function requires_vat( $ip_in_eu, $country_in_eu ) {
171
-
172
-		$prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
173
-		$prevent_b2c = ! empty( $prevent_b2c );
174
-		$is_eu       = $ip_in_eu || $country_in_eu;
175
-
176
-		return $prevent_b2c && $is_eu;
177
-	}
178
-
179
-	/**
180
-	 * Validate VAT data.
181
-	 *
182
-	 * @param GetPaid_Payment_Form_Submission $submission
183
-	 * @since 1.0.19
184
-	 */
185
-	public function validate_vat( $submission ) {
186
-
187
-		$in_eu = $this->is_eu_transaction( $submission->country );
188
-
189
-		// Abort if we are not validating vat numbers.
190
-		if ( ! $in_eu ) {
73
+     * Checks if the submission has a digital item.
74
+     *
75
+     * @param GetPaid_Payment_Form_Submission $submission
76
+     * @since 1.0.19
77
+     * @return bool
78
+     */
79
+    public function has_digital_item( $submission ) {
80
+
81
+        foreach ( $submission->get_items() as $item ) {
82
+
83
+            if ( 'digital' == $item->get_vat_rule() ) {
84
+                return true;
85
+            }
86
+
87
+        }
88
+
89
+        return false;
90
+    }
91
+
92
+    /**
93
+     * Checks if this is an eu store.
94
+     *
95
+     * @since 1.0.19
96
+     * @return bool
97
+     */
98
+    public function is_eu_store() {
99
+        return $this->is_eu_country( wpinv_get_default_country() );
100
+    }
101
+
102
+    /**
103
+     * Checks if this is an eu country.
104
+     *
105
+     * @param string $country
106
+     * @since 1.0.19
107
+     * @return bool
108
+     */
109
+    public function is_eu_country( $country ) {
110
+        return getpaid_is_eu_state( $country ) || getpaid_is_gst_country( $country );
111
+    }
112
+
113
+    /**
114
+     * Checks if this is an eu purchase.
115
+     *
116
+     * @param string $customer_country
117
+     * @since 1.0.19
118
+     * @return bool
119
+     */
120
+    public function is_eu_transaction( $customer_country ) {
121
+        return $this->is_eu_country( $customer_country ) && $this->is_eu_store();
122
+    }
123
+
124
+    /**
125
+     * Retrieves the vat number.
126
+     *
127
+     * @param GetPaid_Payment_Form_Submission $submission
128
+     * @since 1.0.19
129
+     * @return string
130
+     */
131
+    public function get_vat_number( $submission ) {
132
+
133
+        // Retrieve from the posted number.
134
+        $vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
135
+        if ( ! empty( $vat_number ) ) {
136
+            return wpinv_clean( $vat_number );
137
+        }
138
+
139
+        // Retrieve from the invoice.
140
+        return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
141
+    }
142
+
143
+    /**
144
+     * Retrieves the company.
145
+     *
146
+     * @param GetPaid_Payment_Form_Submission $submission
147
+     * @since 1.0.19
148
+     * @return string
149
+     */
150
+    public function get_company( $submission ) {
151
+
152
+        // Retrieve from the posted data.
153
+        $company = $submission->get_field( 'wpinv_company', 'billing' );
154
+        if ( ! empty( $company ) ) {
155
+            return wpinv_clean( $company );
156
+        }
157
+
158
+        // Retrieve from the invoice.
159
+        return $submission->has_invoice() ? $submission->get_invoice()->get_company() : '';
160
+    }
161
+
162
+    /**
163
+     * Checks if we require a VAT number.
164
+     *
165
+     * @param bool $ip_in_eu Whether the customer IP is from the EU
166
+     * @param bool $country_in_eu Whether the customer country is from the EU
167
+     * @since 1.0.19
168
+     * @return string
169
+     */
170
+    public function requires_vat( $ip_in_eu, $country_in_eu ) {
171
+
172
+        $prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
173
+        $prevent_b2c = ! empty( $prevent_b2c );
174
+        $is_eu       = $ip_in_eu || $country_in_eu;
175
+
176
+        return $prevent_b2c && $is_eu;
177
+    }
178
+
179
+    /**
180
+     * Validate VAT data.
181
+     *
182
+     * @param GetPaid_Payment_Form_Submission $submission
183
+     * @since 1.0.19
184
+     */
185
+    public function validate_vat( $submission ) {
186
+
187
+        $in_eu = $this->is_eu_transaction( $submission->country );
188
+
189
+        // Abort if we are not validating vat numbers.
190
+        if ( ! $in_eu ) {
191 191
             return;
192
-		}
192
+        }
193 193
 
194
-		// Prepare variables.
195
-		$vat_number  = $this->get_vat_number( $submission );
196
-		$ip_country  = getpaid_get_ip_country();
194
+        // Prepare variables.
195
+        $vat_number  = $this->get_vat_number( $submission );
196
+        $ip_country  = getpaid_get_ip_country();
197 197
         $is_eu       = $this->is_eu_country( $submission->country );
198 198
         $is_ip_eu    = $this->is_eu_country( $ip_country );
199 199
 
200
-		// If we're preventing business to consumer purchases,
201
-		if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
200
+        // If we're preventing business to consumer purchases,
201
+        if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
202 202
 
203
-			// Ensure that a vat number has been specified.
204
-			throw new Exception(
205
-				__( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' )
206
-			);
203
+            // Ensure that a vat number has been specified.
204
+            throw new Exception(
205
+                __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' )
206
+            );
207 207
 
208
-		}
208
+        }
209 209
 
210
-		// Abort if we are not validating vat (vat number should exist, user should be in eu and business too).
211
-		if ( ! $in_eu ) {
210
+        // Abort if we are not validating vat (vat number should exist, user should be in eu and business too).
211
+        if ( ! $in_eu ) {
212 212
             return;
213
-		}
213
+        }
214 214
 
215
-		if ( ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
216
-			throw new Exception( __( 'Your VAT number is invalid', 'invoicing' ) );
217
-		}
215
+        if ( ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
216
+            throw new Exception( __( 'Your VAT number is invalid', 'invoicing' ) );
217
+        }
218 218
 
219
-	}
219
+    }
220 220
 
221 221
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 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
  * Payment form submission taxes class
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param GetPaid_Payment_Form_Submission $submission
25 25
 	 */
26
-	public function __construct( $submission ) {
26
+	public function __construct($submission) {
27 27
 
28 28
 		// Validate VAT number.
29
-		$this->validate_vat( $submission );
29
+		$this->validate_vat($submission);
30 30
 
31
-		foreach ( $submission->get_items() as $item ) {
32
-			$this->process_item_tax( $item, $submission );
31
+		foreach ($submission->get_items() as $item) {
32
+			$this->process_item_tax($item, $submission);
33 33
 		}
34 34
 
35 35
 		// Process any existing invoice taxes.
36
-		if ( $submission->has_invoice() ) {
37
-			$this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes );
36
+		if ($submission->has_invoice()) {
37
+			$this->taxes = array_replace($submission->get_invoice()->get_taxes(), $this->taxes);
38 38
 		}
39 39
 
40 40
 	}
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 * @param GetPaid_Form_Item $item
47 47
 	 * @param GetPaid_Payment_Form_Submission $submission
48 48
 	 */
49
-	public function process_item_tax( $item, $submission ) {
49
+	public function process_item_tax($item, $submission) {
50 50
 
51
-		$rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
52
-		$rates    = getpaid_filter_item_tax_rates( $item, $rates );
53
-		$taxes    = getpaid_calculate_item_taxes( $item->get_sub_total(), $rates );
54
-		$r_taxes  = getpaid_calculate_item_taxes( $item->get_recurring_sub_total(), $rates );
51
+		$rates    = getpaid_get_item_tax_rates($item, $submission->country, $submission->state);
52
+		$rates    = getpaid_filter_item_tax_rates($item, $rates);
53
+		$taxes    = getpaid_calculate_item_taxes($item->get_sub_total(), $rates);
54
+		$r_taxes  = getpaid_calculate_item_taxes($item->get_recurring_sub_total(), $rates);
55 55
 
56
-		foreach ( $taxes as $name => $amount ) {
57
-			$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
58
-			$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
56
+		foreach ($taxes as $name => $amount) {
57
+			$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
58
+			$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
59 59
 
60
-			if ( ! isset( $this->taxes[ $name ] ) ) {
61
-				$this->taxes[ $name ] = $tax;
60
+			if (!isset($this->taxes[$name])) {
61
+				$this->taxes[$name] = $tax;
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
66
-			$this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
65
+			$this->taxes[$name]['initial_tax']   += $tax['initial_tax'];
66
+			$this->taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
67 67
 
68 68
 		}
69 69
 
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	 * @since 1.0.19
77 77
 	 * @return bool
78 78
 	 */
79
-	public function has_digital_item( $submission ) {
79
+	public function has_digital_item($submission) {
80 80
 
81
-		foreach ( $submission->get_items() as $item ) {
81
+		foreach ($submission->get_items() as $item) {
82 82
 
83
-			if ( 'digital' == $item->get_vat_rule() ) {
83
+			if ('digital' == $item->get_vat_rule()) {
84 84
 				return true;
85 85
 			}
86 86
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return bool
97 97
 	 */
98 98
 	public function is_eu_store() {
99
-		return $this->is_eu_country( wpinv_get_default_country() );
99
+		return $this->is_eu_country(wpinv_get_default_country());
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @since 1.0.19
107 107
 	 * @return bool
108 108
 	 */
109
-	public function is_eu_country( $country ) {
110
-		return getpaid_is_eu_state( $country ) || getpaid_is_gst_country( $country );
109
+	public function is_eu_country($country) {
110
+		return getpaid_is_eu_state($country) || getpaid_is_gst_country($country);
111 111
 	}
112 112
 
113 113
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 * @since 1.0.19
118 118
 	 * @return bool
119 119
 	 */
120
-	public function is_eu_transaction( $customer_country ) {
121
-		return $this->is_eu_country( $customer_country ) && $this->is_eu_store();
120
+	public function is_eu_transaction($customer_country) {
121
+		return $this->is_eu_country($customer_country) && $this->is_eu_store();
122 122
 	}
123 123
 
124 124
 	/**
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 	 * @since 1.0.19
129 129
 	 * @return string
130 130
 	 */
131
-	public function get_vat_number( $submission ) {
131
+	public function get_vat_number($submission) {
132 132
 
133 133
 		// Retrieve from the posted number.
134
-		$vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
135
-		if ( ! empty( $vat_number ) ) {
136
-			return wpinv_clean( $vat_number );
134
+		$vat_number = $submission->get_field('wpinv_vat_number', 'billing');
135
+		if (!empty($vat_number)) {
136
+			return wpinv_clean($vat_number);
137 137
 		}
138 138
 
139 139
 		// Retrieve from the invoice.
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 * @since 1.0.19
148 148
 	 * @return string
149 149
 	 */
150
-	public function get_company( $submission ) {
150
+	public function get_company($submission) {
151 151
 
152 152
 		// Retrieve from the posted data.
153
-		$company = $submission->get_field( 'wpinv_company', 'billing' );
154
-		if ( ! empty( $company ) ) {
155
-			return wpinv_clean( $company );
153
+		$company = $submission->get_field('wpinv_company', 'billing');
154
+		if (!empty($company)) {
155
+			return wpinv_clean($company);
156 156
 		}
157 157
 
158 158
 		// Retrieve from the invoice.
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 * @since 1.0.19
168 168
 	 * @return string
169 169
 	 */
170
-	public function requires_vat( $ip_in_eu, $country_in_eu ) {
170
+	public function requires_vat($ip_in_eu, $country_in_eu) {
171 171
 
172
-		$prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
173
-		$prevent_b2c = ! empty( $prevent_b2c );
172
+		$prevent_b2c = wpinv_get_option('vat_prevent_b2c_purchase');
173
+		$prevent_b2c = !empty($prevent_b2c);
174 174
 		$is_eu       = $ip_in_eu || $country_in_eu;
175 175
 
176 176
 		return $prevent_b2c && $is_eu;
@@ -182,38 +182,38 @@  discard block
 block discarded – undo
182 182
 	 * @param GetPaid_Payment_Form_Submission $submission
183 183
 	 * @since 1.0.19
184 184
 	 */
185
-	public function validate_vat( $submission ) {
185
+	public function validate_vat($submission) {
186 186
 
187
-		$in_eu = $this->is_eu_transaction( $submission->country );
187
+		$in_eu = $this->is_eu_transaction($submission->country);
188 188
 
189 189
 		// Abort if we are not validating vat numbers.
190
-		if ( ! $in_eu ) {
190
+		if (!$in_eu) {
191 191
             return;
192 192
 		}
193 193
 
194 194
 		// Prepare variables.
195
-		$vat_number  = $this->get_vat_number( $submission );
195
+		$vat_number  = $this->get_vat_number($submission);
196 196
 		$ip_country  = getpaid_get_ip_country();
197
-        $is_eu       = $this->is_eu_country( $submission->country );
198
-        $is_ip_eu    = $this->is_eu_country( $ip_country );
197
+        $is_eu       = $this->is_eu_country($submission->country);
198
+        $is_ip_eu    = $this->is_eu_country($ip_country);
199 199
 
200 200
 		// If we're preventing business to consumer purchases,
201
-		if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
201
+		if ($this->requires_vat($is_ip_eu, $is_eu) && empty($vat_number)) {
202 202
 
203 203
 			// Ensure that a vat number has been specified.
204 204
 			throw new Exception(
205
-				__( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' )
205
+				__('Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing')
206 206
 			);
207 207
 
208 208
 		}
209 209
 
210 210
 		// Abort if we are not validating vat (vat number should exist, user should be in eu and business too).
211
-		if ( ! $in_eu ) {
211
+		if (!$in_eu) {
212 212
             return;
213 213
 		}
214 214
 
215
-		if ( ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
216
-			throw new Exception( __( 'Your VAT number is invalid', 'invoicing' ) );
215
+		if (!wpinv_validate_vat_number($vat_number, $submission->country)) {
216
+			throw new Exception(__('Your VAT number is invalid', 'invoicing'));
217 217
 		}
218 218
 
219 219
 	}
Please login to merge, or discard this patch.
includes/data/eu-states.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
 defined( 'ABSPATH' ) || exit;
10 10
 
11 11
 return array(
12
-	'AT',
13
-	'BE',
14
-	'BG',
15
-	'HR',
16
-	'CY',
17
-	'CZ',
18
-	'DK',
19
-	'EE',
20
-	'FI',
21
-	'FR',
22
-	'DE',
23
-	'GB',
24
-	'GR',
25
-	'HU',
26
-	'IE',
27
-	'IT',
28
-	'LV',
29
-	'LT',
30
-	'LU',
31
-	'MT',
32
-	'NL',
33
-	'PL',
34
-	'PT',
35
-	'RO',
36
-	'SK',
37
-	'SI',
38
-	'ES',
39
-	'SE'
12
+    'AT',
13
+    'BE',
14
+    'BG',
15
+    'HR',
16
+    'CY',
17
+    'CZ',
18
+    'DK',
19
+    'EE',
20
+    'FI',
21
+    'FR',
22
+    'DE',
23
+    'GB',
24
+    'GR',
25
+    'HU',
26
+    'IE',
27
+    'IT',
28
+    'LV',
29
+    'LT',
30
+    'LU',
31
+    'MT',
32
+    'NL',
33
+    'PL',
34
+    'PT',
35
+    'RO',
36
+    'SK',
37
+    'SI',
38
+    'ES',
39
+    'SE'
40 40
 );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version 1.0.19
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
 	'AT',
Please login to merge, or discard this patch.
includes/data/item-schema.php 2 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -13,233 +13,233 @@
 block discarded – undo
13 13
 
14 14
 return array(
15 15
 
16
-	'id'              => array(
17
-		'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
-		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
20
-		'readonly'    => true,
21
-	),
22
-
23
-	'parent_id'       => array(
24
-		'description' => __( 'Parent item ID.', 'invoicing' ),
25
-		'type'        => 'integer',
26
-		'context'     => array( 'view', 'edit', 'embed' ),
27
-		'default'     => 0,
28
-	),
29
-
30
-	'status'          => array(
31
-		'description' => __( 'A named status for the item.', 'invoicing' ),
32
-		'type'        => 'string',
33
-		'enum'        => array( 'draft', 'pending', 'publish' ),
34
-		'context'     => array( 'view', 'edit', 'embed' ),
35
-		'default'     => 'draft',
36
-	),
37
-
38
-	'version'         => array(
39
-		'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
-		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit' ),
42
-		'readonly'    => true,
43
-	),
44
-
45
-	'date_created'    => array(
46
-		'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
-		'type'        => 'string',
48
-		'context'     => array( 'view', 'edit', 'embed' ),
49
-	),
50
-
51
-	'date_created_gmt'    => array(
52
-		'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
-		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
55
-		'readonly'    => true,
56
-	),
57
-
58
-	'date_modified'   => array(
59
-		'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
-		'type'        => 'string',
61
-		'context'     => array( 'view', 'edit', 'embed' ),
62
-		'readonly'    => true,
63
-	),
64
-
65
-	'date_modified_gmt'    => array(
66
-		'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
-		'type'        => 'string',
68
-		'context'     => array( 'view', 'edit', 'embed' ),
69
-		'readonly'    => true,
70
-	),
71
-
72
-	'name'			  => array(
73
-		'description' => __( "The item's name.", 'invoicing' ),
74
-		'type'        => 'string',
75
-		'context'     => array( 'view', 'edit', 'embed' ),
76
-		'required'    => true,
77
-	),
78
-
79
-	'description'     => array(
80
-		'description' => __( "The item's description.", 'invoicing' ),
81
-		'type'        => 'string',
82
-		'context'     => array( 'view', 'edit', 'embed' ),
83
-	),
84
-
85
-	'owner'           => array(
86
-		'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
-		'type'        => 'integer',
88
-		'context'     => array( 'view', 'edit', 'embed' ),
89
-	),
90
-
91
-	'price'           => array(
92
-		'description' => __( 'The price of the item.', 'invoicing' ),
93
-		'type'        => 'number',
94
-		'context'     => array( 'view', 'edit', 'embed' ),
95
-		'required'    => true,
96
-	),
97
-
98
-	'the_price'       => array(
99
-		'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
-		'type'        => 'string',
101
-		'context'     => array( 'view', 'edit', 'embed' ),
102
-		'readonly'    => true,
103
-	),
104
-
105
-	'type'       => array(
106
-		'description' => __( 'The item type.', 'invoicing' ),
107
-		'type'        => 'string',
108
-		'enum'        => wpinv_item_types(),
109
-		'default'     => 'custom',
110
-		'context'     => array( 'view', 'edit', 'embed' ),
111
-	),
112
-
113
-	'vat_rule'       => array(
114
-		'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
-		'type'        => 'string',
116
-		'enum'        => array_keys( getpaid_get_tax_rules() ),
117
-		'context'     => array( 'view', 'edit', 'embed' ),
118
-	),
119
-
120
-	'vat_class'       => array(
121
-		'description' => __( 'VAT class for the item.', 'invoicing' ),
122
-		'type'        => 'string',
123
-		'context'     => array( 'view', 'edit', 'embed' ),
124
-		'enum'        => array_keys( getpaid_get_tax_classes() ),
125
-	),
126
-
127
-	'custom_id'       => array(
128
-		'description' => __( 'Custom id for the item.', 'invoicing' ),
129
-		'type'        => 'string',
130
-		'context'     => array( 'view', 'edit', 'embed' ),
131
-	),
16
+    'id'              => array(
17
+        'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
+        'type'        => 'integer',
19
+        'context'     => array( 'view', 'edit', 'embed' ),
20
+        'readonly'    => true,
21
+    ),
22
+
23
+    'parent_id'       => array(
24
+        'description' => __( 'Parent item ID.', 'invoicing' ),
25
+        'type'        => 'integer',
26
+        'context'     => array( 'view', 'edit', 'embed' ),
27
+        'default'     => 0,
28
+    ),
29
+
30
+    'status'          => array(
31
+        'description' => __( 'A named status for the item.', 'invoicing' ),
32
+        'type'        => 'string',
33
+        'enum'        => array( 'draft', 'pending', 'publish' ),
34
+        'context'     => array( 'view', 'edit', 'embed' ),
35
+        'default'     => 'draft',
36
+    ),
37
+
38
+    'version'         => array(
39
+        'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
+        'type'        => 'string',
41
+        'context'     => array( 'view', 'edit' ),
42
+        'readonly'    => true,
43
+    ),
44
+
45
+    'date_created'    => array(
46
+        'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
+        'type'        => 'string',
48
+        'context'     => array( 'view', 'edit', 'embed' ),
49
+    ),
50
+
51
+    'date_created_gmt'    => array(
52
+        'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
+        'type'        => 'string',
54
+        'context'     => array( 'view', 'edit', 'embed' ),
55
+        'readonly'    => true,
56
+    ),
57
+
58
+    'date_modified'   => array(
59
+        'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
+        'type'        => 'string',
61
+        'context'     => array( 'view', 'edit', 'embed' ),
62
+        'readonly'    => true,
63
+    ),
64
+
65
+    'date_modified_gmt'    => array(
66
+        'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
+        'type'        => 'string',
68
+        'context'     => array( 'view', 'edit', 'embed' ),
69
+        'readonly'    => true,
70
+    ),
71
+
72
+    'name'			  => array(
73
+        'description' => __( "The item's name.", 'invoicing' ),
74
+        'type'        => 'string',
75
+        'context'     => array( 'view', 'edit', 'embed' ),
76
+        'required'    => true,
77
+    ),
78
+
79
+    'description'     => array(
80
+        'description' => __( "The item's description.", 'invoicing' ),
81
+        'type'        => 'string',
82
+        'context'     => array( 'view', 'edit', 'embed' ),
83
+    ),
84
+
85
+    'owner'           => array(
86
+        'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
+        'type'        => 'integer',
88
+        'context'     => array( 'view', 'edit', 'embed' ),
89
+    ),
90
+
91
+    'price'           => array(
92
+        'description' => __( 'The price of the item.', 'invoicing' ),
93
+        'type'        => 'number',
94
+        'context'     => array( 'view', 'edit', 'embed' ),
95
+        'required'    => true,
96
+    ),
97
+
98
+    'the_price'       => array(
99
+        'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
+        'type'        => 'string',
101
+        'context'     => array( 'view', 'edit', 'embed' ),
102
+        'readonly'    => true,
103
+    ),
104
+
105
+    'type'       => array(
106
+        'description' => __( 'The item type.', 'invoicing' ),
107
+        'type'        => 'string',
108
+        'enum'        => wpinv_item_types(),
109
+        'default'     => 'custom',
110
+        'context'     => array( 'view', 'edit', 'embed' ),
111
+    ),
112
+
113
+    'vat_rule'       => array(
114
+        'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
+        'type'        => 'string',
116
+        'enum'        => array_keys( getpaid_get_tax_rules() ),
117
+        'context'     => array( 'view', 'edit', 'embed' ),
118
+    ),
119
+
120
+    'vat_class'       => array(
121
+        'description' => __( 'VAT class for the item.', 'invoicing' ),
122
+        'type'        => 'string',
123
+        'context'     => array( 'view', 'edit', 'embed' ),
124
+        'enum'        => array_keys( getpaid_get_tax_classes() ),
125
+    ),
126
+
127
+    'custom_id'       => array(
128
+        'description' => __( 'Custom id for the item.', 'invoicing' ),
129
+        'type'        => 'string',
130
+        'context'     => array( 'view', 'edit', 'embed' ),
131
+    ),
132 132
 	
133
-	'custom_name'       => array(
134
-		'description' => __( 'Custom name for the item.', 'invoicing' ),
135
-		'type'        => 'string',
136
-		'context'     => array( 'view', 'edit', 'embed' ),
137
-	),
138
-
139
-	'custom_singular_name'       => array(
140
-		'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
-		'type'        => 'string',
142
-		'context'     => array( 'view', 'edit', 'embed' ),
143
-	),
144
-
145
-	'is_dynamic_pricing'     => array(
146
-		'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
-		'type'        => 'integer',
148
-		'enum'        => array( 0, 1 ),
149
-		'context'     => array( 'view', 'edit', 'embed' ),
150
-	),
151
-
152
-	'minimum_price'   => array(
153
-		'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
-		'type'        => 'number',
155
-		'context'     => array( 'view', 'edit', 'embed' ),
156
-	),
157
-
158
-	'is_recurring'        => array(
159
-		'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
-		'type'        => 'integer',
161
-		'enum'        => array( 0, 1 ),
162
-		'context'     => array( 'view', 'edit', 'embed' ),
163
-	),
164
-
165
-	'initial_price'   => array(
166
-		'description' => __( 'The initial price of the item.', 'invoicing' ),
167
-		'type'        => 'number',
168
-		'context'     => array( 'view', 'edit', 'embed' ),
169
-		'readonly'    => true,
170
-	),
171
-
172
-	'the_initial_price'       => array(
173
-		'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
-		'type'        => 'string',
175
-		'context'     => array( 'view', 'edit', 'embed' ),
176
-		'readonly'    => true,
177
-	),
178
-
179
-	'recurring_price' => array(
180
-		'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
-		'type'        => 'number',
182
-		'context'     => array( 'view', 'edit', 'embed' ),
183
-		'readonly'    => true,
184
-	),
185
-
186
-	'the_recurring_price'       => array(
187
-		'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
-		'type'        => 'string',
189
-		'context'     => array( 'view', 'edit', 'embed' ),
190
-		'readonly'    => true,
191
-	),
192
-
193
-	'recurring_period'        => array(
194
-		'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
-		'type'        => 'string',
196
-		'context'     => array( 'view', 'edit', 'embed' ),
197
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
-	),
199
-
200
-	'recurring_interval'        => array(
201
-		'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
-		'type'        => 'integer',
203
-		'context'     => array( 'view', 'edit', 'embed' ),
204
-	),
205
-
206
-	'recurring_limit' => array(
207
-		'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
-		'type'        => 'integer',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
210
-	),
211
-
212
-	'is_free_trial'   => array(
213
-		'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
-		'type'        => 'integer',
215
-		'enum'        => array( 0, 1 ),
216
-		'context'     => array( 'view', 'edit', 'embed' ),
217
-	),
218
-
219
-	'trial_period'    => array(
220
-		'description' => __( 'The trial period.', 'invoicing' ),
221
-		'type'        => 'string',
222
-		'context'     => array( 'view', 'edit', 'embed' ),
223
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
-	),
225
-
226
-	'trial_interval'  => array(
227
-		'description' => __( 'The trial interval.', 'invoicing' ),
228
-		'type'        => 'integer',
229
-		'context'     => array( 'view', 'edit', 'embed' ),
230
-	),
231
-
232
-	'first_renewal_date'       => array(
233
-		'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
-		'type'        => 'string',
235
-		'context'     => array( 'view', 'edit', 'embed' ),
236
-		'readonly'    => true,
237
-	),
238
-
239
-	'edit_url'        => array(
240
-		'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
-		'type'        => 'string',
242
-		'context'     => array( 'view', 'edit', 'embed' ),
243
-		'readonly'    => true,
244
-	),
133
+    'custom_name'       => array(
134
+        'description' => __( 'Custom name for the item.', 'invoicing' ),
135
+        'type'        => 'string',
136
+        'context'     => array( 'view', 'edit', 'embed' ),
137
+    ),
138
+
139
+    'custom_singular_name'       => array(
140
+        'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
+        'type'        => 'string',
142
+        'context'     => array( 'view', 'edit', 'embed' ),
143
+    ),
144
+
145
+    'is_dynamic_pricing'     => array(
146
+        'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
+        'type'        => 'integer',
148
+        'enum'        => array( 0, 1 ),
149
+        'context'     => array( 'view', 'edit', 'embed' ),
150
+    ),
151
+
152
+    'minimum_price'   => array(
153
+        'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
+        'type'        => 'number',
155
+        'context'     => array( 'view', 'edit', 'embed' ),
156
+    ),
157
+
158
+    'is_recurring'        => array(
159
+        'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
+        'type'        => 'integer',
161
+        'enum'        => array( 0, 1 ),
162
+        'context'     => array( 'view', 'edit', 'embed' ),
163
+    ),
164
+
165
+    'initial_price'   => array(
166
+        'description' => __( 'The initial price of the item.', 'invoicing' ),
167
+        'type'        => 'number',
168
+        'context'     => array( 'view', 'edit', 'embed' ),
169
+        'readonly'    => true,
170
+    ),
171
+
172
+    'the_initial_price'       => array(
173
+        'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
+        'type'        => 'string',
175
+        'context'     => array( 'view', 'edit', 'embed' ),
176
+        'readonly'    => true,
177
+    ),
178
+
179
+    'recurring_price' => array(
180
+        'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
+        'type'        => 'number',
182
+        'context'     => array( 'view', 'edit', 'embed' ),
183
+        'readonly'    => true,
184
+    ),
185
+
186
+    'the_recurring_price'       => array(
187
+        'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
+        'type'        => 'string',
189
+        'context'     => array( 'view', 'edit', 'embed' ),
190
+        'readonly'    => true,
191
+    ),
192
+
193
+    'recurring_period'        => array(
194
+        'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
+        'type'        => 'string',
196
+        'context'     => array( 'view', 'edit', 'embed' ),
197
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
+    ),
199
+
200
+    'recurring_interval'        => array(
201
+        'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
+        'type'        => 'integer',
203
+        'context'     => array( 'view', 'edit', 'embed' ),
204
+    ),
205
+
206
+    'recurring_limit' => array(
207
+        'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
+        'type'        => 'integer',
209
+        'context'     => array( 'view', 'edit', 'embed' ),
210
+    ),
211
+
212
+    'is_free_trial'   => array(
213
+        'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
+        'type'        => 'integer',
215
+        'enum'        => array( 0, 1 ),
216
+        'context'     => array( 'view', 'edit', 'embed' ),
217
+    ),
218
+
219
+    'trial_period'    => array(
220
+        'description' => __( 'The trial period.', 'invoicing' ),
221
+        'type'        => 'string',
222
+        'context'     => array( 'view', 'edit', 'embed' ),
223
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
+    ),
225
+
226
+    'trial_interval'  => array(
227
+        'description' => __( 'The trial interval.', 'invoicing' ),
228
+        'type'        => 'integer',
229
+        'context'     => array( 'view', 'edit', 'embed' ),
230
+    ),
231
+
232
+    'first_renewal_date'       => array(
233
+        'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
+        'type'        => 'string',
235
+        'context'     => array( 'view', 'edit', 'embed' ),
236
+        'readonly'    => true,
237
+    ),
238
+
239
+    'edit_url'        => array(
240
+        'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
+        'type'        => 'string',
242
+        'context'     => array( 'view', 'edit', 'embed' ),
243
+        'readonly'    => true,
244
+    ),
245 245
 );
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -9,237 +9,237 @@
 block discarded – undo
9 9
  * @version 1.0.19
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 return array(
15 15
 
16 16
 	'id'              => array(
17
-		'description' => __( 'Unique identifier for the item.', 'invoicing' ),
17
+		'description' => __('Unique identifier for the item.', 'invoicing'),
18 18
 		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
19
+		'context'     => array('view', 'edit', 'embed'),
20 20
 		'readonly'    => true,
21 21
 	),
22 22
 
23 23
 	'parent_id'       => array(
24
-		'description' => __( 'Parent item ID.', 'invoicing' ),
24
+		'description' => __('Parent item ID.', 'invoicing'),
25 25
 		'type'        => 'integer',
26
-		'context'     => array( 'view', 'edit', 'embed' ),
26
+		'context'     => array('view', 'edit', 'embed'),
27 27
 		'default'     => 0,
28 28
 	),
29 29
 
30 30
 	'status'          => array(
31
-		'description' => __( 'A named status for the item.', 'invoicing' ),
31
+		'description' => __('A named status for the item.', 'invoicing'),
32 32
 		'type'        => 'string',
33
-		'enum'        => array( 'draft', 'pending', 'publish' ),
34
-		'context'     => array( 'view', 'edit', 'embed' ),
33
+		'enum'        => array('draft', 'pending', 'publish'),
34
+		'context'     => array('view', 'edit', 'embed'),
35 35
 		'default'     => 'draft',
36 36
 	),
37 37
 
38 38
 	'version'         => array(
39
-		'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
39
+		'description' => __('Plugin version when the item was created.', 'invoicing'),
40 40
 		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit' ),
41
+		'context'     => array('view', 'edit'),
42 42
 		'readonly'    => true,
43 43
 	),
44 44
 
45 45
 	'date_created'    => array(
46
-		'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
46
+		'description' => __("The date the item was created, in the site's timezone.", 'invoicing'),
47 47
 		'type'        => 'string',
48
-		'context'     => array( 'view', 'edit', 'embed' ),
48
+		'context'     => array('view', 'edit', 'embed'),
49 49
 	),
50 50
 
51 51
 	'date_created_gmt'    => array(
52
-		'description' => __( 'The GMT date the item was created.', 'invoicing' ),
52
+		'description' => __('The GMT date the item was created.', 'invoicing'),
53 53
 		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
54
+		'context'     => array('view', 'edit', 'embed'),
55 55
 		'readonly'    => true,
56 56
 	),
57 57
 
58 58
 	'date_modified'   => array(
59
-		'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
59
+		'description' => __("The date the item was last modified, in the site's timezone.", 'invoicing'),
60 60
 		'type'        => 'string',
61
-		'context'     => array( 'view', 'edit', 'embed' ),
61
+		'context'     => array('view', 'edit', 'embed'),
62 62
 		'readonly'    => true,
63 63
 	),
64 64
 
65 65
 	'date_modified_gmt'    => array(
66
-		'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
66
+		'description' => __('The GMT date the item was last modified.', 'invoicing'),
67 67
 		'type'        => 'string',
68
-		'context'     => array( 'view', 'edit', 'embed' ),
68
+		'context'     => array('view', 'edit', 'embed'),
69 69
 		'readonly'    => true,
70 70
 	),
71 71
 
72 72
 	'name'			  => array(
73
-		'description' => __( "The item's name.", 'invoicing' ),
73
+		'description' => __("The item's name.", 'invoicing'),
74 74
 		'type'        => 'string',
75
-		'context'     => array( 'view', 'edit', 'embed' ),
75
+		'context'     => array('view', 'edit', 'embed'),
76 76
 		'required'    => true,
77 77
 	),
78 78
 
79 79
 	'description'     => array(
80
-		'description' => __( "The item's description.", 'invoicing' ),
80
+		'description' => __("The item's description.", 'invoicing'),
81 81
 		'type'        => 'string',
82
-		'context'     => array( 'view', 'edit', 'embed' ),
82
+		'context'     => array('view', 'edit', 'embed'),
83 83
 	),
84 84
 
85 85
 	'owner'           => array(
86
-		'description' => __( 'The owner of the item (user id).', 'invoicing' ),
86
+		'description' => __('The owner of the item (user id).', 'invoicing'),
87 87
 		'type'        => 'integer',
88
-		'context'     => array( 'view', 'edit', 'embed' ),
88
+		'context'     => array('view', 'edit', 'embed'),
89 89
 	),
90 90
 
91 91
 	'price'           => array(
92
-		'description' => __( 'The price of the item.', 'invoicing' ),
92
+		'description' => __('The price of the item.', 'invoicing'),
93 93
 		'type'        => 'number',
94
-		'context'     => array( 'view', 'edit', 'embed' ),
94
+		'context'     => array('view', 'edit', 'embed'),
95 95
 		'required'    => true,
96 96
 	),
97 97
 
98 98
 	'the_price'       => array(
99
-		'description' => __( 'The formatted price of the item.', 'invoicing' ),
99
+		'description' => __('The formatted price of the item.', 'invoicing'),
100 100
 		'type'        => 'string',
101
-		'context'     => array( 'view', 'edit', 'embed' ),
101
+		'context'     => array('view', 'edit', 'embed'),
102 102
 		'readonly'    => true,
103 103
 	),
104 104
 
105 105
 	'type'       => array(
106
-		'description' => __( 'The item type.', 'invoicing' ),
106
+		'description' => __('The item type.', 'invoicing'),
107 107
 		'type'        => 'string',
108 108
 		'enum'        => wpinv_item_types(),
109 109
 		'default'     => 'custom',
110
-		'context'     => array( 'view', 'edit', 'embed' ),
110
+		'context'     => array('view', 'edit', 'embed'),
111 111
 	),
112 112
 
113 113
 	'vat_rule'       => array(
114
-		'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
114
+		'description' => __('VAT rule applied to the item.', 'invoicing'),
115 115
 		'type'        => 'string',
116
-		'enum'        => array_keys( getpaid_get_tax_rules() ),
117
-		'context'     => array( 'view', 'edit', 'embed' ),
116
+		'enum'        => array_keys(getpaid_get_tax_rules()),
117
+		'context'     => array('view', 'edit', 'embed'),
118 118
 	),
119 119
 
120 120
 	'vat_class'       => array(
121
-		'description' => __( 'VAT class for the item.', 'invoicing' ),
121
+		'description' => __('VAT class for the item.', 'invoicing'),
122 122
 		'type'        => 'string',
123
-		'context'     => array( 'view', 'edit', 'embed' ),
124
-		'enum'        => array_keys( getpaid_get_tax_classes() ),
123
+		'context'     => array('view', 'edit', 'embed'),
124
+		'enum'        => array_keys(getpaid_get_tax_classes()),
125 125
 	),
126 126
 
127 127
 	'custom_id'       => array(
128
-		'description' => __( 'Custom id for the item.', 'invoicing' ),
128
+		'description' => __('Custom id for the item.', 'invoicing'),
129 129
 		'type'        => 'string',
130
-		'context'     => array( 'view', 'edit', 'embed' ),
130
+		'context'     => array('view', 'edit', 'embed'),
131 131
 	),
132 132
 	
133 133
 	'custom_name'       => array(
134
-		'description' => __( 'Custom name for the item.', 'invoicing' ),
134
+		'description' => __('Custom name for the item.', 'invoicing'),
135 135
 		'type'        => 'string',
136
-		'context'     => array( 'view', 'edit', 'embed' ),
136
+		'context'     => array('view', 'edit', 'embed'),
137 137
 	),
138 138
 
139 139
 	'custom_singular_name'       => array(
140
-		'description' => __( 'Custom singular name for the item.', 'invoicing' ),
140
+		'description' => __('Custom singular name for the item.', 'invoicing'),
141 141
 		'type'        => 'string',
142
-		'context'     => array( 'view', 'edit', 'embed' ),
142
+		'context'     => array('view', 'edit', 'embed'),
143 143
 	),
144 144
 
145 145
 	'is_dynamic_pricing'     => array(
146
-		'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
146
+		'description' => __('Whether or not customers can enter their own prices when checking out.', 'invoicing'),
147 147
 		'type'        => 'integer',
148
-		'enum'        => array( 0, 1 ),
149
-		'context'     => array( 'view', 'edit', 'embed' ),
148
+		'enum'        => array(0, 1),
149
+		'context'     => array('view', 'edit', 'embed'),
150 150
 	),
151 151
 
152 152
 	'minimum_price'   => array(
153
-		'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
153
+		'description' => __('For dynamic prices, this is the minimum price that a user can set.', 'invoicing'),
154 154
 		'type'        => 'number',
155
-		'context'     => array( 'view', 'edit', 'embed' ),
155
+		'context'     => array('view', 'edit', 'embed'),
156 156
 	),
157 157
 
158 158
 	'is_recurring'        => array(
159
-		'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
159
+		'description' => __('Whether or not this is a subscription item.', 'invoicing'),
160 160
 		'type'        => 'integer',
161
-		'enum'        => array( 0, 1 ),
162
-		'context'     => array( 'view', 'edit', 'embed' ),
161
+		'enum'        => array(0, 1),
162
+		'context'     => array('view', 'edit', 'embed'),
163 163
 	),
164 164
 
165 165
 	'initial_price'   => array(
166
-		'description' => __( 'The initial price of the item.', 'invoicing' ),
166
+		'description' => __('The initial price of the item.', 'invoicing'),
167 167
 		'type'        => 'number',
168
-		'context'     => array( 'view', 'edit', 'embed' ),
168
+		'context'     => array('view', 'edit', 'embed'),
169 169
 		'readonly'    => true,
170 170
 	),
171 171
 
172 172
 	'the_initial_price'       => array(
173
-		'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
173
+		'description' => __('The formatted initial price of the item.', 'invoicing'),
174 174
 		'type'        => 'string',
175
-		'context'     => array( 'view', 'edit', 'embed' ),
175
+		'context'     => array('view', 'edit', 'embed'),
176 176
 		'readonly'    => true,
177 177
 	),
178 178
 
179 179
 	'recurring_price' => array(
180
-		'description' => __( 'The recurring price of the item.', 'invoicing' ),
180
+		'description' => __('The recurring price of the item.', 'invoicing'),
181 181
 		'type'        => 'number',
182
-		'context'     => array( 'view', 'edit', 'embed' ),
182
+		'context'     => array('view', 'edit', 'embed'),
183 183
 		'readonly'    => true,
184 184
 	),
185 185
 
186 186
 	'the_recurring_price'       => array(
187
-		'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
187
+		'description' => __('The formatted recurring price of the item.', 'invoicing'),
188 188
 		'type'        => 'string',
189
-		'context'     => array( 'view', 'edit', 'embed' ),
189
+		'context'     => array('view', 'edit', 'embed'),
190 190
 		'readonly'    => true,
191 191
 	),
192 192
 
193 193
 	'recurring_period'        => array(
194
-		'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
194
+		'description' => __('The recurring period for a recurring item.', 'invoicing'),
195 195
 		'type'        => 'string',
196
-		'context'     => array( 'view', 'edit', 'embed' ),
197
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
196
+		'context'     => array('view', 'edit', 'embed'),
197
+		'enum'        => array('D', 'W', 'M', 'Y'),
198 198
 	),
199 199
 
200 200
 	'recurring_interval'        => array(
201
-		'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
201
+		'description' => __('The recurring interval for a subscription item.', 'invoicing'),
202 202
 		'type'        => 'integer',
203
-		'context'     => array( 'view', 'edit', 'embed' ),
203
+		'context'     => array('view', 'edit', 'embed'),
204 204
 	),
205 205
 
206 206
 	'recurring_limit' => array(
207
-		'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
207
+		'description' => __('The maximum number of renewals for a subscription item.', 'invoicing'),
208 208
 		'type'        => 'integer',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
209
+		'context'     => array('view', 'edit', 'embed'),
210 210
 	),
211 211
 
212 212
 	'is_free_trial'   => array(
213
-		'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
213
+		'description' => __('Whether the item has a free trial period.', 'invoicing'),
214 214
 		'type'        => 'integer',
215
-		'enum'        => array( 0, 1 ),
216
-		'context'     => array( 'view', 'edit', 'embed' ),
215
+		'enum'        => array(0, 1),
216
+		'context'     => array('view', 'edit', 'embed'),
217 217
 	),
218 218
 
219 219
 	'trial_period'    => array(
220
-		'description' => __( 'The trial period.', 'invoicing' ),
220
+		'description' => __('The trial period.', 'invoicing'),
221 221
 		'type'        => 'string',
222
-		'context'     => array( 'view', 'edit', 'embed' ),
223
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
222
+		'context'     => array('view', 'edit', 'embed'),
223
+		'enum'        => array('D', 'W', 'M', 'Y'),
224 224
 	),
225 225
 
226 226
 	'trial_interval'  => array(
227
-		'description' => __( 'The trial interval.', 'invoicing' ),
227
+		'description' => __('The trial interval.', 'invoicing'),
228 228
 		'type'        => 'integer',
229
-		'context'     => array( 'view', 'edit', 'embed' ),
229
+		'context'     => array('view', 'edit', 'embed'),
230 230
 	),
231 231
 
232 232
 	'first_renewal_date'       => array(
233
-		'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
233
+		'description' => __('The first renewal date in case the item was to be bought today.', 'invoicing'),
234 234
 		'type'        => 'string',
235
-		'context'     => array( 'view', 'edit', 'embed' ),
235
+		'context'     => array('view', 'edit', 'embed'),
236 236
 		'readonly'    => true,
237 237
 	),
238 238
 
239 239
 	'edit_url'        => array(
240
-		'description' => __( 'The URL to edit an item.', 'invoicing' ),
240
+		'description' => __('The URL to edit an item.', 'invoicing'),
241 241
 		'type'        => 'string',
242
-		'context'     => array( 'view', 'edit', 'embed' ),
242
+		'context'     => array('view', 'edit', 'embed'),
243 243
 		'readonly'    => true,
244 244
 	),
245 245
 );
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-manual-gateway.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Manual_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 = 'manual';
21 21
 
22 22
     /**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27 27
     protected $supports = array( 'subscription', 'addons' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 11;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 11;
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        = __( 'Manual Payment', 'invoicing' );
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
     }
47 47
 
48 48
     /**
49
-	 * Process Payment.
50
-	 *
51
-	 *
52
-	 * @param WPInv_Invoice $invoice Invoice.
53
-	 * @param array $submission_data Posted checkout fields.
54
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
55
-	 * @return array
56
-	 */
57
-	public function process_payment( $invoice, $submission_data, $submission ) {
49
+     * Process Payment.
50
+     *
51
+     *
52
+     * @param WPInv_Invoice $invoice Invoice.
53
+     * @param array $submission_data Posted checkout fields.
54
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
55
+     * @return array
56
+     */
57
+    public function process_payment( $invoice, $submission_data, $submission ) {
58 58
 
59 59
         // Mark it as paid.
60 60
         $invoice->mark_paid();
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-	 * (Maybe) renews a manual subscription profile.
72
-	 *
73
-	 *
74
-	 * @param bool $should_expire
71
+     * (Maybe) renews a manual subscription profile.
72
+     *
73
+     *
74
+     * @param bool $should_expire
75 75
      * @param WPInv_Subscription $subscription
76
-	 */
77
-	public function maybe_renew_subscription( $should_expire, $subscription ) {
76
+     */
77
+    public function maybe_renew_subscription( $should_expire, $subscription ) {
78 78
 
79 79
         // Ensure its our subscription && it's active.
80 80
         if ( 'manual' != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) {
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-	 * Processes invoice addons.
106
-	 *
107
-	 * @param WPInv_Invoice $invoice
108
-	 * @param GetPaid_Form_Item[] $items
109
-	 * @return WPInv_Invoice
110
-	 */
111
-	public function process_addons( $invoice, $items ) {
105
+     * Processes invoice addons.
106
+     *
107
+     * @param WPInv_Invoice $invoice
108
+     * @param GetPaid_Form_Item[] $items
109
+     * @return WPInv_Invoice
110
+     */
111
+    public function process_addons( $invoice, $items ) {
112 112
 
113 113
         foreach ( $items as $item ) {
114 114
             $invoice->add_item( $item );
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 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
  * Manual Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-    protected $supports = array( 'subscription', 'addons' );
27
+    protected $supports = array('subscription', 'addons');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title        = __( 'Manual Payment', 'invoicing' );
43
-        $this->method_title = __( 'Manual Payment', 'invoicing' );
42
+        $this->title        = __('Manual Payment', 'invoicing');
43
+        $this->method_title = __('Manual Payment', 'invoicing');
44 44
 
45
-        add_filter( 'getpaid_daily_maintenance_should_expire_subscription', array( $this, 'maybe_renew_subscription' ), 10, 2 );
45
+        add_filter('getpaid_daily_maintenance_should_expire_subscription', array($this, 'maybe_renew_subscription'), 10, 2);
46 46
     }
47 47
 
48 48
     /**
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
55 55
 	 * @return array
56 56
 	 */
57
-	public function process_payment( $invoice, $submission_data, $submission ) {
57
+	public function process_payment($invoice, $submission_data, $submission) {
58 58
 
59 59
         // Mark it as paid.
60 60
         $invoice->mark_paid();
61 61
 
62 62
         // (Maybe) activate subscription.
63
-        getpaid_activate_invoice_subscription( $invoice );
63
+        getpaid_activate_invoice_subscription($invoice);
64 64
 
65 65
         // Send to the success page.
66
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
66
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
67 67
 
68 68
     }
69 69
 
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	 * @param bool $should_expire
75 75
      * @param WPInv_Subscription $subscription
76 76
 	 */
77
-	public function maybe_renew_subscription( $should_expire, $subscription ) {
77
+	public function maybe_renew_subscription($should_expire, $subscription) {
78 78
 
79 79
         // Ensure its our subscription && it's active.
80
-        if ( 'manual' != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) {
80
+        if ('manual' != $subscription->get_gateway() || !$subscription->has_status('active trialling')) {
81 81
             return $should_expire;
82 82
         }
83 83
 
84 84
         // If this is the last renewal, complete the subscription.
85
-        if ( $subscription->is_last_renewal() ) {
85
+        if ($subscription->is_last_renewal()) {
86 86
             $subscription->complete();
87 87
             return false;
88 88
         }
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	 * @param GetPaid_Form_Item[] $items
109 109
 	 * @return WPInv_Invoice
110 110
 	 */
111
-	public function process_addons( $invoice, $items ) {
111
+	public function process_addons($invoice, $items) {
112 112
 
113
-        foreach ( $items as $item ) {
114
-            $invoice->add_item( $item );
113
+        foreach ($items as $item) {
114
+            $invoice->add_item($item);
115 115
         }
116 116
 
117 117
         $invoice->recalculate_total();
Please login to merge, or discard this patch.
templates/wpinv-invoice-print.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  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
 // Fetch the invoice.
13
-if ( empty( $invoice ) ) {
14
-    $invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+if (empty($invoice)) {
14
+    $invoice = new WPInv_Invoice($GLOBALS['post']);
15 15
 }
16 16
 
17 17
 // Abort if it does not exist.
18
-if ( $invoice->get_id() == 0 ) {
18
+if ($invoice->get_id() == 0) {
19 19
     exit;
20 20
 }
21 21
 
22 22
 // Fires before printing an invoice.
23
-do_action( 'wpinv_invoice_print_before_display', $invoice );
23
+do_action('wpinv_invoice_print_before_display', $invoice);
24 24
 
25 25
 ?><!DOCTYPE html>
26 26
 
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
 
30 30
     <head>
31 31
 
32
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
32
+		<meta charset="<?php bloginfo('charset'); ?>">
33 33
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
34 34
 
35 35
         <meta name="robots" content="noindex,nofollow">
36 36
 
37 37
 		<link rel="profile" href="https://gmpg.org/xfn/11">
38 38
 
39
-        <title>#<?php echo sanitize_text_field( $invoice->get_number() ); ?></title>
39
+        <title>#<?php echo sanitize_text_field($invoice->get_number()); ?></title>
40 40
 
41
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
41
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
42 42
 
43 43
     </head>
44 44
     
45 45
 
46 46
     <body class="body wpinv wpinv-print" style="font-weight: 400;">
47 47
 
48
-        <?php do_action( 'getpaid_invoice', $invoice ); ?>
49
-        <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?>
48
+        <?php do_action('getpaid_invoice', $invoice); ?>
49
+        <?php do_action('wpinv_invoice_print_body_end', $invoice); ?>
50 50
 
51 51
     </body>
52 52
 
Please login to merge, or discard this patch.
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>$label</th><td>$value</td></tr>" . PHP_EOL;
183
-		}
182
+            echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$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['worldpay_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['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
259
+        $admin_settings['worldpay_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>$label</th><td>$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['worldpay_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['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258
+        $admin_settings['worldpay_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['worldpay_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/admin/class-getpaid-post-types-admin.php 2 patches
Indentation   +620 added lines, -620 removed lines patch added patch discarded remove patch
@@ -13,633 +13,633 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Post_Types_Admin {
14 14
 
15 15
     /**
16
-	 * Hook in methods.
17
-	 */
18
-	public static function init() {
19
-
20
-		// Init metaboxes.
21
-		GetPaid_Metaboxes::init();
22
-
23
-		// Filter the post updated messages.
24
-		add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
25
-
26
-		// Filter post actions.
27
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
29
-
30
-		// Invoice table columns.
31
-		add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
-		add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
33
-
34
-		// Items table columns.
35
-		add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
-		add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
-		add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
-		add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
-		add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
-		add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
41
-
42
-		// Payment forms columns.
43
-		add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
-		add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
46
-
47
-		// Discount table columns.
48
-		add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
-		add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
50
-
51
-		// Deleting posts.
52
-		add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
54
-	}
55
-
56
-	/**
57
-	 * Post updated messages.
58
-	 */
59
-	public static function post_updated_messages( $messages ) {
60
-		global $post;
61
-
62
-		$messages['wpi_discount'] = array(
63
-			0   => '',
64
-			1   => __( 'Discount updated.', 'invoicing' ),
65
-			2   => __( 'Custom field updated.', 'invoicing' ),
66
-			3   => __( 'Custom field deleted.', 'invoicing' ),
67
-			4   => __( 'Discount updated.', 'invoicing' ),
68
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
-			6   => __( 'Discount updated.', 'invoicing' ),
70
-			7   => __( 'Discount saved.', 'invoicing' ),
71
-			8   => __( 'Discount submitted.', 'invoicing' ),
72
-			9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
-			10  => __( 'Discount draft updated.', 'invoicing' ),
74
-		);
75
-
76
-		$messages['wpi_payment_form'] = array(
77
-			0   => '',
78
-			1   => __( 'Payment Form updated.', 'invoicing' ),
79
-			2   => __( 'Custom field updated.', 'invoicing' ),
80
-			3   => __( 'Custom field deleted.', 'invoicing' ),
81
-			4   => __( 'Payment Form updated.', 'invoicing' ),
82
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
-			6   => __( 'Payment Form updated.', 'invoicing' ),
84
-			7   => __( 'Payment Form saved.', 'invoicing' ),
85
-			8   => __( 'Payment Form submitted.', 'invoicing' ),
86
-			9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
-			10  => __( 'Payment Form draft updated.', 'invoicing' ),
88
-		);
89
-
90
-		return $messages;
91
-
92
-	}
93
-
94
-	/**
95
-	 * Post row actions.
96
-	 */
97
-	public static function post_row_actions( $actions, $post ) {
98
-
99
-		$post = get_post( $post );
100
-
101
-		// We do not want to edit the default payment form.
102
-		if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
-			unset( $actions['trash'] );
104
-			unset( $actions['inline hide-if-no-js'] );
105
-		}
106
-
107
-		return $actions;
108
-	}
109
-
110
-	/**
16
+     * Hook in methods.
17
+     */
18
+    public static function init() {
19
+
20
+        // Init metaboxes.
21
+        GetPaid_Metaboxes::init();
22
+
23
+        // Filter the post updated messages.
24
+        add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
25
+
26
+        // Filter post actions.
27
+        add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
+        add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
29
+
30
+        // Invoice table columns.
31
+        add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
+        add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
33
+
34
+        // Items table columns.
35
+        add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
+        add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
+        add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
+        add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
+        add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
+        add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
41
+
42
+        // Payment forms columns.
43
+        add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
+        add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
+        add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
46
+
47
+        // Discount table columns.
48
+        add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
+        add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
50
+
51
+        // Deleting posts.
52
+        add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
+        add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
54
+    }
55
+
56
+    /**
57
+     * Post updated messages.
58
+     */
59
+    public static function post_updated_messages( $messages ) {
60
+        global $post;
61
+
62
+        $messages['wpi_discount'] = array(
63
+            0   => '',
64
+            1   => __( 'Discount updated.', 'invoicing' ),
65
+            2   => __( 'Custom field updated.', 'invoicing' ),
66
+            3   => __( 'Custom field deleted.', 'invoicing' ),
67
+            4   => __( 'Discount updated.', 'invoicing' ),
68
+            5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
+            6   => __( 'Discount updated.', 'invoicing' ),
70
+            7   => __( 'Discount saved.', 'invoicing' ),
71
+            8   => __( 'Discount submitted.', 'invoicing' ),
72
+            9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
+            10  => __( 'Discount draft updated.', 'invoicing' ),
74
+        );
75
+
76
+        $messages['wpi_payment_form'] = array(
77
+            0   => '',
78
+            1   => __( 'Payment Form updated.', 'invoicing' ),
79
+            2   => __( 'Custom field updated.', 'invoicing' ),
80
+            3   => __( 'Custom field deleted.', 'invoicing' ),
81
+            4   => __( 'Payment Form updated.', 'invoicing' ),
82
+            5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
+            6   => __( 'Payment Form updated.', 'invoicing' ),
84
+            7   => __( 'Payment Form saved.', 'invoicing' ),
85
+            8   => __( 'Payment Form submitted.', 'invoicing' ),
86
+            9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
+            10  => __( 'Payment Form draft updated.', 'invoicing' ),
88
+        );
89
+
90
+        return $messages;
91
+
92
+    }
93
+
94
+    /**
95
+     * Post row actions.
96
+     */
97
+    public static function post_row_actions( $actions, $post ) {
98
+
99
+        $post = get_post( $post );
100
+
101
+        // We do not want to edit the default payment form.
102
+        if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
+            unset( $actions['trash'] );
104
+            unset( $actions['inline hide-if-no-js'] );
105
+        }
106
+
107
+        return $actions;
108
+    }
109
+
110
+    /**
111 111
      * Remove bulk edit option from admin side quote listing
112 112
      *
113 113
      * @since    1.0.0
114 114
      * @param array $actions post actions
115
-	 * @param WP_Post $post
115
+     * @param WP_Post $post
116 116
      * @return array $actions actions without edit option
117 117
      */
118 118
     public static function filter_invoice_row_actions( $actions, $post ) {
119 119
 
120 120
         if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
121 121
 
122
-			$actions = array();
123
-			$invoice = new WPInv_Invoice( $post );
124
-
125
-			$actions['edit'] =  sprintf(
126
-				'<a href="%1$s">%2$s</a>',
127
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
-				esc_html( __( 'Edit', 'invoicing' ) )
129
-			);
130
-
131
-			if ( ! $invoice->is_draft() ) {
132
-
133
-				$actions['view'] =  sprintf(
134
-					'<a href="%1$s">%2$s</a>',
135
-					esc_url( $invoice->get_view_url() ),
136
-					sprintf(
137
-						esc_html( __( 'View %s', 'invoicing' ) ),
138
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
139
-					)
140
-				);
141
-
142
-				$actions['send'] =  sprintf(
143
-					'<a href="%1$s">%2$s</a>',
144
-					esc_url(
145
-						wp_nonce_url(
146
-							add_query_arg(
147
-								array(
148
-									'getpaid-admin-action' => 'send_invoice',
149
-									'invoice_id'           => $invoice->get_id()
150
-								)
151
-							),
152
-							'getpaid-nonce',
153
-							'getpaid-nonce'
154
-						)
155
-					),
156
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
157
-				);
158
-
159
-			}
122
+            $actions = array();
123
+            $invoice = new WPInv_Invoice( $post );
124
+
125
+            $actions['edit'] =  sprintf(
126
+                '<a href="%1$s">%2$s</a>',
127
+                esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
+                esc_html( __( 'Edit', 'invoicing' ) )
129
+            );
130
+
131
+            if ( ! $invoice->is_draft() ) {
132
+
133
+                $actions['view'] =  sprintf(
134
+                    '<a href="%1$s">%2$s</a>',
135
+                    esc_url( $invoice->get_view_url() ),
136
+                    sprintf(
137
+                        esc_html( __( 'View %s', 'invoicing' ) ),
138
+                        getpaid_get_post_type_label( $invoice->get_post_type(), false )
139
+                    )
140
+                );
141
+
142
+                $actions['send'] =  sprintf(
143
+                    '<a href="%1$s">%2$s</a>',
144
+                    esc_url(
145
+                        wp_nonce_url(
146
+                            add_query_arg(
147
+                                array(
148
+                                    'getpaid-admin-action' => 'send_invoice',
149
+                                    'invoice_id'           => $invoice->get_id()
150
+                                )
151
+                            ),
152
+                            'getpaid-nonce',
153
+                            'getpaid-nonce'
154
+                        )
155
+                    ),
156
+                    esc_html( __( 'Send to Customer', 'invoicing' ) )
157
+                );
158
+
159
+            }
160 160
 
161 161
         }
162 162
 
163 163
         return $actions;
164
-	}
164
+    }
165 165
 
166
-	/**
167
-	 * Returns an array of invoice table columns.
168
-	 */
169
-	public static function invoice_columns( $columns ) {
166
+    /**
167
+     * Returns an array of invoice table columns.
168
+     */
169
+    public static function invoice_columns( $columns ) {
170 170
 
171
-		$columns = array(
172
-			'cb'                => $columns['cb'],
173
-			'number'            => __( 'Invoice', 'invoicing' ),
174
-			'customer'          => __( 'Customer', 'invoicing' ),
175
-			'invoice_date'      => __( 'Date', 'invoicing' ),
176
-			'amount'            => __( 'Amount', 'invoicing' ),
177
-			'recurring'         => __( 'Recurring', 'invoicing' ),
178
-			'status'            => __( 'Status', 'invoicing' ),
179
-		);
171
+        $columns = array(
172
+            'cb'                => $columns['cb'],
173
+            'number'            => __( 'Invoice', 'invoicing' ),
174
+            'customer'          => __( 'Customer', 'invoicing' ),
175
+            'invoice_date'      => __( 'Date', 'invoicing' ),
176
+            'amount'            => __( 'Amount', 'invoicing' ),
177
+            'recurring'         => __( 'Recurring', 'invoicing' ),
178
+            'status'            => __( 'Status', 'invoicing' ),
179
+        );
180 180
 
181
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
182
-	}
181
+        return apply_filters( 'wpi_invoice_table_columns', $columns );
182
+    }
183 183
 
184
-	/**
185
-	 * Displays invoice table columns.
186
-	 */
187
-	public static function display_invoice_columns( $column_name, $post_id ) {
184
+    /**
185
+     * Displays invoice table columns.
186
+     */
187
+    public static function display_invoice_columns( $column_name, $post_id ) {
188 188
 
189
-		$invoice = new WPInv_Invoice( $post_id );
189
+        $invoice = new WPInv_Invoice( $post_id );
190 190
 
191
-		switch ( $column_name ) {
191
+        switch ( $column_name ) {
192 192
 
193
-			case 'invoice_date' :
194
-				$date_time = esc_attr( $invoice->get_created_date() );
195
-				$date      = getpaid_format_date_value( $date_time );
196
-				echo "<span title='$date_time'>$date</span>";
197
-				break;
193
+            case 'invoice_date' :
194
+                $date_time = esc_attr( $invoice->get_created_date() );
195
+                $date      = getpaid_format_date_value( $date_time );
196
+                echo "<span title='$date_time'>$date</span>";
197
+                break;
198 198
 
199
-			case 'amount' :
199
+            case 'amount' :
200 200
 
201
-				$amount = $invoice->get_total();
202
-				$formated_amount = wpinv_price( wpinv_format_amount( $amount ), $invoice->get_currency() );
201
+                $amount = $invoice->get_total();
202
+                $formated_amount = wpinv_price( wpinv_format_amount( $amount ), $invoice->get_currency() );
203 203
 
204
-				if ( $invoice->is_refunded() ) {
205
-					$refunded_amount = wpinv_price( wpinv_format_amount( 0 ), $invoice->get_currency() );
206
-					echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
207
-				} else {
204
+                if ( $invoice->is_refunded() ) {
205
+                    $refunded_amount = wpinv_price( wpinv_format_amount( 0 ), $invoice->get_currency() );
206
+                    echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
207
+                } else {
208 208
 
209
-					$discount = $invoice->get_total_discount();
209
+                    $discount = $invoice->get_total_discount();
210 210
 
211
-					if ( ! empty( $discount ) ) {
212
-						$new_amount = wpinv_price( wpinv_format_amount( $amount + $discount ), $invoice->get_currency() );
213
-						echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
214
-					} else {
215
-						echo $formated_amount;
216
-					}
211
+                    if ( ! empty( $discount ) ) {
212
+                        $new_amount = wpinv_price( wpinv_format_amount( $amount + $discount ), $invoice->get_currency() );
213
+                        echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
214
+                    } else {
215
+                        echo $formated_amount;
216
+                    }
217 217
 
218
-				}
218
+                }
219 219
 
220
-				break;
220
+                break;
221 221
 
222
-			case 'status' :
223
-				$status       = sanitize_text_field( $invoice->get_status() );
224
-				$status_label = sanitize_text_field( $invoice->get_status_nicename() );
222
+            case 'status' :
223
+                $status       = sanitize_text_field( $invoice->get_status() );
224
+                $status_label = sanitize_text_field( $invoice->get_status_nicename() );
225 225
 
226
-				// If it is paid, show the gateway title.
227
-				if ( $invoice->is_paid() ) {
228
-					$gateway = sanitize_text_field( $invoice->get_gateway_title() );
229
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
226
+                // If it is paid, show the gateway title.
227
+                if ( $invoice->is_paid() ) {
228
+                    $gateway = sanitize_text_field( $invoice->get_gateway_title() );
229
+                    $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
230 230
 
231
-					echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
232
-				} else {
233
-					echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>";
234
-				}
231
+                    echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
232
+                } else {
233
+                    echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>";
234
+                }
235 235
 
236
-				// If it is not paid, display the overdue and view status.
237
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
236
+                // If it is not paid, display the overdue and view status.
237
+                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
238 238
 
239
-					// Invoice view status.
240
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
241
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
242
-					} else {
243
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
244
-					}
239
+                    // Invoice view status.
240
+                    if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
241
+                        echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
242
+                    } else {
243
+                        echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
244
+                    }
245 245
 
246
-					// Display the overview status.
247
-					if ( wpinv_get_option( 'overdue_active' ) ) {
248
-						$due_date = $invoice->get_due_date();
249
-						$fomatted = getpaid_format_date( $due_date );
246
+                    // Display the overview status.
247
+                    if ( wpinv_get_option( 'overdue_active' ) ) {
248
+                        $due_date = $invoice->get_due_date();
249
+                        $fomatted = getpaid_format_date( $due_date );
250 250
 
251
-						if ( ! empty( $fomatted ) ) {
252
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
253
-							echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
254
-						}
255
-					}
251
+                        if ( ! empty( $fomatted ) ) {
252
+                            $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
253
+                            echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
254
+                        }
255
+                    }
256 256
 
257
-				}
257
+                }
258 258
 
259
-				break;
259
+                break;
260 260
 
261
-			case 'recurring':
261
+            case 'recurring':
262 262
 
263
-				if ( $invoice->is_recurring() ) {
264
-					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
265
-				} else {
266
-					echo '<i class="fa fa-times" style="color:#616161;"></i>';
267
-				}
268
-				break;
263
+                if ( $invoice->is_recurring() ) {
264
+                    echo '<i class="fa fa-check" style="color:#43850a;"></i>';
265
+                } else {
266
+                    echo '<i class="fa fa-times" style="color:#616161;"></i>';
267
+                }
268
+                break;
269 269
 
270
-			case 'number' :
270
+            case 'number' :
271 271
 
272
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
273
-				$invoice_number  = sanitize_text_field( $invoice->get_number() );
274
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
272
+                $edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
273
+                $invoice_number  = sanitize_text_field( $invoice->get_number() );
274
+                $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
275 275
 
276
-				echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
276
+                echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
277 277
 
278
-				break;
278
+                break;
279 279
 
280
-			case 'customer' :
280
+            case 'customer' :
281 281
 	
282
-				$customer_name = $invoice->get_user_full_name();
282
+                $customer_name = $invoice->get_user_full_name();
283 283
 	
284
-				if ( empty( $customer_name ) ) {
285
-					$customer_name = $invoice->get_email();
286
-				}
284
+                if ( empty( $customer_name ) ) {
285
+                    $customer_name = $invoice->get_email();
286
+                }
287 287
 	
288
-				if ( ! empty( $customer_name ) ) {
289
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
290
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
291
-					echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
292
-				} else {
293
-					echo '<div>&mdash;</div>';
294
-				}
288
+                if ( ! empty( $customer_name ) ) {
289
+                    $customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
290
+                    $view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
291
+                    echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
292
+                } else {
293
+                    echo '<div>&mdash;</div>';
294
+                }
295 295
 
296
-				break;
296
+                break;
297 297
 
298
-		}
298
+        }
299 299
 
300
-	}
300
+    }
301 301
 
302
-	/**
303
-	 * Returns an array of payment forms table columns.
304
-	 */
305
-	public static function payment_form_columns( $columns ) {
302
+    /**
303
+     * Returns an array of payment forms table columns.
304
+     */
305
+    public static function payment_form_columns( $columns ) {
306 306
 
307
-		$columns = array(
308
-			'cb'                => $columns['cb'],
309
-			'title'             => __( 'Name', 'invoicing' ),
310
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
311
-			'earnings'          => __( 'Revenue', 'invoicing' ),
312
-			'refunds'           => __( 'Refunded', 'invoicing' ),
313
-			'items'             => __( 'Items', 'invoicing' ),
314
-			'date'              => __( 'Date', 'invoicing' ),
315
-		);
307
+        $columns = array(
308
+            'cb'                => $columns['cb'],
309
+            'title'             => __( 'Name', 'invoicing' ),
310
+            'shortcode'         => __( 'Shortcode', 'invoicing' ),
311
+            'earnings'          => __( 'Revenue', 'invoicing' ),
312
+            'refunds'           => __( 'Refunded', 'invoicing' ),
313
+            'items'             => __( 'Items', 'invoicing' ),
314
+            'date'              => __( 'Date', 'invoicing' ),
315
+        );
316 316
 
317
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
317
+        return apply_filters( 'wpi_payment_form_table_columns', $columns );
318 318
 
319
-	}
319
+    }
320 320
 
321
-	/**
322
-	 * Displays payment form table columns.
323
-	 */
324
-	public static function display_payment_form_columns( $column_name, $post_id ) {
321
+    /**
322
+     * Displays payment form table columns.
323
+     */
324
+    public static function display_payment_form_columns( $column_name, $post_id ) {
325 325
 
326
-		// Retrieve the payment form.
327
-		$form = new GetPaid_Payment_Form( $post_id );
326
+        // Retrieve the payment form.
327
+        $form = new GetPaid_Payment_Form( $post_id );
328 328
 
329
-		switch ( $column_name ) {
329
+        switch ( $column_name ) {
330 330
 
331
-			case 'earnings' :
332
-				echo wpinv_price( wpinv_format_amount( $form->get_earned() ) );
333
-				break;
331
+            case 'earnings' :
332
+                echo wpinv_price( wpinv_format_amount( $form->get_earned() ) );
333
+                break;
334 334
 
335
-			case 'refunds' :
336
-				echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
337
-				break;
335
+            case 'refunds' :
336
+                echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
337
+                break;
338 338
 
339
-			case 'refunds' :
340
-				echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
341
-				break;
339
+            case 'refunds' :
340
+                echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
341
+                break;
342 342
 
343
-			case 'shortcode' :
343
+            case 'shortcode' :
344 344
 
345
-				if ( $form->is_default() ) {
346
-					echo '&mdash;';
347
-				} else {
348
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
349
-				}
345
+                if ( $form->is_default() ) {
346
+                    echo '&mdash;';
347
+                } else {
348
+                    echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
349
+                }
350 350
 
351
-				break;
351
+                break;
352 352
 
353
-			case 'items' :
353
+            case 'items' :
354 354
 
355
-				$items = $form->get_items();
355
+                $items = $form->get_items();
356 356
 
357
-				if ( $form->is_default() || empty( $items ) ) {
358
-					echo '&mdash;';
359
-					return;
360
-				}
357
+                if ( $form->is_default() || empty( $items ) ) {
358
+                    echo '&mdash;';
359
+                    return;
360
+                }
361 361
 
362
-				$_items = array();
362
+                $_items = array();
363 363
 
364
-				foreach ( $items as $item ) {
365
-					$url = $item->get_edit_url();
364
+                foreach ( $items as $item ) {
365
+                    $url = $item->get_edit_url();
366 366
 
367
-					if ( empty( $url ) ) {
368
-						$_items[] = sanitize_text_field( $item->get_name() );
369
-					} else {
370
-						$_items[] = sprintf(
371
-							'<a href="%s">%s</a>',
372
-							esc_url( $url ),
373
-							sanitize_text_field( $item->get_name() )
374
-						);
375
-					}
367
+                    if ( empty( $url ) ) {
368
+                        $_items[] = sanitize_text_field( $item->get_name() );
369
+                    } else {
370
+                        $_items[] = sprintf(
371
+                            '<a href="%s">%s</a>',
372
+                            esc_url( $url ),
373
+                            sanitize_text_field( $item->get_name() )
374
+                        );
375
+                    }
376 376
 
377
-				}
377
+                }
378 378
 
379
-				echo implode( '<br>', $_items );
379
+                echo implode( '<br>', $_items );
380 380
 
381
-				break;
381
+                break;
382 382
 
383
-		}
383
+        }
384 384
 
385
-	}
385
+    }
386 386
 
387
-	/**
388
-	 * Filters post states.
389
-	 */
390
-	public static function filter_payment_form_state( $post_states, $post ) {
387
+    /**
388
+     * Filters post states.
389
+     */
390
+    public static function filter_payment_form_state( $post_states, $post ) {
391 391
 
392
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
393
-			$post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
394
-		}
392
+        if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
393
+            $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
394
+        }
395 395
 	
396
-		return $post_states;
397
-
398
-	}
399
-
400
-	/**
401
-	 * Returns an array of coupon table columns.
402
-	 */
403
-	public static function discount_columns( $columns ) {
404
-
405
-		$columns = array(
406
-			'cb'                => $columns['cb'],
407
-			'title'             => __( 'Name', 'invoicing' ),
408
-			'code'              => __( 'Code', 'invoicing' ),
409
-			'amount'            => __( 'Amount', 'invoicing' ),
410
-			'usage'             => __( 'Usage / Limit', 'invoicing' ),
411
-			'start_date'        => __( 'Start Date', 'invoicing' ),
412
-			'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
413
-		);
414
-
415
-		return apply_filters( 'wpi_discount_table_columns', $columns );
416
-	}
417
-
418
-	/**
419
-	 * Filters post states.
420
-	 */
421
-	public static function filter_discount_state( $post_states, $post ) {
422
-
423
-		if ( 'wpi_discount' == $post->post_type ) {
424
-
425
-			$discount = new WPInv_Discount( $post );
426
-
427
-			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
428
-
429
-			if ( $status != 'publish' ) {
430
-				return array(
431
-					'discount_status' => wpinv_discount_status( $status ),
432
-				);
433
-			}
434
-
435
-			return array();
436
-
437
-		}
438
-
439
-		return $post_states;
440
-
441
-	}
442
-
443
-	/**
444
-	 * Returns an array of items table columns.
445
-	 */
446
-	public static function item_columns( $columns ) {
447
-
448
-		$columns = array(
449
-			'cb'                => $columns['cb'],
450
-			'title'             => __( 'Name', 'invoicing' ),
451
-			'price'             => __( 'Price', 'invoicing' ),
452
-			'vat_rule'          => __( 'VAT rule', 'invoicing' ),
453
-			'vat_class'         => __( 'VAT class', 'invoicing' ),
454
-			'type'              => __( 'Type', 'invoicing' ),
455
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
456
-		);
457
-
458
-		if ( ! wpinv_use_taxes() ) {
459
-			unset( $columns['vat_rule'] );
460
-			unset( $columns['vat_class'] );
461
-		}
462
-
463
-		return apply_filters( 'wpi_item_table_columns', $columns );
464
-	}
465
-
466
-	/**
467
-	 * Returns an array of sortable items table columns.
468
-	 */
469
-	public static function sortable_item_columns( $columns ) {
470
-
471
-		return array_merge(
472
-			$columns,
473
-			array(
474
-				'price'     => 'price',
475
-				'vat_rule'  => 'vat_rule',
476
-				'vat_class' => 'vat_class',
477
-				'type'      => 'type',
478
-			)
479
-		);
480
-
481
-	}
482
-
483
-	/**
484
-	 * Displays items table columns.
485
-	 */
486
-	public static function display_item_columns( $column_name, $post_id ) {
396
+        return $post_states;
397
+
398
+    }
399
+
400
+    /**
401
+     * Returns an array of coupon table columns.
402
+     */
403
+    public static function discount_columns( $columns ) {
404
+
405
+        $columns = array(
406
+            'cb'                => $columns['cb'],
407
+            'title'             => __( 'Name', 'invoicing' ),
408
+            'code'              => __( 'Code', 'invoicing' ),
409
+            'amount'            => __( 'Amount', 'invoicing' ),
410
+            'usage'             => __( 'Usage / Limit', 'invoicing' ),
411
+            'start_date'        => __( 'Start Date', 'invoicing' ),
412
+            'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
413
+        );
414
+
415
+        return apply_filters( 'wpi_discount_table_columns', $columns );
416
+    }
417
+
418
+    /**
419
+     * Filters post states.
420
+     */
421
+    public static function filter_discount_state( $post_states, $post ) {
422
+
423
+        if ( 'wpi_discount' == $post->post_type ) {
424
+
425
+            $discount = new WPInv_Discount( $post );
426
+
427
+            $status = $discount->is_expired() ? 'expired' : $discount->get_status();
428
+
429
+            if ( $status != 'publish' ) {
430
+                return array(
431
+                    'discount_status' => wpinv_discount_status( $status ),
432
+                );
433
+            }
434
+
435
+            return array();
436
+
437
+        }
438
+
439
+        return $post_states;
440
+
441
+    }
442
+
443
+    /**
444
+     * Returns an array of items table columns.
445
+     */
446
+    public static function item_columns( $columns ) {
447
+
448
+        $columns = array(
449
+            'cb'                => $columns['cb'],
450
+            'title'             => __( 'Name', 'invoicing' ),
451
+            'price'             => __( 'Price', 'invoicing' ),
452
+            'vat_rule'          => __( 'VAT rule', 'invoicing' ),
453
+            'vat_class'         => __( 'VAT class', 'invoicing' ),
454
+            'type'              => __( 'Type', 'invoicing' ),
455
+            'shortcode'         => __( 'Shortcode', 'invoicing' ),
456
+        );
457
+
458
+        if ( ! wpinv_use_taxes() ) {
459
+            unset( $columns['vat_rule'] );
460
+            unset( $columns['vat_class'] );
461
+        }
462
+
463
+        return apply_filters( 'wpi_item_table_columns', $columns );
464
+    }
465
+
466
+    /**
467
+     * Returns an array of sortable items table columns.
468
+     */
469
+    public static function sortable_item_columns( $columns ) {
470
+
471
+        return array_merge(
472
+            $columns,
473
+            array(
474
+                'price'     => 'price',
475
+                'vat_rule'  => 'vat_rule',
476
+                'vat_class' => 'vat_class',
477
+                'type'      => 'type',
478
+            )
479
+        );
480
+
481
+    }
482
+
483
+    /**
484
+     * Displays items table columns.
485
+     */
486
+    public static function display_item_columns( $column_name, $post_id ) {
487 487
  
488
-		$item = new WPInv_Item( $post_id );
488
+        $item = new WPInv_Item( $post_id );
489 489
 
490
-		switch ( $column_name ) {
490
+        switch ( $column_name ) {
491 491
 
492
-			case 'price' :
492
+            case 'price' :
493 493
 
494
-				if ( ! $item->is_recurring() ) {
495
-					echo $item->get_the_price();
496
-					break;
497
-				}
494
+                if ( ! $item->is_recurring() ) {
495
+                    echo $item->get_the_price();
496
+                    break;
497
+                }
498 498
 
499
-				$price = wp_sprintf(
500
-					__( '%s / %s', 'invoicing' ),
501
-					$item->get_the_price(),
502
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
503
-				);
499
+                $price = wp_sprintf(
500
+                    __( '%s / %s', 'invoicing' ),
501
+                    $item->get_the_price(),
502
+                    getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
503
+                );
504 504
 
505
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
506
-					echo $price;
507
-					break;
508
-				}
505
+                if ( $item->get_the_price() == $item->get_the_initial_price() ) {
506
+                    echo $price;
507
+                    break;
508
+                }
509 509
 
510
-				echo $item->get_the_initial_price();
510
+                echo $item->get_the_initial_price();
511 511
 
512
-				echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
513
-				break;
512
+                echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
513
+                break;
514 514
 
515
-			case 'vat_rule' :
516
-				echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
517
-				break;
515
+            case 'vat_rule' :
516
+                echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
517
+                break;
518 518
 
519
-			case 'vat_class' :
520
-				echo getpaid_get_tax_class_label( $item->get_vat_class() );
521
-				break;
519
+            case 'vat_class' :
520
+                echo getpaid_get_tax_class_label( $item->get_vat_class() );
521
+                break;
522 522
 
523
-			case 'shortcode' :
524
-				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
525
-				break;
523
+            case 'shortcode' :
524
+                echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
525
+                break;
526 526
 
527
-			case 'type' :
528
-				echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
529
-				break;
527
+            case 'type' :
528
+                echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
529
+                break;
530 530
 
531
-		}
531
+        }
532 532
 
533
-	}
533
+    }
534 534
 
535
-	/**
536
-	 * Lets users filter items using taxes.
537
-	 */
538
-	public static function add_item_filters( $post_type ) {
535
+    /**
536
+     * Lets users filter items using taxes.
537
+     */
538
+    public static function add_item_filters( $post_type ) {
539 539
 
540
-		// Abort if we're not dealing with items.
541
-		if ( $post_type != 'wpi_item' ) {
542
-			return;
543
-		}
540
+        // Abort if we're not dealing with items.
541
+        if ( $post_type != 'wpi_item' ) {
542
+            return;
543
+        }
544 544
 
545
-		// Filter by vat rules.
546
-		if ( wpinv_use_taxes() ) {
545
+        // Filter by vat rules.
546
+        if ( wpinv_use_taxes() ) {
547 547
 	
548
-			// Sanitize selected vat rule.
549
-			$vat_rule   = '';
550
-			$vat_rules  = getpaid_get_tax_rules();
551
-			if ( isset( $_GET['vat_rule'] ) ) {
552
-				$vat_rule   =  $_GET['vat_rule'];
553
-			}
554
-
555
-			// Filter by VAT rule.
556
-			echo wpinv_html_select(
557
-				array(
558
-					'options'          => array_merge(
559
-						array(
560
-							'' => __( 'All VAT rules', 'invoicing' )
561
-						),
562
-						$vat_rules
563
-					),
564
-					'name'             => 'vat_rule',
565
-					'id'               => 'vat_rule',
566
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
567
-					'show_option_all'  => false,
568
-					'show_option_none' => false,
569
-				)
570
-			);
571
-
572
-			// Filter by VAT class.
548
+            // Sanitize selected vat rule.
549
+            $vat_rule   = '';
550
+            $vat_rules  = getpaid_get_tax_rules();
551
+            if ( isset( $_GET['vat_rule'] ) ) {
552
+                $vat_rule   =  $_GET['vat_rule'];
553
+            }
554
+
555
+            // Filter by VAT rule.
556
+            echo wpinv_html_select(
557
+                array(
558
+                    'options'          => array_merge(
559
+                        array(
560
+                            '' => __( 'All VAT rules', 'invoicing' )
561
+                        ),
562
+                        $vat_rules
563
+                    ),
564
+                    'name'             => 'vat_rule',
565
+                    'id'               => 'vat_rule',
566
+                    'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
567
+                    'show_option_all'  => false,
568
+                    'show_option_none' => false,
569
+                )
570
+            );
571
+
572
+            // Filter by VAT class.
573 573
 	
574
-			// Sanitize selected vat rule.
575
-			$vat_class   = '';
576
-			$vat_classes = getpaid_get_tax_classes();
577
-			if ( isset( $_GET['vat_class'] ) ) {
578
-				$vat_class   =  $_GET['vat_class'];
579
-			}
580
-
581
-			echo wpinv_html_select(
582
-				array(
583
-					'options'          => array_merge(
584
-						array(
585
-							'' => __( 'All VAT classes', 'invoicing' )
586
-						),
587
-						$vat_classes
588
-					),
589
-					'name'             => 'vat_class',
590
-					'id'               => 'vat_class',
591
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
592
-					'show_option_all'  => false,
593
-					'show_option_none' => false,
594
-				)
595
-			);
596
-
597
-		}
598
-
599
-		// Filter by item type.
600
-		$type   = '';
601
-		if ( isset( $_GET['type'] ) ) {
602
-			$type   =  $_GET['type'];
603
-		}
604
-
605
-		echo wpinv_html_select(
606
-			array(
607
-				'options'          => array_merge(
608
-					array(
609
-						'' => __( 'All item types', 'invoicing' )
610
-					),
611
-					wpinv_get_item_types()
612
-				),
613
-				'name'             => 'type',
614
-				'id'               => 'type',
615
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
616
-				'show_option_all'  => false,
617
-				'show_option_none' => false,
618
-			)
619
-		);
620
-
621
-	}
622
-
623
-	/**
624
-	 * Filters the item query.
625
-	 */
626
-	public static function filter_item_query( $query ) {
627
-
628
-		// modify the query only if it admin and main query.
629
-		if ( ! ( is_admin() && $query->is_main_query() ) ){ 
630
-			return $query;
631
-		}
632
-
633
-		// we want to modify the query for our items.
634
-		if ( 'wpi_item' != $query->query['post_type'] ){
635
-			return $query;
636
-		}
637
-
638
-		if ( empty( $query->query_vars['meta_query'] ) ) {
639
-			$query->query_vars['meta_query'] = array();
640
-		}
641
-
642
-		// Filter vat rule type
574
+            // Sanitize selected vat rule.
575
+            $vat_class   = '';
576
+            $vat_classes = getpaid_get_tax_classes();
577
+            if ( isset( $_GET['vat_class'] ) ) {
578
+                $vat_class   =  $_GET['vat_class'];
579
+            }
580
+
581
+            echo wpinv_html_select(
582
+                array(
583
+                    'options'          => array_merge(
584
+                        array(
585
+                            '' => __( 'All VAT classes', 'invoicing' )
586
+                        ),
587
+                        $vat_classes
588
+                    ),
589
+                    'name'             => 'vat_class',
590
+                    'id'               => 'vat_class',
591
+                    'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
592
+                    'show_option_all'  => false,
593
+                    'show_option_none' => false,
594
+                )
595
+            );
596
+
597
+        }
598
+
599
+        // Filter by item type.
600
+        $type   = '';
601
+        if ( isset( $_GET['type'] ) ) {
602
+            $type   =  $_GET['type'];
603
+        }
604
+
605
+        echo wpinv_html_select(
606
+            array(
607
+                'options'          => array_merge(
608
+                    array(
609
+                        '' => __( 'All item types', 'invoicing' )
610
+                    ),
611
+                    wpinv_get_item_types()
612
+                ),
613
+                'name'             => 'type',
614
+                'id'               => 'type',
615
+                'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
616
+                'show_option_all'  => false,
617
+                'show_option_none' => false,
618
+            )
619
+        );
620
+
621
+    }
622
+
623
+    /**
624
+     * Filters the item query.
625
+     */
626
+    public static function filter_item_query( $query ) {
627
+
628
+        // modify the query only if it admin and main query.
629
+        if ( ! ( is_admin() && $query->is_main_query() ) ){ 
630
+            return $query;
631
+        }
632
+
633
+        // we want to modify the query for our items.
634
+        if ( 'wpi_item' != $query->query['post_type'] ){
635
+            return $query;
636
+        }
637
+
638
+        if ( empty( $query->query_vars['meta_query'] ) ) {
639
+            $query->query_vars['meta_query'] = array();
640
+        }
641
+
642
+        // Filter vat rule type
643 643
         if ( ! empty( $_GET['vat_rule'] ) ) {
644 644
             $query->query_vars['meta_query'][] = array(
645 645
                 'key'     => '_wpinv_vat_rule',
@@ -664,94 +664,94 @@  discard block
 block discarded – undo
664 664
                 'value'   => sanitize_text_field( $_GET['type'] ),
665 665
                 'compare' => '='
666 666
             );
667
-		}
668
-
669
-	}
670
-
671
-	/**
672
-	 * Reorders items.
673
-	 */
674
-	public static function reorder_items( $vars ) {
675
-		global $typenow;
676
-
677
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
678
-			return $vars;
679
-		}
680
-
681
-		// By item type.
682
-		if ( 'type' == $vars['orderby'] ) {
683
-			return array_merge(
684
-				$vars,
685
-				array(
686
-					'meta_key' => '_wpinv_type',
687
-					'orderby'  => 'meta_value'
688
-				)
689
-			);
690
-		}
691
-
692
-		// By vat class.
693
-		if ( 'vat_class' == $vars['orderby'] ) {
694
-			return array_merge(
695
-				$vars,
696
-				array(
697
-					'meta_key' => '_wpinv_vat_class',
698
-					'orderby'  => 'meta_value'
699
-				)
700
-			);
701
-		}
702
-
703
-		// By vat rule.
704
-		if ( 'vat_rule' == $vars['orderby'] ) {
705
-			return array_merge(
706
-				$vars,
707
-				array(
708
-					'meta_key' => '_wpinv_vat_rule',
709
-					'orderby'  => 'meta_value'
710
-				)
711
-			);
712
-		}
713
-
714
-		// By price.
715
-		if ( 'price' == $vars['orderby'] ) {
716
-			return array_merge(
717
-				$vars,
718
-				array(
719
-					'meta_key' => '_wpinv_price',
720
-					'orderby'  => 'meta_value_num'
721
-				)
722
-			);
723
-		}
724
-
725
-		return $vars;
726
-
727
-	}
728
-
729
-	/**
730
-	 * Fired when deleting a post.
731
-	 */
732
-	public static function delete_post( $post_id ) {
733
-
734
-		switch ( get_post_type( $post_id ) ) {
735
-
736
-			case 'wpi_item' :
737
-				do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
738
-				break;
739
-
740
-			case 'wpi_payment_form' :
741
-				do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
742
-				break;
743
-
744
-			case 'wpi_discount' :
745
-				do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
746
-				break;
747
-
748
-			case 'wpi_invoice' :
749
-				$invoice = new WPInv_Invoice( $post_id );
750
-				do_action( "getpaid_before_delete_invoice", $invoice );
751
-				$invoice->get_data_store()->delete_items( $invoice );
752
-				$invoice->get_data_store()->delete_special_fields( $invoice );
753
-				break;
754
-		}
755
-	}
667
+        }
668
+
669
+    }
670
+
671
+    /**
672
+     * Reorders items.
673
+     */
674
+    public static function reorder_items( $vars ) {
675
+        global $typenow;
676
+
677
+        if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
678
+            return $vars;
679
+        }
680
+
681
+        // By item type.
682
+        if ( 'type' == $vars['orderby'] ) {
683
+            return array_merge(
684
+                $vars,
685
+                array(
686
+                    'meta_key' => '_wpinv_type',
687
+                    'orderby'  => 'meta_value'
688
+                )
689
+            );
690
+        }
691
+
692
+        // By vat class.
693
+        if ( 'vat_class' == $vars['orderby'] ) {
694
+            return array_merge(
695
+                $vars,
696
+                array(
697
+                    'meta_key' => '_wpinv_vat_class',
698
+                    'orderby'  => 'meta_value'
699
+                )
700
+            );
701
+        }
702
+
703
+        // By vat rule.
704
+        if ( 'vat_rule' == $vars['orderby'] ) {
705
+            return array_merge(
706
+                $vars,
707
+                array(
708
+                    'meta_key' => '_wpinv_vat_rule',
709
+                    'orderby'  => 'meta_value'
710
+                )
711
+            );
712
+        }
713
+
714
+        // By price.
715
+        if ( 'price' == $vars['orderby'] ) {
716
+            return array_merge(
717
+                $vars,
718
+                array(
719
+                    'meta_key' => '_wpinv_price',
720
+                    'orderby'  => 'meta_value_num'
721
+                )
722
+            );
723
+        }
724
+
725
+        return $vars;
726
+
727
+    }
728
+
729
+    /**
730
+     * Fired when deleting a post.
731
+     */
732
+    public static function delete_post( $post_id ) {
733
+
734
+        switch ( get_post_type( $post_id ) ) {
735
+
736
+            case 'wpi_item' :
737
+                do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
738
+                break;
739
+
740
+            case 'wpi_payment_form' :
741
+                do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
742
+                break;
743
+
744
+            case 'wpi_discount' :
745
+                do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
746
+                break;
747
+
748
+            case 'wpi_invoice' :
749
+                $invoice = new WPInv_Invoice( $post_id );
750
+                do_action( "getpaid_before_delete_invoice", $invoice );
751
+                $invoice->get_data_store()->delete_items( $invoice );
752
+                $invoice->get_data_store()->delete_special_fields( $invoice );
753
+                break;
754
+        }
755
+    }
756 756
 
757 757
 }
Please login to merge, or discard this patch.
Spacing   +201 added lines, -201 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
  * Post types Admin Class
@@ -21,70 +21,70 @@  discard block
 block discarded – undo
21 21
 		GetPaid_Metaboxes::init();
22 22
 
23 23
 		// Filter the post updated messages.
24
-		add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
24
+		add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages');
25 25
 
26 26
 		// Filter post actions.
27
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
27
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2);
28
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2);
29 29
 
30 30
 		// Invoice table columns.
31
-		add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
-		add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
31
+		add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100);
32
+		add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2);
33 33
 
34 34
 		// Items table columns.
35
-		add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
-		add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
-		add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
-		add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
-		add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
-		add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
35
+		add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100);
36
+		add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20);
37
+		add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2);
38
+		add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100);
39
+		add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100);
40
+		add_action('request', array(__CLASS__, 'reorder_items'), 100);
41 41
 
42 42
 		// Payment forms columns.
43
-		add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
-		add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
43
+		add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100);
44
+		add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2);
45
+		add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2);
46 46
 
47 47
 		// Discount table columns.
48
-		add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
-		add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
48
+		add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100);
49
+		add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100);
50 50
 
51 51
 		// Deleting posts.
52
-		add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
52
+		add_action('delete_post', array(__CLASS__, 'delete_post'));
53
+		add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2);
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * Post updated messages.
58 58
 	 */
59
-	public static function post_updated_messages( $messages ) {
59
+	public static function post_updated_messages($messages) {
60 60
 		global $post;
61 61
 
62 62
 		$messages['wpi_discount'] = array(
63 63
 			0   => '',
64
-			1   => __( 'Discount updated.', 'invoicing' ),
65
-			2   => __( 'Custom field updated.', 'invoicing' ),
66
-			3   => __( 'Custom field deleted.', 'invoicing' ),
67
-			4   => __( 'Discount updated.', 'invoicing' ),
68
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
-			6   => __( 'Discount updated.', 'invoicing' ),
70
-			7   => __( 'Discount saved.', 'invoicing' ),
71
-			8   => __( 'Discount submitted.', 'invoicing' ),
72
-			9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
-			10  => __( 'Discount draft updated.', 'invoicing' ),
64
+			1   => __('Discount updated.', 'invoicing'),
65
+			2   => __('Custom field updated.', 'invoicing'),
66
+			3   => __('Custom field deleted.', 'invoicing'),
67
+			4   => __('Discount updated.', 'invoicing'),
68
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
69
+			6   => __('Discount updated.', 'invoicing'),
70
+			7   => __('Discount saved.', 'invoicing'),
71
+			8   => __('Discount submitted.', 'invoicing'),
72
+			9   => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
73
+			10  => __('Discount draft updated.', 'invoicing'),
74 74
 		);
75 75
 
76 76
 		$messages['wpi_payment_form'] = array(
77 77
 			0   => '',
78
-			1   => __( 'Payment Form updated.', 'invoicing' ),
79
-			2   => __( 'Custom field updated.', 'invoicing' ),
80
-			3   => __( 'Custom field deleted.', 'invoicing' ),
81
-			4   => __( 'Payment Form updated.', 'invoicing' ),
82
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
-			6   => __( 'Payment Form updated.', 'invoicing' ),
84
-			7   => __( 'Payment Form saved.', 'invoicing' ),
85
-			8   => __( 'Payment Form submitted.', 'invoicing' ),
86
-			9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
-			10  => __( 'Payment Form draft updated.', 'invoicing' ),
78
+			1   => __('Payment Form updated.', 'invoicing'),
79
+			2   => __('Custom field updated.', 'invoicing'),
80
+			3   => __('Custom field deleted.', 'invoicing'),
81
+			4   => __('Payment Form updated.', 'invoicing'),
82
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
83
+			6   => __('Payment Form updated.', 'invoicing'),
84
+			7   => __('Payment Form saved.', 'invoicing'),
85
+			8   => __('Payment Form submitted.', 'invoicing'),
86
+			9   => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
87
+			10  => __('Payment Form draft updated.', 'invoicing'),
88 88
 		);
89 89
 
90 90
 		return $messages;
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 * Post row actions.
96 96
 	 */
97
-	public static function post_row_actions( $actions, $post ) {
97
+	public static function post_row_actions($actions, $post) {
98 98
 
99
-		$post = get_post( $post );
99
+		$post = get_post($post);
100 100
 
101 101
 		// We do not want to edit the default payment form.
102
-		if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
-			unset( $actions['trash'] );
104
-			unset( $actions['inline hide-if-no-js'] );
102
+		if ('wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form()) {
103
+			unset($actions['trash']);
104
+			unset($actions['inline hide-if-no-js']);
105 105
 		}
106 106
 
107 107
 		return $actions;
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
 	 * @param WP_Post $post
116 116
      * @return array $actions actions without edit option
117 117
      */
118
-    public static function filter_invoice_row_actions( $actions, $post ) {
118
+    public static function filter_invoice_row_actions($actions, $post) {
119 119
 
120
-        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
120
+        if (getpaid_is_invoice_post_type($post->post_type)) {
121 121
 
122 122
 			$actions = array();
123
-			$invoice = new WPInv_Invoice( $post );
123
+			$invoice = new WPInv_Invoice($post);
124 124
 
125
-			$actions['edit'] =  sprintf(
125
+			$actions['edit'] = sprintf(
126 126
 				'<a href="%1$s">%2$s</a>',
127
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
-				esc_html( __( 'Edit', 'invoicing' ) )
127
+				esc_url(get_edit_post_link($invoice->get_id())),
128
+				esc_html(__('Edit', 'invoicing'))
129 129
 			);
130 130
 
131
-			if ( ! $invoice->is_draft() ) {
131
+			if (!$invoice->is_draft()) {
132 132
 
133
-				$actions['view'] =  sprintf(
133
+				$actions['view'] = sprintf(
134 134
 					'<a href="%1$s">%2$s</a>',
135
-					esc_url( $invoice->get_view_url() ),
135
+					esc_url($invoice->get_view_url()),
136 136
 					sprintf(
137
-						esc_html( __( 'View %s', 'invoicing' ) ),
138
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
137
+						esc_html(__('View %s', 'invoicing')),
138
+						getpaid_get_post_type_label($invoice->get_post_type(), false)
139 139
 					)
140 140
 				);
141 141
 
142
-				$actions['send'] =  sprintf(
142
+				$actions['send'] = sprintf(
143 143
 					'<a href="%1$s">%2$s</a>',
144 144
 					esc_url(
145 145
 						wp_nonce_url(
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 							'getpaid-nonce'
154 154
 						)
155 155
 					),
156
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
156
+					esc_html(__('Send to Customer', 'invoicing'))
157 157
 				);
158 158
 
159 159
 			}
@@ -166,50 +166,50 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * Returns an array of invoice table columns.
168 168
 	 */
169
-	public static function invoice_columns( $columns ) {
169
+	public static function invoice_columns($columns) {
170 170
 
171 171
 		$columns = array(
172 172
 			'cb'                => $columns['cb'],
173
-			'number'            => __( 'Invoice', 'invoicing' ),
174
-			'customer'          => __( 'Customer', 'invoicing' ),
175
-			'invoice_date'      => __( 'Date', 'invoicing' ),
176
-			'amount'            => __( 'Amount', 'invoicing' ),
177
-			'recurring'         => __( 'Recurring', 'invoicing' ),
178
-			'status'            => __( 'Status', 'invoicing' ),
173
+			'number'            => __('Invoice', 'invoicing'),
174
+			'customer'          => __('Customer', 'invoicing'),
175
+			'invoice_date'      => __('Date', 'invoicing'),
176
+			'amount'            => __('Amount', 'invoicing'),
177
+			'recurring'         => __('Recurring', 'invoicing'),
178
+			'status'            => __('Status', 'invoicing'),
179 179
 		);
180 180
 
181
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
181
+		return apply_filters('wpi_invoice_table_columns', $columns);
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * Displays invoice table columns.
186 186
 	 */
187
-	public static function display_invoice_columns( $column_name, $post_id ) {
187
+	public static function display_invoice_columns($column_name, $post_id) {
188 188
 
189
-		$invoice = new WPInv_Invoice( $post_id );
189
+		$invoice = new WPInv_Invoice($post_id);
190 190
 
191
-		switch ( $column_name ) {
191
+		switch ($column_name) {
192 192
 
193 193
 			case 'invoice_date' :
194
-				$date_time = esc_attr( $invoice->get_created_date() );
195
-				$date      = getpaid_format_date_value( $date_time );
194
+				$date_time = esc_attr($invoice->get_created_date());
195
+				$date      = getpaid_format_date_value($date_time);
196 196
 				echo "<span title='$date_time'>$date</span>";
197 197
 				break;
198 198
 
199 199
 			case 'amount' :
200 200
 
201 201
 				$amount = $invoice->get_total();
202
-				$formated_amount = wpinv_price( wpinv_format_amount( $amount ), $invoice->get_currency() );
202
+				$formated_amount = wpinv_price(wpinv_format_amount($amount), $invoice->get_currency());
203 203
 
204
-				if ( $invoice->is_refunded() ) {
205
-					$refunded_amount = wpinv_price( wpinv_format_amount( 0 ), $invoice->get_currency() );
204
+				if ($invoice->is_refunded()) {
205
+					$refunded_amount = wpinv_price(wpinv_format_amount(0), $invoice->get_currency());
206 206
 					echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
207 207
 				} else {
208 208
 
209 209
 					$discount = $invoice->get_total_discount();
210 210
 
211
-					if ( ! empty( $discount ) ) {
212
-						$new_amount = wpinv_price( wpinv_format_amount( $amount + $discount ), $invoice->get_currency() );
211
+					if (!empty($discount)) {
212
+						$new_amount = wpinv_price(wpinv_format_amount($amount + $discount), $invoice->get_currency());
213 213
 						echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
214 214
 					} else {
215 215
 						echo $formated_amount;
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 				break;
221 221
 
222 222
 			case 'status' :
223
-				$status       = sanitize_text_field( $invoice->get_status() );
224
-				$status_label = sanitize_text_field( $invoice->get_status_nicename() );
223
+				$status       = sanitize_text_field($invoice->get_status());
224
+				$status_label = sanitize_text_field($invoice->get_status_nicename());
225 225
 
226 226
 				// If it is paid, show the gateway title.
227
-				if ( $invoice->is_paid() ) {
228
-					$gateway = sanitize_text_field( $invoice->get_gateway_title() );
229
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
227
+				if ($invoice->is_paid()) {
228
+					$gateway = sanitize_text_field($invoice->get_gateway_title());
229
+					$gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), $gateway);
230 230
 
231 231
 					echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
232 232
 				} else {
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 				}
235 235
 
236 236
 				// If it is not paid, display the overdue and view status.
237
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
237
+				if (!$invoice->is_paid() && !$invoice->is_refunded()) {
238 238
 
239 239
 					// Invoice view status.
240
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
241
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
240
+					if (wpinv_is_invoice_viewed($invoice->get_id())) {
241
+						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>';
242 242
 					} else {
243
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
243
+						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>';
244 244
 					}
245 245
 
246 246
 					// Display the overview status.
247
-					if ( wpinv_get_option( 'overdue_active' ) ) {
247
+					if (wpinv_get_option('overdue_active')) {
248 248
 						$due_date = $invoice->get_due_date();
249
-						$fomatted = getpaid_format_date( $due_date );
249
+						$fomatted = getpaid_format_date($due_date);
250 250
 
251
-						if ( ! empty( $fomatted ) ) {
252
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
251
+						if (!empty($fomatted)) {
252
+							$date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted);
253 253
 							echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
254 254
 						}
255 255
 					}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 			case 'recurring':
262 262
 
263
-				if ( $invoice->is_recurring() ) {
263
+				if ($invoice->is_recurring()) {
264 264
 					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
265 265
 				} else {
266 266
 					echo '<i class="fa fa-times" style="color:#616161;"></i>';
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
 
270 270
 			case 'number' :
271 271
 
272
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
273
-				$invoice_number  = sanitize_text_field( $invoice->get_number() );
274
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
272
+				$edit_link       = esc_url(get_edit_post_link($invoice->get_id()));
273
+				$invoice_number  = sanitize_text_field($invoice->get_number());
274
+				$invoice_details = esc_attr__('View Invoice Details', 'invoicing');
275 275
 
276 276
 				echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
277 277
 
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 	
282 282
 				$customer_name = $invoice->get_user_full_name();
283 283
 	
284
-				if ( empty( $customer_name ) ) {
284
+				if (empty($customer_name)) {
285 285
 					$customer_name = $invoice->get_email();
286 286
 				}
287 287
 	
288
-				if ( ! empty( $customer_name ) ) {
289
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
290
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
288
+				if (!empty($customer_name)) {
289
+					$customer_details = esc_attr__('View Customer Details', 'invoicing');
290
+					$view_link        = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php')));
291 291
 					echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
292 292
 				} else {
293 293
 					echo '<div>&mdash;</div>';
@@ -302,50 +302,50 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * Returns an array of payment forms table columns.
304 304
 	 */
305
-	public static function payment_form_columns( $columns ) {
305
+	public static function payment_form_columns($columns) {
306 306
 
307 307
 		$columns = array(
308 308
 			'cb'                => $columns['cb'],
309
-			'title'             => __( 'Name', 'invoicing' ),
310
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
311
-			'earnings'          => __( 'Revenue', 'invoicing' ),
312
-			'refunds'           => __( 'Refunded', 'invoicing' ),
313
-			'items'             => __( 'Items', 'invoicing' ),
314
-			'date'              => __( 'Date', 'invoicing' ),
309
+			'title'             => __('Name', 'invoicing'),
310
+			'shortcode'         => __('Shortcode', 'invoicing'),
311
+			'earnings'          => __('Revenue', 'invoicing'),
312
+			'refunds'           => __('Refunded', 'invoicing'),
313
+			'items'             => __('Items', 'invoicing'),
314
+			'date'              => __('Date', 'invoicing'),
315 315
 		);
316 316
 
317
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
317
+		return apply_filters('wpi_payment_form_table_columns', $columns);
318 318
 
319 319
 	}
320 320
 
321 321
 	/**
322 322
 	 * Displays payment form table columns.
323 323
 	 */
324
-	public static function display_payment_form_columns( $column_name, $post_id ) {
324
+	public static function display_payment_form_columns($column_name, $post_id) {
325 325
 
326 326
 		// Retrieve the payment form.
327
-		$form = new GetPaid_Payment_Form( $post_id );
327
+		$form = new GetPaid_Payment_Form($post_id);
328 328
 
329
-		switch ( $column_name ) {
329
+		switch ($column_name) {
330 330
 
331 331
 			case 'earnings' :
332
-				echo wpinv_price( wpinv_format_amount( $form->get_earned() ) );
332
+				echo wpinv_price(wpinv_format_amount($form->get_earned()));
333 333
 				break;
334 334
 
335 335
 			case 'refunds' :
336
-				echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
336
+				echo wpinv_price(wpinv_format_amount($form->get_refunded()));
337 337
 				break;
338 338
 
339 339
 			case 'refunds' :
340
-				echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) );
340
+				echo wpinv_price(wpinv_format_amount($form->get_refunded()));
341 341
 				break;
342 342
 
343 343
 			case 'shortcode' :
344 344
 
345
-				if ( $form->is_default() ) {
345
+				if ($form->is_default()) {
346 346
 					echo '&mdash;';
347 347
 				} else {
348
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
348
+					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>';
349 349
 				}
350 350
 
351 351
 				break;
@@ -354,29 +354,29 @@  discard block
 block discarded – undo
354 354
 
355 355
 				$items = $form->get_items();
356 356
 
357
-				if ( $form->is_default() || empty( $items ) ) {
357
+				if ($form->is_default() || empty($items)) {
358 358
 					echo '&mdash;';
359 359
 					return;
360 360
 				}
361 361
 
362 362
 				$_items = array();
363 363
 
364
-				foreach ( $items as $item ) {
364
+				foreach ($items as $item) {
365 365
 					$url = $item->get_edit_url();
366 366
 
367
-					if ( empty( $url ) ) {
368
-						$_items[] = sanitize_text_field( $item->get_name() );
367
+					if (empty($url)) {
368
+						$_items[] = sanitize_text_field($item->get_name());
369 369
 					} else {
370 370
 						$_items[] = sprintf(
371 371
 							'<a href="%s">%s</a>',
372
-							esc_url( $url ),
373
-							sanitize_text_field( $item->get_name() )
372
+							esc_url($url),
373
+							sanitize_text_field($item->get_name())
374 374
 						);
375 375
 					}
376 376
 
377 377
 				}
378 378
 
379
-				echo implode( '<br>', $_items );
379
+				echo implode('<br>', $_items);
380 380
 
381 381
 				break;
382 382
 
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 	/**
388 388
 	 * Filters post states.
389 389
 	 */
390
-	public static function filter_payment_form_state( $post_states, $post ) {
390
+	public static function filter_payment_form_state($post_states, $post) {
391 391
 
392
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
393
-			$post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
392
+		if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) {
393
+			$post_states['default_form'] = __('Default Payment Form', 'invoicing');
394 394
 		}
395 395
 	
396 396
 		return $post_states;
@@ -400,35 +400,35 @@  discard block
 block discarded – undo
400 400
 	/**
401 401
 	 * Returns an array of coupon table columns.
402 402
 	 */
403
-	public static function discount_columns( $columns ) {
403
+	public static function discount_columns($columns) {
404 404
 
405 405
 		$columns = array(
406 406
 			'cb'                => $columns['cb'],
407
-			'title'             => __( 'Name', 'invoicing' ),
408
-			'code'              => __( 'Code', 'invoicing' ),
409
-			'amount'            => __( 'Amount', 'invoicing' ),
410
-			'usage'             => __( 'Usage / Limit', 'invoicing' ),
411
-			'start_date'        => __( 'Start Date', 'invoicing' ),
412
-			'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
407
+			'title'             => __('Name', 'invoicing'),
408
+			'code'              => __('Code', 'invoicing'),
409
+			'amount'            => __('Amount', 'invoicing'),
410
+			'usage'             => __('Usage / Limit', 'invoicing'),
411
+			'start_date'        => __('Start Date', 'invoicing'),
412
+			'expiry_date'       => __('Expiry Date', 'invoicing'),
413 413
 		);
414 414
 
415
-		return apply_filters( 'wpi_discount_table_columns', $columns );
415
+		return apply_filters('wpi_discount_table_columns', $columns);
416 416
 	}
417 417
 
418 418
 	/**
419 419
 	 * Filters post states.
420 420
 	 */
421
-	public static function filter_discount_state( $post_states, $post ) {
421
+	public static function filter_discount_state($post_states, $post) {
422 422
 
423
-		if ( 'wpi_discount' == $post->post_type ) {
423
+		if ('wpi_discount' == $post->post_type) {
424 424
 
425
-			$discount = new WPInv_Discount( $post );
425
+			$discount = new WPInv_Discount($post);
426 426
 
427 427
 			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
428 428
 
429
-			if ( $status != 'publish' ) {
429
+			if ($status != 'publish') {
430 430
 				return array(
431
-					'discount_status' => wpinv_discount_status( $status ),
431
+					'discount_status' => wpinv_discount_status($status),
432 432
 				);
433 433
 			}
434 434
 
@@ -443,30 +443,30 @@  discard block
 block discarded – undo
443 443
 	/**
444 444
 	 * Returns an array of items table columns.
445 445
 	 */
446
-	public static function item_columns( $columns ) {
446
+	public static function item_columns($columns) {
447 447
 
448 448
 		$columns = array(
449 449
 			'cb'                => $columns['cb'],
450
-			'title'             => __( 'Name', 'invoicing' ),
451
-			'price'             => __( 'Price', 'invoicing' ),
452
-			'vat_rule'          => __( 'VAT rule', 'invoicing' ),
453
-			'vat_class'         => __( 'VAT class', 'invoicing' ),
454
-			'type'              => __( 'Type', 'invoicing' ),
455
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
450
+			'title'             => __('Name', 'invoicing'),
451
+			'price'             => __('Price', 'invoicing'),
452
+			'vat_rule'          => __('VAT rule', 'invoicing'),
453
+			'vat_class'         => __('VAT class', 'invoicing'),
454
+			'type'              => __('Type', 'invoicing'),
455
+			'shortcode'         => __('Shortcode', 'invoicing'),
456 456
 		);
457 457
 
458
-		if ( ! wpinv_use_taxes() ) {
459
-			unset( $columns['vat_rule'] );
460
-			unset( $columns['vat_class'] );
458
+		if (!wpinv_use_taxes()) {
459
+			unset($columns['vat_rule']);
460
+			unset($columns['vat_class']);
461 461
 		}
462 462
 
463
-		return apply_filters( 'wpi_item_table_columns', $columns );
463
+		return apply_filters('wpi_item_table_columns', $columns);
464 464
 	}
465 465
 
466 466
 	/**
467 467
 	 * Returns an array of sortable items table columns.
468 468
 	 */
469
-	public static function sortable_item_columns( $columns ) {
469
+	public static function sortable_item_columns($columns) {
470 470
 
471 471
 		return array_merge(
472 472
 			$columns,
@@ -483,49 +483,49 @@  discard block
 block discarded – undo
483 483
 	/**
484 484
 	 * Displays items table columns.
485 485
 	 */
486
-	public static function display_item_columns( $column_name, $post_id ) {
486
+	public static function display_item_columns($column_name, $post_id) {
487 487
  
488
-		$item = new WPInv_Item( $post_id );
488
+		$item = new WPInv_Item($post_id);
489 489
 
490
-		switch ( $column_name ) {
490
+		switch ($column_name) {
491 491
 
492 492
 			case 'price' :
493 493
 
494
-				if ( ! $item->is_recurring() ) {
494
+				if (!$item->is_recurring()) {
495 495
 					echo $item->get_the_price();
496 496
 					break;
497 497
 				}
498 498
 
499 499
 				$price = wp_sprintf(
500
-					__( '%s / %s', 'invoicing' ),
500
+					__('%s / %s', 'invoicing'),
501 501
 					$item->get_the_price(),
502
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
502
+					getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '')
503 503
 				);
504 504
 
505
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
505
+				if ($item->get_the_price() == $item->get_the_initial_price()) {
506 506
 					echo $price;
507 507
 					break;
508 508
 				}
509 509
 
510 510
 				echo $item->get_the_initial_price();
511 511
 
512
-				echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
512
+				echo '<span class="meta">' . wp_sprintf(__('then %s', 'invoicing'), $price) . '</span>';
513 513
 				break;
514 514
 
515 515
 			case 'vat_rule' :
516
-				echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
516
+				echo getpaid_get_tax_rule_label($item->get_vat_rule());
517 517
 				break;
518 518
 
519 519
 			case 'vat_class' :
520
-				echo getpaid_get_tax_class_label( $item->get_vat_class() );
520
+				echo getpaid_get_tax_class_label($item->get_vat_class());
521 521
 				break;
522 522
 
523 523
 			case 'shortcode' :
524
-				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
524
+				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
525 525
 				break;
526 526
 
527 527
 			case 'type' :
528
-				echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
528
+				echo wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
529 529
 				break;
530 530
 
531 531
 		}
@@ -535,21 +535,21 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * Lets users filter items using taxes.
537 537
 	 */
538
-	public static function add_item_filters( $post_type ) {
538
+	public static function add_item_filters($post_type) {
539 539
 
540 540
 		// Abort if we're not dealing with items.
541
-		if ( $post_type != 'wpi_item' ) {
541
+		if ($post_type != 'wpi_item') {
542 542
 			return;
543 543
 		}
544 544
 
545 545
 		// Filter by vat rules.
546
-		if ( wpinv_use_taxes() ) {
546
+		if (wpinv_use_taxes()) {
547 547
 	
548 548
 			// Sanitize selected vat rule.
549 549
 			$vat_rule   = '';
550 550
 			$vat_rules  = getpaid_get_tax_rules();
551
-			if ( isset( $_GET['vat_rule'] ) ) {
552
-				$vat_rule   =  $_GET['vat_rule'];
551
+			if (isset($_GET['vat_rule'])) {
552
+				$vat_rule = $_GET['vat_rule'];
553 553
 			}
554 554
 
555 555
 			// Filter by VAT rule.
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 				array(
558 558
 					'options'          => array_merge(
559 559
 						array(
560
-							'' => __( 'All VAT rules', 'invoicing' )
560
+							'' => __('All VAT rules', 'invoicing')
561 561
 						),
562 562
 						$vat_rules
563 563
 					),
564 564
 					'name'             => 'vat_rule',
565 565
 					'id'               => 'vat_rule',
566
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
566
+					'selected'         => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '',
567 567
 					'show_option_all'  => false,
568 568
 					'show_option_none' => false,
569 569
 				)
@@ -574,21 +574,21 @@  discard block
 block discarded – undo
574 574
 			// Sanitize selected vat rule.
575 575
 			$vat_class   = '';
576 576
 			$vat_classes = getpaid_get_tax_classes();
577
-			if ( isset( $_GET['vat_class'] ) ) {
578
-				$vat_class   =  $_GET['vat_class'];
577
+			if (isset($_GET['vat_class'])) {
578
+				$vat_class = $_GET['vat_class'];
579 579
 			}
580 580
 
581 581
 			echo wpinv_html_select(
582 582
 				array(
583 583
 					'options'          => array_merge(
584 584
 						array(
585
-							'' => __( 'All VAT classes', 'invoicing' )
585
+							'' => __('All VAT classes', 'invoicing')
586 586
 						),
587 587
 						$vat_classes
588 588
 					),
589 589
 					'name'             => 'vat_class',
590 590
 					'id'               => 'vat_class',
591
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
591
+					'selected'         => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '',
592 592
 					'show_option_all'  => false,
593 593
 					'show_option_none' => false,
594 594
 				)
@@ -597,22 +597,22 @@  discard block
 block discarded – undo
597 597
 		}
598 598
 
599 599
 		// Filter by item type.
600
-		$type   = '';
601
-		if ( isset( $_GET['type'] ) ) {
602
-			$type   =  $_GET['type'];
600
+		$type = '';
601
+		if (isset($_GET['type'])) {
602
+			$type = $_GET['type'];
603 603
 		}
604 604
 
605 605
 		echo wpinv_html_select(
606 606
 			array(
607 607
 				'options'          => array_merge(
608 608
 					array(
609
-						'' => __( 'All item types', 'invoicing' )
609
+						'' => __('All item types', 'invoicing')
610 610
 					),
611 611
 					wpinv_get_item_types()
612 612
 				),
613 613
 				'name'             => 'type',
614 614
 				'id'               => 'type',
615
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
615
+				'selected'         => in_array($type, wpinv_item_types()) ? $type : '',
616 616
 				'show_option_all'  => false,
617 617
 				'show_option_none' => false,
618 618
 			)
@@ -623,45 +623,45 @@  discard block
 block discarded – undo
623 623
 	/**
624 624
 	 * Filters the item query.
625 625
 	 */
626
-	public static function filter_item_query( $query ) {
626
+	public static function filter_item_query($query) {
627 627
 
628 628
 		// modify the query only if it admin and main query.
629
-		if ( ! ( is_admin() && $query->is_main_query() ) ){ 
629
+		if (!(is_admin() && $query->is_main_query())) { 
630 630
 			return $query;
631 631
 		}
632 632
 
633 633
 		// we want to modify the query for our items.
634
-		if ( 'wpi_item' != $query->query['post_type'] ){
634
+		if ('wpi_item' != $query->query['post_type']) {
635 635
 			return $query;
636 636
 		}
637 637
 
638
-		if ( empty( $query->query_vars['meta_query'] ) ) {
638
+		if (empty($query->query_vars['meta_query'])) {
639 639
 			$query->query_vars['meta_query'] = array();
640 640
 		}
641 641
 
642 642
 		// Filter vat rule type
643
-        if ( ! empty( $_GET['vat_rule'] ) ) {
643
+        if (!empty($_GET['vat_rule'])) {
644 644
             $query->query_vars['meta_query'][] = array(
645 645
                 'key'     => '_wpinv_vat_rule',
646
-                'value'   => sanitize_text_field( $_GET['vat_rule'] ),
646
+                'value'   => sanitize_text_field($_GET['vat_rule']),
647 647
                 'compare' => '='
648 648
             );
649 649
         }
650 650
 
651 651
         // Filter vat class
652
-        if ( ! empty( $_GET['vat_class'] ) ) {
652
+        if (!empty($_GET['vat_class'])) {
653 653
             $query->query_vars['meta_query'][] = array(
654 654
                 'key'     => '_wpinv_vat_class',
655
-                'value'   => sanitize_text_field( $_GET['vat_class'] ),
655
+                'value'   => sanitize_text_field($_GET['vat_class']),
656 656
                 'compare' => '='
657 657
             );
658 658
         }
659 659
 
660 660
         // Filter item type
661
-        if ( ! empty( $_GET['type'] ) ) {
661
+        if (!empty($_GET['type'])) {
662 662
             $query->query_vars['meta_query'][] = array(
663 663
                 'key'     => '_wpinv_type',
664
-                'value'   => sanitize_text_field( $_GET['type'] ),
664
+                'value'   => sanitize_text_field($_GET['type']),
665 665
                 'compare' => '='
666 666
             );
667 667
 		}
@@ -671,15 +671,15 @@  discard block
 block discarded – undo
671 671
 	/**
672 672
 	 * Reorders items.
673 673
 	 */
674
-	public static function reorder_items( $vars ) {
674
+	public static function reorder_items($vars) {
675 675
 		global $typenow;
676 676
 
677
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
677
+		if ('wpi_item' !== $typenow || empty($vars['orderby'])) {
678 678
 			return $vars;
679 679
 		}
680 680
 
681 681
 		// By item type.
682
-		if ( 'type' == $vars['orderby'] ) {
682
+		if ('type' == $vars['orderby']) {
683 683
 			return array_merge(
684 684
 				$vars,
685 685
 				array(
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 		}
691 691
 
692 692
 		// By vat class.
693
-		if ( 'vat_class' == $vars['orderby'] ) {
693
+		if ('vat_class' == $vars['orderby']) {
694 694
 			return array_merge(
695 695
 				$vars,
696 696
 				array(
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		}
702 702
 
703 703
 		// By vat rule.
704
-		if ( 'vat_rule' == $vars['orderby'] ) {
704
+		if ('vat_rule' == $vars['orderby']) {
705 705
 			return array_merge(
706 706
 				$vars,
707 707
 				array(
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		}
713 713
 
714 714
 		// By price.
715
-		if ( 'price' == $vars['orderby'] ) {
715
+		if ('price' == $vars['orderby']) {
716 716
 			return array_merge(
717 717
 				$vars,
718 718
 				array(
@@ -729,27 +729,27 @@  discard block
 block discarded – undo
729 729
 	/**
730 730
 	 * Fired when deleting a post.
731 731
 	 */
732
-	public static function delete_post( $post_id ) {
732
+	public static function delete_post($post_id) {
733 733
 
734
-		switch ( get_post_type( $post_id ) ) {
734
+		switch (get_post_type($post_id)) {
735 735
 
736 736
 			case 'wpi_item' :
737
-				do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
737
+				do_action("getpaid_before_delete_item", new WPInv_Item($post_id));
738 738
 				break;
739 739
 
740 740
 			case 'wpi_payment_form' :
741
-				do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
741
+				do_action("getpaid_before_delete_payment_form", new GetPaid_Payment_Form($post_id));
742 742
 				break;
743 743
 
744 744
 			case 'wpi_discount' :
745
-				do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
745
+				do_action("getpaid_before_delete_discount", new WPInv_Discount($post_id));
746 746
 				break;
747 747
 
748 748
 			case 'wpi_invoice' :
749
-				$invoice = new WPInv_Invoice( $post_id );
750
-				do_action( "getpaid_before_delete_invoice", $invoice );
751
-				$invoice->get_data_store()->delete_items( $invoice );
752
-				$invoice->get_data_store()->delete_special_fields( $invoice );
749
+				$invoice = new WPInv_Invoice($post_id);
750
+				do_action("getpaid_before_delete_invoice", $invoice);
751
+				$invoice->get_data_store()->delete_items($invoice);
752
+				$invoice->get_data_store()->delete_special_fields($invoice);
753 753
 				break;
754 754
 		}
755 755
 	}
Please login to merge, or discard this patch.
vendor/composer/InstalledVersions.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 class InstalledVersions
13 13
 {
14 14
 private static $installed = array (
15
-  'root' => 
16
-  array (
15
+    'root' => 
16
+    array (
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
@@ -21,87 +21,87 @@  discard block
 block discarded – undo
21 21
     ),
22 22
     'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567',
23 23
     'name' => 'ayecode/invoicing',
24
-  ),
25
-  'versions' => 
26
-  array (
24
+    ),
25
+    'versions' => 
26
+    array (
27 27
     'ayecode/ayecode-connect-helper' => 
28 28
     array (
29
-      'pretty_version' => '1.0.3',
30
-      'version' => '1.0.3.0',
31
-      'aliases' => 
32
-      array (
33
-      ),
34
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
29
+        'pretty_version' => '1.0.3',
30
+        'version' => '1.0.3.0',
31
+        'aliases' => 
32
+        array (
33
+        ),
34
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37 37
     array (
38
-      'pretty_version' => 'dev-master',
39
-      'version' => 'dev-master',
40
-      'aliases' => 
41
-      array (
42
-      ),
43
-      'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567',
38
+        'pretty_version' => 'dev-master',
39
+        'version' => 'dev-master',
40
+        'aliases' => 
41
+        array (
42
+        ),
43
+        'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46 46
     array (
47
-      'pretty_version' => '0.1.36',
48
-      'version' => '0.1.36.0',
49
-      'aliases' => 
50
-      array (
51
-      ),
52
-      'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b',
47
+        'pretty_version' => '0.1.36',
48
+        'version' => '0.1.36.0',
49
+        'aliases' => 
50
+        array (
51
+        ),
52
+        'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b',
53 53
     ),
54 54
     'ayecode/wp-font-awesome-settings' => 
55 55
     array (
56
-      'pretty_version' => '1.0.12',
57
-      'version' => '1.0.12.0',
58
-      'aliases' => 
59
-      array (
60
-      ),
61
-      'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
56
+        'pretty_version' => '1.0.12',
57
+        'version' => '1.0.12.0',
58
+        'aliases' => 
59
+        array (
60
+        ),
61
+        'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
62 62
     ),
63 63
     'ayecode/wp-super-duper' => 
64 64
     array (
65
-      'pretty_version' => '1.0.22',
66
-      'version' => '1.0.22.0',
67
-      'aliases' => 
68
-      array (
69
-      ),
70
-      'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac',
65
+        'pretty_version' => '1.0.22',
66
+        'version' => '1.0.22.0',
67
+        'aliases' => 
68
+        array (
69
+        ),
70
+        'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac',
71 71
     ),
72 72
     'composer/installers' => 
73 73
     array (
74
-      'pretty_version' => 'v1.9.0',
75
-      'version' => '1.9.0.0',
76
-      'aliases' => 
77
-      array (
78
-      ),
79
-      'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
74
+        'pretty_version' => 'v1.9.0',
75
+        'version' => '1.9.0.0',
76
+        'aliases' => 
77
+        array (
78
+        ),
79
+        'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
80 80
     ),
81 81
     'maxmind-db/reader' => 
82 82
     array (
83
-      'pretty_version' => 'v1.6.0',
84
-      'version' => '1.6.0.0',
85
-      'aliases' => 
86
-      array (
87
-      ),
88
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
83
+        'pretty_version' => 'v1.6.0',
84
+        'version' => '1.6.0.0',
85
+        'aliases' => 
86
+        array (
87
+        ),
88
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
89 89
     ),
90 90
     'roundcube/plugin-installer' => 
91 91
     array (
92
-      'replaced' => 
93
-      array (
92
+        'replaced' => 
93
+        array (
94 94
         0 => '*',
95
-      ),
95
+        ),
96 96
     ),
97 97
     'shama/baton' => 
98 98
     array (
99
-      'replaced' => 
100
-      array (
99
+        'replaced' => 
100
+        array (
101 101
         0 => '*',
102
-      ),
102
+        ),
103
+    ),
103 104
     ),
104
-  ),
105 105
 );
106 106
 
107 107
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,93 +11,93 @@
 block discarded – undo
11 11
 
12 12
 class InstalledVersions
13 13
 {
14
-private static $installed = array (
14
+private static $installed = array(
15 15
   'root' => 
16
-  array (
16
+  array(
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
20
-    array (
20
+    array(
21 21
     ),
22 22
     'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567',
23 23
     'name' => 'ayecode/invoicing',
24 24
   ),
25 25
   'versions' => 
26
-  array (
26
+  array(
27 27
     'ayecode/ayecode-connect-helper' => 
28
-    array (
28
+    array(
29 29
       'pretty_version' => '1.0.3',
30 30
       'version' => '1.0.3.0',
31 31
       'aliases' => 
32
-      array (
32
+      array(
33 33
       ),
34 34
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37
-    array (
37
+    array(
38 38
       'pretty_version' => 'dev-master',
39 39
       'version' => 'dev-master',
40 40
       'aliases' => 
41
-      array (
41
+      array(
42 42
       ),
43 43
       'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46
-    array (
46
+    array(
47 47
       'pretty_version' => '0.1.36',
48 48
       'version' => '0.1.36.0',
49 49
       'aliases' => 
50
-      array (
50
+      array(
51 51
       ),
52 52
       'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b',
53 53
     ),
54 54
     'ayecode/wp-font-awesome-settings' => 
55
-    array (
55
+    array(
56 56
       'pretty_version' => '1.0.12',
57 57
       'version' => '1.0.12.0',
58 58
       'aliases' => 
59
-      array (
59
+      array(
60 60
       ),
61 61
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
62 62
     ),
63 63
     'ayecode/wp-super-duper' => 
64
-    array (
64
+    array(
65 65
       'pretty_version' => '1.0.22',
66 66
       'version' => '1.0.22.0',
67 67
       'aliases' => 
68
-      array (
68
+      array(
69 69
       ),
70 70
       'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac',
71 71
     ),
72 72
     'composer/installers' => 
73
-    array (
73
+    array(
74 74
       'pretty_version' => 'v1.9.0',
75 75
       'version' => '1.9.0.0',
76 76
       'aliases' => 
77
-      array (
77
+      array(
78 78
       ),
79 79
       'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
80 80
     ),
81 81
     'maxmind-db/reader' => 
82
-    array (
82
+    array(
83 83
       'pretty_version' => 'v1.6.0',
84 84
       'version' => '1.6.0.0',
85 85
       'aliases' => 
86
-      array (
86
+      array(
87 87
       ),
88 88
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
89 89
     ),
90 90
     'roundcube/plugin-installer' => 
91
-    array (
91
+    array(
92 92
       'replaced' => 
93
-      array (
93
+      array(
94 94
         0 => '*',
95 95
       ),
96 96
     ),
97 97
     'shama/baton' => 
98
-    array (
98
+    array(
99 99
       'replaced' => 
100
-      array (
100
+      array(
101 101
         0 => '*',
102 102
       ),
103 103
     ),
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
11 11
         'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php',
12 12
     );
13 13
 
14
-    public static $prefixLengthsPsr4 = array (
14
+    public static $prefixLengthsPsr4 = array(
15 15
         'M' => 
16
-        array (
16
+        array(
17 17
             'MaxMind\\Db\\' => 11,
18 18
         ),
19 19
         'C' => 
20
-        array (
20
+        array(
21 21
             'Composer\\Installers\\' => 20,
22 22
         ),
23 23
     );
24 24
 
25
-    public static $prefixDirsPsr4 = array (
25
+    public static $prefixDirsPsr4 = array(
26 26
         'MaxMind\\Db\\' => 
27
-        array (
27
+        array(
28 28
             0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
29 29
         ),
30 30
         'Composer\\Installers\\' => 
31
-        array (
31
+        array(
32 32
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
33 33
         ),
34 34
     );
35 35
 
36
-    public static $classMap = array (
36
+    public static $classMap = array(
37 37
         'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php',
38 38
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
39 39
         'WP_Super_Duper' => __DIR__ . '/..' . '/ayecode/wp-super-duper/wp-super-duper.php',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public static function getInitializer(ClassLoader $loader)
43 43
     {
44
-        return \Closure::bind(function () use ($loader) {
44
+        return \Closure::bind(function() use ($loader) {
45 45
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
46 46
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
47 47
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.