Passed
Pull Request — master (#785)
by
unknown
05:12
created
includes/payments/class-getpaid-payment-form-submission-taxes.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -12,257 +12,257 @@
 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();
20
-
21
-	/**
22
-	 * Whether or not we should skip the taxes.
23
-	 * @var bool
24
-	 */
25
-	protected $skip_taxes = false;
15
+    /**
16
+     * Submission taxes.
17
+     * @var array
18
+     */
19
+    public $taxes = array();
20
+
21
+    /**
22
+     * Whether or not we should skip the taxes.
23
+     * @var bool
24
+     */
25
+    protected $skip_taxes = false;
26
+
27
+    /**
28
+     * Class constructor
29
+     *
30
+     * @param GetPaid_Payment_Form_Submission $submission
31
+     */
32
+    public function __construct( $submission ) {
33
+        // Validate VAT number.
34
+        $this->validate_vat( $submission );
35
+
36
+        if ( $this->skip_taxes ) {
37
+            return;
38
+        }
39
+
40
+        foreach ( $submission->get_items() as $item ) {
41
+            $this->process_item_tax( $item, $submission );
42
+        }
43
+
44
+        // Process any existing invoice taxes.
45
+        if ( $submission->has_invoice() ) {
46
+            $invoice = $submission->get_invoice();
47
+            $invoice = $this->refresh_totals( $invoice, $submission );
48
+
49
+            $this->taxes = array_replace( $invoice->get_taxes(), $this->taxes );
50
+        }
51
+    }
52
+
53
+    /**
54
+     * Maybe process tax.
55
+     *
56
+     * @since 1.0.19
57
+     * @param GetPaid_Form_Item $item
58
+     * @param GetPaid_Payment_Form_Submission $submission
59
+     */
60
+    public function process_item_tax( $item, $submission ) {
61
+
62
+        $rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
63
+        $rates    = getpaid_filter_item_tax_rates( $item, $rates );
64
+        $taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
65
+        $r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
66
+
67
+        foreach ( $taxes as $name => $amount ) {
68
+            $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
69
+            $tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
70
+
71
+            $item->item_tax += wpinv_sanitize_amount( $tax['initial_tax'] );
72
+
73
+            if ( ! isset( $this->taxes[ $name ] ) ) {
74
+                $this->taxes[ $name ] = $tax;
75
+                continue;
76
+            }
77
+
78
+            $this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
79
+            $this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
80
+
81
+        }
82
+
83
+    }
26 84
 
27 85
     /**
28
-	 * Class constructor
29
-	 *
30
-	 * @param GetPaid_Payment_Form_Submission $submission
31
-	 */
32
-	public function __construct( $submission ) {
33
-		// Validate VAT number.
34
-		$this->validate_vat( $submission );
35
-
36
-		if ( $this->skip_taxes ) {
37
-			return;
38
-		}
39
-
40
-		foreach ( $submission->get_items() as $item ) {
41
-			$this->process_item_tax( $item, $submission );
42
-		}
43
-
44
-		// Process any existing invoice taxes.
45
-		if ( $submission->has_invoice() ) {
46
-			$invoice = $submission->get_invoice();
47
-			$invoice = $this->refresh_totals( $invoice, $submission );
48
-
49
-			$this->taxes = array_replace( $invoice->get_taxes(), $this->taxes );
50
-		}
51
-	}
52
-
53
-	/**
54
-	 * Maybe process tax.
55
-	 *
56
-	 * @since 1.0.19
57
-	 * @param GetPaid_Form_Item $item
58
-	 * @param GetPaid_Payment_Form_Submission $submission
59
-	 */
60
-	public function process_item_tax( $item, $submission ) {
61
-
62
-		$rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
63
-		$rates    = getpaid_filter_item_tax_rates( $item, $rates );
64
-		$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
65
-		$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
66
-
67
-		foreach ( $taxes as $name => $amount ) {
68
-			$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
69
-			$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
70
-
71
-			$item->item_tax += wpinv_sanitize_amount( $tax['initial_tax'] );
72
-
73
-			if ( ! isset( $this->taxes[ $name ] ) ) {
74
-				$this->taxes[ $name ] = $tax;
75
-				continue;
76
-			}
77
-
78
-			$this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
79
-			$this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
80
-
81
-		}
82
-
83
-	}
84
-
85
-	/**
86
-	 * Checks if the submission has a digital item.
87
-	 *
88
-	 * @param GetPaid_Payment_Form_Submission $submission
89
-	 * @since 1.0.19
90
-	 * @return bool
91
-	 */
92
-	public function has_digital_item( $submission ) {
93
-
94
-		foreach ( $submission->get_items() as $item ) {
95
-
96
-			if ( 'digital' == $item->get_vat_rule() ) {
97
-				return true;
98
-			}
86
+     * Checks if the submission has a digital item.
87
+     *
88
+     * @param GetPaid_Payment_Form_Submission $submission
89
+     * @since 1.0.19
90
+     * @return bool
91
+     */
92
+    public function has_digital_item( $submission ) {
93
+
94
+        foreach ( $submission->get_items() as $item ) {
95
+
96
+            if ( 'digital' == $item->get_vat_rule() ) {
97
+                return true;
98
+            }
99 99
 }
100 100
 
101
-		return false;
102
-	}
103
-
104
-	/**
105
-	 * Checks if this is an eu store.
106
-	 *
107
-	 * @since 1.0.19
108
-	 * @return bool
109
-	 */
110
-	public static function is_eu_store() {
111
-		return self::is_eu_country( wpinv_get_default_country() );
112
-	}
113
-
114
-	/**
115
-	 * Checks if this is an eu country.
116
-	 *
117
-	 * @param string $country
118
-	 * @since 1.0.19
119
-	 * @return bool
120
-	 */
121
-	public static function is_eu_country( $country ) {
122
-		return getpaid_is_eu_state( $country );
123
-	}
124
-
125
-	/**
126
-	 * Checks if this is an eu purchase.
127
-	 *
128
-	 * @param string $customer_country
129
-	 * @since 1.0.19
130
-	 * @return bool
131
-	 */
132
-	public static function is_eu_transaction( $customer_country ) {
133
-		return self::is_eu_country( $customer_country ) && self::is_eu_store();
134
-	}
135
-
136
-	/**
137
-	 * Retrieves the vat number.
138
-	 *
139
-	 * @param GetPaid_Payment_Form_Submission $submission
140
-	 * @since 1.0.19
141
-	 * @return string
142
-	 */
143
-	public function get_vat_number( $submission ) {
144
-
145
-		// Retrieve from the posted number.
146
-		$vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
147
-		if ( ! is_null( $vat_number ) ) {
148
-			return wpinv_clean( $vat_number );
149
-		}
150
-
151
-		return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
152
-	}
153
-
154
-	/**
155
-	 * Retrieves the company.
156
-	 *
157
-	 * @param GetPaid_Payment_Form_Submission $submission
158
-	 * @since 1.0.19
159
-	 * @return string
160
-	 */
161
-	public function get_company( $submission ) {
162
-
163
-		// Retrieve from the posted data.
164
-		$company = $submission->get_field( 'wpinv_company', 'billing' );
165
-		if ( ! empty( $company ) ) {
166
-			return wpinv_clean( $company );
167
-		}
168
-
169
-		// Retrieve from the invoice.
170
-		return $submission->has_invoice() ? $submission->get_invoice()->get_company() : '';
171
-	}
172
-
173
-	/**
174
-	 * Checks if we require a VAT number.
175
-	 *
176
-	 * @param bool $ip_in_eu Whether the customer IP is from the EU
177
-	 * @param bool $country_in_eu Whether the customer country is from the EU
178
-	 * @since 1.0.19
179
-	 * @return string
180
-	 */
181
-	public function requires_vat( $ip_in_eu, $country_in_eu ) {
182
-
183
-		$prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
184
-		$prevent_b2c = ! empty( $prevent_b2c );
185
-		$is_eu       = $ip_in_eu || $country_in_eu;
186
-
187
-		return $prevent_b2c && $is_eu;
188
-	}
189
-
190
-	/**
191
-	 * Validate VAT data.
192
-	 *
193
-	 * @param GetPaid_Payment_Form_Submission $submission
194
-	 * @since 1.0.19
195
-	 */
196
-	public function validate_vat( $submission ) {
197
-
198
-		$in_eu = $this->is_eu_transaction( $submission->country );
199
-
200
-		// Abort if we are not validating vat numbers.
201
-		if ( ! $in_eu ) {
101
+        return false;
102
+    }
103
+
104
+    /**
105
+     * Checks if this is an eu store.
106
+     *
107
+     * @since 1.0.19
108
+     * @return bool
109
+     */
110
+    public static function is_eu_store() {
111
+        return self::is_eu_country( wpinv_get_default_country() );
112
+    }
113
+
114
+    /**
115
+     * Checks if this is an eu country.
116
+     *
117
+     * @param string $country
118
+     * @since 1.0.19
119
+     * @return bool
120
+     */
121
+    public static function is_eu_country( $country ) {
122
+        return getpaid_is_eu_state( $country );
123
+    }
124
+
125
+    /**
126
+     * Checks if this is an eu purchase.
127
+     *
128
+     * @param string $customer_country
129
+     * @since 1.0.19
130
+     * @return bool
131
+     */
132
+    public static function is_eu_transaction( $customer_country ) {
133
+        return self::is_eu_country( $customer_country ) && self::is_eu_store();
134
+    }
135
+
136
+    /**
137
+     * Retrieves the vat number.
138
+     *
139
+     * @param GetPaid_Payment_Form_Submission $submission
140
+     * @since 1.0.19
141
+     * @return string
142
+     */
143
+    public function get_vat_number( $submission ) {
144
+
145
+        // Retrieve from the posted number.
146
+        $vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
147
+        if ( ! is_null( $vat_number ) ) {
148
+            return wpinv_clean( $vat_number );
149
+        }
150
+
151
+        return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
152
+    }
153
+
154
+    /**
155
+     * Retrieves the company.
156
+     *
157
+     * @param GetPaid_Payment_Form_Submission $submission
158
+     * @since 1.0.19
159
+     * @return string
160
+     */
161
+    public function get_company( $submission ) {
162
+
163
+        // Retrieve from the posted data.
164
+        $company = $submission->get_field( 'wpinv_company', 'billing' );
165
+        if ( ! empty( $company ) ) {
166
+            return wpinv_clean( $company );
167
+        }
168
+
169
+        // Retrieve from the invoice.
170
+        return $submission->has_invoice() ? $submission->get_invoice()->get_company() : '';
171
+    }
172
+
173
+    /**
174
+     * Checks if we require a VAT number.
175
+     *
176
+     * @param bool $ip_in_eu Whether the customer IP is from the EU
177
+     * @param bool $country_in_eu Whether the customer country is from the EU
178
+     * @since 1.0.19
179
+     * @return string
180
+     */
181
+    public function requires_vat( $ip_in_eu, $country_in_eu ) {
182
+
183
+        $prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
184
+        $prevent_b2c = ! empty( $prevent_b2c );
185
+        $is_eu       = $ip_in_eu || $country_in_eu;
186
+
187
+        return $prevent_b2c && $is_eu;
188
+    }
189
+
190
+    /**
191
+     * Validate VAT data.
192
+     *
193
+     * @param GetPaid_Payment_Form_Submission $submission
194
+     * @since 1.0.19
195
+     */
196
+    public function validate_vat( $submission ) {
197
+
198
+        $in_eu = $this->is_eu_transaction( $submission->country );
199
+
200
+        // Abort if we are not validating vat numbers.
201
+        if ( ! $in_eu ) {
202 202
             return;
203
-		}
203
+        }
204 204
 
205
-		// Prepare variables.
206
-		$vat_number  = $this->get_vat_number( $submission );
207
-		$ip_country  = getpaid_get_ip_country();
205
+        // Prepare variables.
206
+        $vat_number  = $this->get_vat_number( $submission );
207
+        $ip_country  = getpaid_get_ip_country();
208 208
         $is_eu       = $this->is_eu_country( $submission->country );
209 209
         $is_ip_eu    = $this->is_eu_country( $ip_country );
210 210
 
211
-		// Maybe abort early for initial fetches.
212
-		if ( $submission->is_initial_fetch() && empty( $vat_number ) ) {
213
-			return;
214
-		}
215
-
216
-		// If we're preventing business to consumer purchases,
217
-		if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
218
-
219
-			// Ensure that a vat number has been specified.
220
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) );
221
-
222
-		}
223
-
224
-		if ( empty( $vat_number ) ) {
225
-			return;
226
-		}
227
-
228
-		if ( wpinv_should_validate_vat_number() && ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
229
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Your VAT number is invalid', 'invoicing' ) );
230
-		}
231
-
232
-		if ( wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
233
-			return;
234
-		}
235
-
236
-		$this->skip_taxes = true;
237
-	}
238
-
239
-	 /**
240
-	 * Refresh totals if country or region changed in payment form.
241
-	 *
242
-	 * @since 2.8.8
243
-	 *
244
-	 * @param object $invoice Invoice object.
245
-	 * @param GetPaid_Payment_Form_Submission $submission Payment form submission object.
246
-	 * @return object Invoice object.
247
-	 */
248
-	public function refresh_totals( $invoice, $submission ) {
249
-		if ( ! ( ! empty( $_POST['action'] ) && ( $_POST['action'] == 'wpinv_payment_form_refresh_prices' || $_POST['action'] == 'wpinv_payment_form' ) && isset( $_POST['billing']['wpinv_country'] ) ) ) {
250
-			return $invoice;
251
-		}
252
-
253
-		if ( ! ( ! $invoice->is_paid() && ! $invoice->is_refunded() && ! $invoice->is_held() ) ) {
254
-			return $invoice;
255
-		}
256
-
257
-		// Maybe check the country, state.
258
-		if ( $submission->country != $invoice->get_country() || $submission->state != $invoice->get_state() ) {
259
-			$invoice->set_country( sanitize_text_field( $submission->country ) );
260
-			$invoice->set_state( sanitize_text_field( $submission->state ) );
261
-
262
-			// Recalculate totals.
263
-			$invoice->recalculate_total();
264
-		}
265
-
266
-		return $invoice;
267
-	}
211
+        // Maybe abort early for initial fetches.
212
+        if ( $submission->is_initial_fetch() && empty( $vat_number ) ) {
213
+            return;
214
+        }
215
+
216
+        // If we're preventing business to consumer purchases,
217
+        if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
218
+
219
+            // Ensure that a vat number has been specified.
220
+            throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) );
221
+
222
+        }
223
+
224
+        if ( empty( $vat_number ) ) {
225
+            return;
226
+        }
227
+
228
+        if ( wpinv_should_validate_vat_number() && ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
229
+            throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Your VAT number is invalid', 'invoicing' ) );
230
+        }
231
+
232
+        if ( wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
233
+            return;
234
+        }
235
+
236
+        $this->skip_taxes = true;
237
+    }
238
+
239
+        /**
240
+         * Refresh totals if country or region changed in payment form.
241
+         *
242
+         * @since 2.8.8
243
+         *
244
+         * @param object $invoice Invoice object.
245
+         * @param GetPaid_Payment_Form_Submission $submission Payment form submission object.
246
+         * @return object Invoice object.
247
+         */
248
+    public function refresh_totals( $invoice, $submission ) {
249
+        if ( ! ( ! empty( $_POST['action'] ) && ( $_POST['action'] == 'wpinv_payment_form_refresh_prices' || $_POST['action'] == 'wpinv_payment_form' ) && isset( $_POST['billing']['wpinv_country'] ) ) ) {
250
+            return $invoice;
251
+        }
252
+
253
+        if ( ! ( ! $invoice->is_paid() && ! $invoice->is_refunded() && ! $invoice->is_held() ) ) {
254
+            return $invoice;
255
+        }
256
+
257
+        // Maybe check the country, state.
258
+        if ( $submission->country != $invoice->get_country() || $submission->state != $invoice->get_state() ) {
259
+            $invoice->set_country( sanitize_text_field( $submission->country ) );
260
+            $invoice->set_state( sanitize_text_field( $submission->state ) );
261
+
262
+            // Recalculate totals.
263
+            $invoice->recalculate_total();
264
+        }
265
+
266
+        return $invoice;
267
+    }
268 268
 }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param GetPaid_Payment_Form_Submission $submission
31 31
 	 */
32
-	public function __construct( $submission ) {
32
+	public function __construct($submission) {
33 33
 		// Validate VAT number.
34
-		$this->validate_vat( $submission );
34
+		$this->validate_vat($submission);
35 35
 
36
-		if ( $this->skip_taxes ) {
36
+		if ($this->skip_taxes) {
37 37
 			return;
38 38
 		}
39 39
 
40
-		foreach ( $submission->get_items() as $item ) {
41
-			$this->process_item_tax( $item, $submission );
40
+		foreach ($submission->get_items() as $item) {
41
+			$this->process_item_tax($item, $submission);
42 42
 		}
43 43
 
44 44
 		// Process any existing invoice taxes.
45
-		if ( $submission->has_invoice() ) {
45
+		if ($submission->has_invoice()) {
46 46
 			$invoice = $submission->get_invoice();
47
-			$invoice = $this->refresh_totals( $invoice, $submission );
47
+			$invoice = $this->refresh_totals($invoice, $submission);
48 48
 
49
-			$this->taxes = array_replace( $invoice->get_taxes(), $this->taxes );
49
+			$this->taxes = array_replace($invoice->get_taxes(), $this->taxes);
50 50
 		}
51 51
 	}
52 52
 
@@ -57,26 +57,26 @@  discard block
 block discarded – undo
57 57
 	 * @param GetPaid_Form_Item $item
58 58
 	 * @param GetPaid_Payment_Form_Submission $submission
59 59
 	 */
60
-	public function process_item_tax( $item, $submission ) {
60
+	public function process_item_tax($item, $submission) {
61 61
 
62
-		$rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
63
-		$rates    = getpaid_filter_item_tax_rates( $item, $rates );
64
-		$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
65
-		$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
62
+		$rates    = getpaid_get_item_tax_rates($item, $submission->country, $submission->state);
63
+		$rates    = getpaid_filter_item_tax_rates($item, $rates);
64
+		$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
65
+		$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
66 66
 
67
-		foreach ( $taxes as $name => $amount ) {
68
-			$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
69
-			$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
67
+		foreach ($taxes as $name => $amount) {
68
+			$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
69
+			$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
70 70
 
71
-			$item->item_tax += wpinv_sanitize_amount( $tax['initial_tax'] );
71
+			$item->item_tax += wpinv_sanitize_amount($tax['initial_tax']);
72 72
 
73
-			if ( ! isset( $this->taxes[ $name ] ) ) {
74
-				$this->taxes[ $name ] = $tax;
73
+			if (!isset($this->taxes[$name])) {
74
+				$this->taxes[$name] = $tax;
75 75
 				continue;
76 76
 			}
77 77
 
78
-			$this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
79
-			$this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
78
+			$this->taxes[$name]['initial_tax']   += $tax['initial_tax'];
79
+			$this->taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
80 80
 
81 81
 		}
82 82
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	 * @since 1.0.19
90 90
 	 * @return bool
91 91
 	 */
92
-	public function has_digital_item( $submission ) {
92
+	public function has_digital_item($submission) {
93 93
 
94
-		foreach ( $submission->get_items() as $item ) {
94
+		foreach ($submission->get_items() as $item) {
95 95
 
96
-			if ( 'digital' == $item->get_vat_rule() ) {
96
+			if ('digital' == $item->get_vat_rule()) {
97 97
 				return true;
98 98
 			}
99 99
 }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return bool
109 109
 	 */
110 110
 	public static function is_eu_store() {
111
-		return self::is_eu_country( wpinv_get_default_country() );
111
+		return self::is_eu_country(wpinv_get_default_country());
112 112
 	}
113 113
 
114 114
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 1.0.19
119 119
 	 * @return bool
120 120
 	 */
121
-	public static function is_eu_country( $country ) {
122
-		return getpaid_is_eu_state( $country );
121
+	public static function is_eu_country($country) {
122
+		return getpaid_is_eu_state($country);
123 123
 	}
124 124
 
125 125
 	/**
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0.19
130 130
 	 * @return bool
131 131
 	 */
132
-	public static function is_eu_transaction( $customer_country ) {
133
-		return self::is_eu_country( $customer_country ) && self::is_eu_store();
132
+	public static function is_eu_transaction($customer_country) {
133
+		return self::is_eu_country($customer_country) && self::is_eu_store();
134 134
 	}
135 135
 
136 136
 	/**
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @since 1.0.19
141 141
 	 * @return string
142 142
 	 */
143
-	public function get_vat_number( $submission ) {
143
+	public function get_vat_number($submission) {
144 144
 
145 145
 		// Retrieve from the posted number.
146
-		$vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
147
-		if ( ! is_null( $vat_number ) ) {
148
-			return wpinv_clean( $vat_number );
146
+		$vat_number = $submission->get_field('wpinv_vat_number', 'billing');
147
+		if (!is_null($vat_number)) {
148
+			return wpinv_clean($vat_number);
149 149
 		}
150 150
 
151 151
 		return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 	 * @since 1.0.19
159 159
 	 * @return string
160 160
 	 */
161
-	public function get_company( $submission ) {
161
+	public function get_company($submission) {
162 162
 
163 163
 		// Retrieve from the posted data.
164
-		$company = $submission->get_field( 'wpinv_company', 'billing' );
165
-		if ( ! empty( $company ) ) {
166
-			return wpinv_clean( $company );
164
+		$company = $submission->get_field('wpinv_company', 'billing');
165
+		if (!empty($company)) {
166
+			return wpinv_clean($company);
167 167
 		}
168 168
 
169 169
 		// Retrieve from the invoice.
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @since 1.0.19
179 179
 	 * @return string
180 180
 	 */
181
-	public function requires_vat( $ip_in_eu, $country_in_eu ) {
181
+	public function requires_vat($ip_in_eu, $country_in_eu) {
182 182
 
183
-		$prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
184
-		$prevent_b2c = ! empty( $prevent_b2c );
183
+		$prevent_b2c = wpinv_get_option('vat_prevent_b2c_purchase');
184
+		$prevent_b2c = !empty($prevent_b2c);
185 185
 		$is_eu       = $ip_in_eu || $country_in_eu;
186 186
 
187 187
 		return $prevent_b2c && $is_eu;
@@ -193,43 +193,43 @@  discard block
 block discarded – undo
193 193
 	 * @param GetPaid_Payment_Form_Submission $submission
194 194
 	 * @since 1.0.19
195 195
 	 */
196
-	public function validate_vat( $submission ) {
196
+	public function validate_vat($submission) {
197 197
 
198
-		$in_eu = $this->is_eu_transaction( $submission->country );
198
+		$in_eu = $this->is_eu_transaction($submission->country);
199 199
 
200 200
 		// Abort if we are not validating vat numbers.
201
-		if ( ! $in_eu ) {
201
+		if (!$in_eu) {
202 202
             return;
203 203
 		}
204 204
 
205 205
 		// Prepare variables.
206
-		$vat_number  = $this->get_vat_number( $submission );
206
+		$vat_number  = $this->get_vat_number($submission);
207 207
 		$ip_country  = getpaid_get_ip_country();
208
-        $is_eu       = $this->is_eu_country( $submission->country );
209
-        $is_ip_eu    = $this->is_eu_country( $ip_country );
208
+        $is_eu       = $this->is_eu_country($submission->country);
209
+        $is_ip_eu    = $this->is_eu_country($ip_country);
210 210
 
211 211
 		// Maybe abort early for initial fetches.
212
-		if ( $submission->is_initial_fetch() && empty( $vat_number ) ) {
212
+		if ($submission->is_initial_fetch() && empty($vat_number)) {
213 213
 			return;
214 214
 		}
215 215
 
216 216
 		// If we're preventing business to consumer purchases,
217
-		if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
217
+		if ($this->requires_vat($is_ip_eu, $is_eu) && empty($vat_number)) {
218 218
 
219 219
 			// Ensure that a vat number has been specified.
220
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) );
220
+			throw new GetPaid_Payment_Exception('.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __('Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing'));
221 221
 
222 222
 		}
223 223
 
224
-		if ( empty( $vat_number ) ) {
224
+		if (empty($vat_number)) {
225 225
 			return;
226 226
 		}
227 227
 
228
-		if ( wpinv_should_validate_vat_number() && ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
229
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Your VAT number is invalid', 'invoicing' ) );
228
+		if (wpinv_should_validate_vat_number() && !wpinv_validate_vat_number($vat_number, $submission->country)) {
229
+			throw new GetPaid_Payment_Exception('.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __('Your VAT number is invalid', 'invoicing'));
230 230
 		}
231 231
 
232
-		if ( wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
232
+		if (wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option('vat_same_country_rule', 'vat_too')) {
233 233
 			return;
234 234
 		}
235 235
 
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 	 * @param GetPaid_Payment_Form_Submission $submission Payment form submission object.
246 246
 	 * @return object Invoice object.
247 247
 	 */
248
-	public function refresh_totals( $invoice, $submission ) {
249
-		if ( ! ( ! empty( $_POST['action'] ) && ( $_POST['action'] == 'wpinv_payment_form_refresh_prices' || $_POST['action'] == 'wpinv_payment_form' ) && isset( $_POST['billing']['wpinv_country'] ) ) ) {
248
+	public function refresh_totals($invoice, $submission) {
249
+		if (!(!empty($_POST['action']) && ($_POST['action'] == 'wpinv_payment_form_refresh_prices' || $_POST['action'] == 'wpinv_payment_form') && isset($_POST['billing']['wpinv_country']))) {
250 250
 			return $invoice;
251 251
 		}
252 252
 
253
-		if ( ! ( ! $invoice->is_paid() && ! $invoice->is_refunded() && ! $invoice->is_held() ) ) {
253
+		if (!(!$invoice->is_paid() && !$invoice->is_refunded() && !$invoice->is_held())) {
254 254
 			return $invoice;
255 255
 		}
256 256
 
257 257
 		// Maybe check the country, state.
258
-		if ( $submission->country != $invoice->get_country() || $submission->state != $invoice->get_state() ) {
259
-			$invoice->set_country( sanitize_text_field( $submission->country ) );
260
-			$invoice->set_state( sanitize_text_field( $submission->state ) );
258
+		if ($submission->country != $invoice->get_country() || $submission->state != $invoice->get_state()) {
259
+			$invoice->set_country(sanitize_text_field($submission->country));
260
+			$invoice->set_state(sanitize_text_field($submission->state));
261 261
 
262 262
 			// Recalculate totals.
263 263
 			$invoice->recalculate_total();
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
     $args = wp_parse_args(
58 58
         $args,
59 59
         array(
60
-			'status'     => array( 'publish' ),
61
-			'limit'      => get_option( 'posts_per_page' ),
62
-			'page'       => 1,
63
-			'exclude'    => array(),
64
-			'orderby'    => 'date',
65
-			'order'      => 'DESC',
66
-			'type'       => wpinv_item_types(),
67
-			'meta_query' => array(
60
+            'status'     => array( 'publish' ),
61
+            'limit'      => get_option( 'posts_per_page' ),
62
+            'page'       => 1,
63
+            'exclude'    => array(),
64
+            'orderby'    => 'date',
65
+            'order'      => 'DESC',
66
+            'type'       => wpinv_item_types(),
67
+            'meta_query' => array(
68 68
                 array(
69 69
                     'key'     => '_wpinv_one_time',
70 70
                     'compare' => 'NOT EXISTS',
71 71
                 ),
72 72
             ),
73
-			'return'     => 'objects',
74
-			'paginate'   => false,
73
+            'return'     => 'objects',
74
+            'paginate'   => false,
75 75
         )
76 76
     );
77 77
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 
212 212
 function wpinv_get_item_types() {
213 213
     $item_types = array(
214
-		'custom' => __( 'Standard', 'invoicing' ),
215
-		'fee'    => __( 'Fee', 'invoicing' ),
216
-	);
214
+        'custom' => __( 'Standard', 'invoicing' ),
215
+        'fee'    => __( 'Fee', 'invoicing' ),
216
+    );
217 217
     return apply_filters( 'wpinv_get_item_types', $item_types );
218 218
 }
219 219
 
@@ -255,16 +255,16 @@  discard block
 block discarded – undo
255 255
     $args = array();
256 256
     if ( $post_ids ) {
257 257
         $args = array(
258
-			'fields' => 'ids',
259
-		);
258
+            'fields' => 'ids',
259
+        );
260 260
     }
261 261
 
262 262
     $args = array_merge(
263 263
         $args,
264 264
         array(
265 265
             'post_type'  => 'wpi_item',
266
-			'orderby'    => 'rand',
267
-			'post_count' => $num,
266
+            'orderby'    => 'rand',
267
+            'post_count' => $num,
268 268
             'meta_query' => array(
269 269
                 array(
270 270
                     'key'     => '_wpinv_one_time',
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
     $bill_times_less = $bill_times - 1;
440 440
 
441 441
     if ( ! empty( $bill_times ) ) {
442
-		$bill_times = $item->get_recurring_interval() * $bill_times;
442
+        $bill_times = $item->get_recurring_interval() * $bill_times;
443 443
         $bill_times_less = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times - $item->get_recurring_interval() );
444
-		$bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
445
-	}
444
+        $bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
445
+    }
446 446
 
447 447
     if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
448 448
         $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
@@ -587,19 +587,19 @@  discard block
 block discarded – undo
587 587
  * @return bool Whether the item type supports the given feature.
588 588
  */
589 589
 function getpaid_item_type_supports( $item_type, $feature, $item_ID = 0 ) {
590
-	$supports = false;
590
+    $supports = false;
591 591
 
592
-	if ( ! is_scalar( $item_type ) ) {
593
-		return $supports;
594
-	}
592
+    if ( ! is_scalar( $item_type ) ) {
593
+        return $supports;
594
+    }
595 595
 
596
-	switch ( $feature ) {
597
-		case 'buy_now':
598
-			if ( '' === $item_type || 'fee' === $item_type || 'custom' === $item_type ) {
599
-				$supports = true;
600
-			}
601
-			break;
602
-	}
596
+    switch ( $feature ) {
597
+        case 'buy_now':
598
+            if ( '' === $item_type || 'fee' === $item_type || 'custom' === $item_type ) {
599
+                $supports = true;
600
+            }
601
+            break;
602
+    }
603 603
 
604
-	return apply_filters( 'getpaid_item_type_supports', $supports, $item_type, $feature, $item_ID );
604
+    return apply_filters( 'getpaid_item_type_supports', $supports, $item_type, $feature, $item_ID );
605 605
 }
606 606
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves an item by it's ID.
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * @param int the item ID to retrieve.
15 15
  * @return WPInv_Item|false
16 16
  */
17
-function wpinv_get_item_by_id( $id ) {
18
-    $item = wpinv_get_item( $id );
19
-    return empty( $item ) || $id != $item->get_id() ? false : $item;
17
+function wpinv_get_item_by_id($id) {
18
+    $item = wpinv_get_item($id);
19
+    return empty($item) || $id != $item->get_id() ? false : $item;
20 20
 }
21 21
 
22 22
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return WPInv_Item|false
26 26
  */
27
-function wpinv_get_item_by( $field = '', $value = '', $type = '' ) {
27
+function wpinv_get_item_by($field = '', $value = '', $type = '') {
28 28
 
29
-    if ( 'id' === strtolower( $field ) ) {
30
-        return wpinv_get_item_by_id( $value );
29
+    if ('id' === strtolower($field)) {
30
+        return wpinv_get_item_by_id($value);
31 31
     }
32 32
 
33
-    $id = WPInv_Item::get_item_id_by_field( $value, strtolower( $field ), $type );
34
-    return empty( $id ) ? false : wpinv_get_item( $id );
33
+    $id = WPInv_Item::get_item_id_by_field($value, strtolower($field), $type);
34
+    return empty($id) ? false : wpinv_get_item($id);
35 35
 }
36 36
 
37 37
 /**
@@ -40,23 +40,23 @@  discard block
 block discarded – undo
40 40
  * @param int|WPInv_Item the item to retrieve.
41 41
  * @return WPInv_Item|false
42 42
  */
43
-function wpinv_get_item( $item = 0 ) {
43
+function wpinv_get_item($item = 0) {
44 44
 
45
-    if ( empty( $item ) ) {
45
+    if (empty($item)) {
46 46
         return false;
47 47
     }
48 48
 
49
-    $item = new WPInv_Item( $item );
49
+    $item = new WPInv_Item($item);
50 50
     return $item->exists() ? $item : false;
51 51
 }
52 52
 
53
-function wpinv_get_all_items( $args = array() ) {
53
+function wpinv_get_all_items($args = array()) {
54 54
 
55 55
     $args = wp_parse_args(
56 56
         $args,
57 57
         array(
58
-			'status'     => array( 'publish' ),
59
-			'limit'      => get_option( 'posts_per_page' ),
58
+			'status'     => array('publish'),
59
+			'limit'      => get_option('posts_per_page'),
60 60
 			'page'       => 1,
61 61
 			'exclude'    => array(),
62 62
 			'orderby'    => 'date',
@@ -81,44 +81,44 @@  discard block
 block discarded – undo
81 81
         'fields'         => 'ids',
82 82
         'orderby'        => $args['orderby'],
83 83
         'order'          => $args['order'],
84
-        'paged'          => absint( $args['page'] ),
84
+        'paged'          => absint($args['page']),
85 85
     );
86 86
 
87
-    if ( ! empty( $args['exclude'] ) ) {
88
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
87
+    if (!empty($args['exclude'])) {
88
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
89 89
     }
90 90
 
91
-    if ( ! $args['paginate'] ) {
91
+    if (!$args['paginate']) {
92 92
         $wp_query_args['no_found_rows'] = true;
93 93
     }
94 94
 
95
-    if ( ! empty( $args['search'] ) ) {
95
+    if (!empty($args['search'])) {
96 96
         $wp_query_args['s'] = $args['search'];
97 97
     }
98 98
 
99
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
100
-        $types = wpinv_parse_list( $args['type'] );
99
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
100
+        $types = wpinv_parse_list($args['type']);
101 101
         $wp_query_args['meta_query'][] = array(
102 102
             'key'     => '_wpinv_type',
103
-            'value'   => implode( ',', $types ),
103
+            'value'   => implode(',', $types),
104 104
             'compare' => 'IN',
105 105
         );
106 106
     }
107 107
 
108
-    $wp_query_args = apply_filters( 'wpinv_get_items_args', $wp_query_args, $args );
108
+    $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
109 109
 
110 110
     // Get results.
111
-    $items = new WP_Query( $wp_query_args );
111
+    $items = new WP_Query($wp_query_args);
112 112
 
113
-    if ( 'objects' === $args['return'] ) {
114
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
115
-    } elseif ( 'self' === $args['return'] ) {
113
+    if ('objects' === $args['return']) {
114
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
115
+    } elseif ('self' === $args['return']) {
116 116
         return $items;
117 117
     } else {
118 118
         $return = $items->posts;
119 119
     }
120 120
 
121
-    if ( $args['paginate'] ) {
121
+    if ($args['paginate']) {
122 122
         return (object) array(
123 123
             'items'         => $return,
124 124
             'total'         => $items->found_posts,
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
     }
130 130
 }
131 131
 
132
-function wpinv_is_free_item( $item_id = 0 ) {
133
-    if ( empty( $item_id ) ) {
132
+function wpinv_is_free_item($item_id = 0) {
133
+    if (empty($item_id)) {
134 134
         return false;
135 135
     }
136 136
 
137
-    $item = new WPInv_Item( $item_id );
137
+    $item = new WPInv_Item($item_id);
138 138
 
139 139
     return $item->is_free();
140 140
 }
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @param WP_Post|WPInv_Item|Int $item The item to check for.
146 146
  */
147
-function wpinv_item_is_editable( $item = 0 ) {
147
+function wpinv_item_is_editable($item = 0) {
148 148
 
149 149
     // Fetch the item.
150
-    $item = new WPInv_Item( $item );
150
+    $item = new WPInv_Item($item);
151 151
 
152 152
     // Check if it is editable.
153 153
     return $item->is_editable();
154 154
 }
155 155
 
156
-function wpinv_get_item_price( $item_id = 0 ) {
157
-    if ( empty( $item_id ) ) {
156
+function wpinv_get_item_price($item_id = 0) {
157
+    if (empty($item_id)) {
158 158
         return false;
159 159
     }
160 160
 
161
-    $item = new WPInv_Item( $item_id );
161
+    $item = new WPInv_Item($item_id);
162 162
 
163 163
     return $item->get_price();
164 164
 }
@@ -168,89 +168,89 @@  discard block
 block discarded – undo
168 168
  *
169 169
  * @param WPInv_Item|int $item
170 170
  */
171
-function wpinv_is_recurring_item( $item = 0 ) {
172
-    $item = new WPInv_Item( $item );
171
+function wpinv_is_recurring_item($item = 0) {
172
+    $item = new WPInv_Item($item);
173 173
     return $item->is_recurring();
174 174
 }
175 175
 
176
-function wpinv_item_price( $item_id = 0 ) {
177
-    if ( empty( $item_id ) ) {
176
+function wpinv_item_price($item_id = 0) {
177
+    if (empty($item_id)) {
178 178
         return false;
179 179
     }
180 180
 
181
-    $price = wpinv_get_item_price( $item_id );
182
-    $price = wpinv_price( $price );
181
+    $price = wpinv_get_item_price($item_id);
182
+    $price = wpinv_price($price);
183 183
 
184
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
184
+    return apply_filters('wpinv_item_price', $price, $item_id);
185 185
 }
186 186
 
187
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
188
-    if ( is_null( $amount_override ) ) {
189
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
187
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
188
+    if (is_null($amount_override)) {
189
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
190 190
     } else {
191 191
         $original_price = $amount_override;
192 192
     }
193 193
 
194 194
     $price = $original_price;
195 195
 
196
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
196
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
197 197
 }
198 198
 
199
-function wpinv_item_custom_singular_name( $item_id ) {
200
-    if ( empty( $item_id ) ) {
199
+function wpinv_item_custom_singular_name($item_id) {
200
+    if (empty($item_id)) {
201 201
         return false;
202 202
     }
203 203
 
204
-    $item = new WPInv_Item( $item_id );
204
+    $item = new WPInv_Item($item_id);
205 205
 
206 206
     return $item->get_custom_singular_name();
207 207
 }
208 208
 
209 209
 function wpinv_get_item_types() {
210 210
     $item_types = array(
211
-		'custom' => __( 'Standard', 'invoicing' ),
212
-		'fee'    => __( 'Fee', 'invoicing' ),
211
+		'custom' => __('Standard', 'invoicing'),
212
+		'fee'    => __('Fee', 'invoicing'),
213 213
 	);
214
-    return apply_filters( 'wpinv_get_item_types', $item_types );
214
+    return apply_filters('wpinv_get_item_types', $item_types);
215 215
 }
216 216
 
217 217
 function wpinv_item_types() {
218 218
     $item_types = wpinv_get_item_types();
219 219
 
220
-    return ( ! empty( $item_types ) ? array_keys( $item_types ) : array() );
220
+    return (!empty($item_types) ? array_keys($item_types) : array());
221 221
 }
222 222
 
223
-function wpinv_get_item_type( $item_id ) {
224
-    if ( empty( $item_id ) ) {
223
+function wpinv_get_item_type($item_id) {
224
+    if (empty($item_id)) {
225 225
         return false;
226 226
     }
227 227
 
228
-    $item = new WPInv_Item( $item_id );
228
+    $item = new WPInv_Item($item_id);
229 229
 
230 230
     return $item->get_type();
231 231
 }
232 232
 
233
-function wpinv_item_type( $item_id ) {
233
+function wpinv_item_type($item_id) {
234 234
     $item_types = wpinv_get_item_types();
235 235
 
236
-    $item_type = wpinv_get_item_type( $item_id );
236
+    $item_type = wpinv_get_item_type($item_id);
237 237
 
238
-    if ( empty( $item_type ) ) {
238
+    if (empty($item_type)) {
239 239
         $item_type = '-';
240 240
     }
241 241
 
242
-    $item_type = isset( $item_types[ $item_type ] ) ? $item_types[ $item_type ] : __( $item_type, 'invoicing' );
242
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
243 243
 
244
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
244
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
245 245
 }
246 246
 
247
-function wpinv_get_random_item( $post_ids = true ) {
248
-    wpinv_get_random_items( 1, $post_ids );
247
+function wpinv_get_random_item($post_ids = true) {
248
+    wpinv_get_random_items(1, $post_ids);
249 249
 }
250 250
 
251
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
251
+function wpinv_get_random_items($num = 3, $post_ids = true) {
252 252
     $args = array();
253
-    if ( $post_ids ) {
253
+    if ($post_ids) {
254 254
         $args = array(
255 255
 			'fields' => 'ids',
256 256
 		);
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
         )
272 272
     );
273 273
 
274
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
274
+    $args = apply_filters('wpinv_get_random_items', $args);
275 275
 
276
-    return get_posts( $args );
276
+    return get_posts($args);
277 277
 }
278 278
 
279 279
 /**
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
  * @param WPInv_Item|int $item
283 283
  * @param bool $html
284 284
  */
285
-function wpinv_get_item_suffix( $item, $html = true ) {
285
+function wpinv_get_item_suffix($item, $html = true) {
286 286
 
287
-    $item   = new WPInv_Item( $item );
288
-    $suffix = $item->is_recurring() ? ' ' . __( '(r)', 'invoicing' ) : '';
289
-    $suffix = $html ? $suffix : wp_strip_all_tags( $suffix );
287
+    $item   = new WPInv_Item($item);
288
+    $suffix = $item->is_recurring() ? ' ' . __('(r)', 'invoicing') : '';
289
+    $suffix = $html ? $suffix : wp_strip_all_tags($suffix);
290 290
 
291
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
291
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
292 292
 }
293 293
 
294 294
 /**
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
  * @param WPInv_Item|int $item
298 298
  * @param bool $force_delete
299 299
  */
300
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
301
-    $item = new WPInv_Item( $item );
302
-    $item->delete( $force_delete );
300
+function wpinv_remove_item($item = 0, $force_delete = false) {
301
+    $item = new WPInv_Item($item);
302
+    $item->delete($force_delete);
303 303
 }
304 304
 
305 305
 /**
@@ -338,44 +338,44 @@  discard block
 block discarded – undo
338 338
  * @param bool $wp_error whether or not to return a WP_Error on failure.
339 339
  * @return bool|WP_Error|WPInv_Item
340 340
  */
341
-function wpinv_create_item( $args = array(), $wp_error = false ) {
341
+function wpinv_create_item($args = array(), $wp_error = false) {
342 342
 
343 343
     // Prepare the item.
344
-    if ( ! empty( $args['custom_id'] ) && empty( $args['ID'] ) ) {
345
-        $type = empty( $args['type'] ) ? 'custom' : $args['type'];
346
-        $item = wpinv_get_item_by( 'custom_id', $args['custom_id'], $type );
344
+    if (!empty($args['custom_id']) && empty($args['ID'])) {
345
+        $type = empty($args['type']) ? 'custom' : $args['type'];
346
+        $item = wpinv_get_item_by('custom_id', $args['custom_id'], $type);
347 347
 
348
-        if ( ! empty( $item ) ) {
348
+        if (!empty($item)) {
349 349
             $args['ID'] = $item->get_id();
350 350
         }
351 351
     }
352 352
 
353 353
     // Do we have an item?
354
-    if ( ! empty( $args['ID'] ) ) {
355
-        $item = new WPInv_Item( $args['ID'] );
354
+    if (!empty($args['ID'])) {
355
+        $item = new WPInv_Item($args['ID']);
356 356
     } else {
357 357
         $item = new WPInv_Item();
358 358
     }
359 359
 
360 360
     // Do we have an error?
361
-    if ( ! empty( $item->last_error ) ) {
362
-        return $wp_error ? new WP_Error( 'invalid_item', $item->last_error ) : false;
361
+    if (!empty($item->last_error)) {
362
+        return $wp_error ? new WP_Error('invalid_item', $item->last_error) : false;
363 363
     }
364 364
 
365 365
     // Update item props.
366
-    $item->set_props( $args );
366
+    $item->set_props($args);
367 367
 
368 368
     // Save the item.
369 369
     $item->save();
370 370
 
371 371
     // Do we have an error?
372
-    if ( ! empty( $item->last_error ) ) {
373
-        return $wp_error ? new WP_Error( 'not_saved', $item->last_error ) : false;
372
+    if (!empty($item->last_error)) {
373
+        return $wp_error ? new WP_Error('not_saved', $item->last_error) : false;
374 374
     }
375 375
 
376 376
     // Was the item saved?
377
-    if ( ! $item->get_id() ) {
378
-        return $wp_error ? new WP_Error( 'not_saved', __( 'An error occured while saving the item', 'invoicing' ) ) : false;
377
+    if (!$item->get_id()) {
378
+        return $wp_error ? new WP_Error('not_saved', __('An error occured while saving the item', 'invoicing')) : false;
379 379
     }
380 380
 
381 381
     return $item;
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
  *
387 387
  * @see wpinv_create_item()
388 388
  */
389
-function wpinv_update_item( $args = array(), $wp_error = false ) {
390
-    return wpinv_create_item( $args, $wp_error );
389
+function wpinv_update_item($args = array(), $wp_error = false) {
390
+    return wpinv_create_item($args, $wp_error);
391 391
 }
392 392
 
393 393
 /**
394 394
  * Sanitizes a recurring period
395 395
  */
396
-function getpaid_sanitize_recurring_period( $period, $full = false ) {
396
+function getpaid_sanitize_recurring_period($period, $full = false) {
397 397
 
398 398
     $periods = array(
399 399
         'D' => 'day',
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
         'Y' => 'year',
403 403
     );
404 404
 
405
-    if ( ! isset( $periods[ $period ] ) ) {
405
+    if (!isset($periods[$period])) {
406 406
         $period = 'D';
407 407
     }
408 408
 
409
-    return $full ? $periods[ $period ] : $period;
409
+    return $full ? $periods[$period] : $period;
410 410
 }
411 411
 
412
-function wpinv_item_max_buyable_quantity( $item_id ) {
413
-    return apply_filters( 'wpinv_item_max_buyable_quantity', 5, $item_id );
412
+function wpinv_item_max_buyable_quantity($item_id) {
413
+    return apply_filters('wpinv_item_max_buyable_quantity', 5, $item_id);
414 414
 }
415 415
 
416 416
 /**
@@ -418,47 +418,47 @@  discard block
 block discarded – undo
418 418
  *
419 419
  * @param WPInv_Item|GetPaid_Form_Item $item
420 420
  */
421
-function getpaid_item_recurring_price_help_text( $item, $currency = '', $_initial_price = false, $_recurring_price = false ) {
421
+function getpaid_item_recurring_price_help_text($item, $currency = '', $_initial_price = false, $_recurring_price = false) {
422 422
 
423 423
     // Abort if it is not recurring.
424
-    if ( ! $item->is_recurring() ) {
424
+    if (!$item->is_recurring()) {
425 425
         return '';
426 426
     }
427 427
 
428
-    $initial_price   = false === $_initial_price ? wpinv_price( $item->get_initial_price(), $currency ) : $_initial_price;
429
-    $recurring_price = false === $_recurring_price ? wpinv_price( $item->get_recurring_price(), $currency ) : $_recurring_price;
430
-    $period          = getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' );
428
+    $initial_price   = false === $_initial_price ? wpinv_price($item->get_initial_price(), $currency) : $_initial_price;
429
+    $recurring_price = false === $_recurring_price ? wpinv_price($item->get_recurring_price(), $currency) : $_recurring_price;
430
+    $period          = getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '');
431 431
     $initial_class   = 'getpaid-item-initial-price';
432 432
     $recurring_class = 'getpaid-item-recurring-price';
433 433
     $bill_times      = $item->get_recurring_limit();
434 434
     $bill_times_less = $bill_times - 1;
435 435
 
436
-    if ( ! empty( $bill_times ) ) {
436
+    if (!empty($bill_times)) {
437 437
 		$bill_times = $item->get_recurring_interval() * $bill_times;
438
-        $bill_times_less = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times - $item->get_recurring_interval() );
439
-		$bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
438
+        $bill_times_less = getpaid_get_subscription_period_label($item->get_recurring_period(), $bill_times - $item->get_recurring_interval());
439
+		$bill_times = getpaid_get_subscription_period_label($item->get_recurring_period(), $bill_times);
440 440
 	}
441 441
 
442
-    if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
443
-        $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
444
-        $recurring_price = wpinv_price( $item->get_recurring_sub_total(), $currency );
442
+    if ($item instanceof GetPaid_Form_Item && false === $_initial_price) {
443
+        $initial_price   = wpinv_price($item->get_sub_total(), $currency);
444
+        $recurring_price = wpinv_price($item->get_recurring_sub_total(), $currency);
445 445
     }
446 446
 
447
-    if ( wpinv_price( 0, $currency ) == $initial_price && wpinv_price( 0, $currency ) == $recurring_price ) {
448
-        return __( 'Free forever', 'invoicing' );
447
+    if (wpinv_price(0, $currency) == $initial_price && wpinv_price(0, $currency) == $recurring_price) {
448
+        return __('Free forever', 'invoicing');
449 449
     }
450 450
 
451 451
     // For free trial items.
452
-    if ( $item->has_free_trial() ) {
453
-        $trial_period = getpaid_get_subscription_period_label( $item->get_trial_period(), $item->get_trial_interval() );
452
+    if ($item->has_free_trial()) {
453
+        $trial_period = getpaid_get_subscription_period_label($item->get_trial_period(), $item->get_trial_interval());
454 454
 
455
-        if ( wpinv_price( 0, $currency ) == $initial_price ) {
455
+        if (wpinv_price(0, $currency) == $initial_price) {
456 456
 
457
-            if ( empty( $bill_times ) ) {
457
+            if (empty($bill_times)) {
458 458
 
459 459
                 return sprintf(
460 460
                     // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period
461
-                    _x( 'Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing' ),
461
+                    _x('Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing'),
462 462
                     "<span class='getpaid-item-trial-period'>$trial_period</span>",
463 463
                     "<span class='$recurring_class'>$recurring_price</span>",
464 464
                     "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
             return sprintf(
470 470
                 // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period, $4: is the bill times
471
-                _x( 'Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing' ),
471
+                _x('Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing'),
472 472
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
473 473
                 "<span class='$recurring_class'>$recurring_price</span>",
474 474
                 "<span class='getpaid-item-recurring-period'>$period</span>",
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 
478 478
         }
479 479
 
480
-        if ( empty( $bill_times ) ) {
480
+        if (empty($bill_times)) {
481 481
 
482 482
             return sprintf(
483 483
                 // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period
484
-                _x( '%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing' ),
484
+                _x('%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing'),
485 485
                 "<span class='$initial_class'>$initial_price</span>",
486 486
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
487 487
                 "<span class='$recurring_class'>$recurring_price</span>",
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 
493 493
         return sprintf(
494 494
             // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period, $4: is the susbcription bill times
495
-            _x( '%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing' ),
495
+            _x('%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing'),
496 496
             "<span class='$initial_class'>$initial_price</span>",
497 497
             "<span class='getpaid-item-trial-period'>$trial_period</span>",
498 498
             "<span class='$recurring_class'>$recurring_price</span>",
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 
503 503
     }
504 504
 
505
-    if ( $initial_price == $recurring_price ) {
505
+    if ($initial_price == $recurring_price) {
506 506
 
507
-        if ( empty( $bill_times ) ) {
507
+        if (empty($bill_times)) {
508 508
 
509 509
             return sprintf(
510 510
                 // translators: $1: is the recurring price, $2: is the susbcription period
511
-                _x( '%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing' ),
511
+                _x('%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing'),
512 512
                 "<span class='$recurring_class'>$recurring_price</span>",
513 513
                 "<span class='getpaid-item-recurring-period'>$period</span>"
514 514
             );
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
         return sprintf(
519 519
             // translators: $1: is the recurring price, $2: is the susbcription period, $3: is the susbcription bill times
520
-            _x( '%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing' ),
520
+            _x('%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing'),
521 521
             "<span class='$recurring_class'>$recurring_price</span>",
522 522
             "<span class='getpaid-item-recurring-period'>$period</span>",
523 523
             "<span class='getpaid-item-recurring-bill-times'>$bill_times</span>"
@@ -525,13 +525,13 @@  discard block
 block discarded – undo
525 525
 
526 526
     }
527 527
 
528
-    if ( $initial_price == wpinv_price( 0, $currency ) ) {
528
+    if ($initial_price == wpinv_price(0, $currency)) {
529 529
 
530
-        if ( empty( $bill_times ) ) {
530
+        if (empty($bill_times)) {
531 531
 
532 532
             return sprintf(
533 533
                 // translators: $1: is the recurring period, $2: is the recurring price
534
-                _x( 'Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing' ),
534
+                _x('Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing'),
535 535
                 "<span class='getpaid-item-recurring-period'>$period</span>",
536 536
                 "<span class='$recurring_class'>$recurring_price</span>"
537 537
             );
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
         return sprintf(
542 542
             // translators: $1: is the recurring period, $2: is the recurring price, $3: is the bill times
543
-            _x( 'Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing' ),
543
+            _x('Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing'),
544 544
             "<span class='getpaid-item-recurring-period'>$period</span>",
545 545
             "<span class='$recurring_class'>$recurring_price</span>",
546 546
             "<span class='getpaid-item-recurring-bill-times'>$bill_times_less</span>"
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
 
549 549
     }
550 550
 
551
-    if ( empty( $bill_times ) ) {
551
+    if (empty($bill_times)) {
552 552
 
553 553
         return sprintf(
554 554
             // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period
555
-            _x( 'Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing' ),
555
+            _x('Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing'),
556 556
             "<span class='$initial_class'>$initial_price</span>",
557 557
             "<span class='$recurring_class'>$recurring_price</span>",
558 558
             "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 
563 563
     return sprintf(
564 564
         // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period, $4: is the susbcription bill times
565
-        _x( 'Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing' ),
565
+        _x('Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing'),
566 566
         "<span class='$initial_class'>$initial_price</span>",
567 567
         "<span class='$recurring_class'>$recurring_price</span>",
568 568
         "<span class='getpaid-item-recurring-period'>$period</span>",
@@ -580,20 +580,20 @@  discard block
 block discarded – undo
580 580
  * @param int    $item_ID   The item post ID. Optional.
581 581
  * @return bool Whether the item type supports the given feature.
582 582
  */
583
-function getpaid_item_type_supports( $item_type, $feature, $item_ID = 0 ) {
583
+function getpaid_item_type_supports($item_type, $feature, $item_ID = 0) {
584 584
 	$supports = false;
585 585
 
586
-	if ( ! is_scalar( $item_type ) ) {
586
+	if (!is_scalar($item_type)) {
587 587
 		return $supports;
588 588
 	}
589 589
 
590
-	switch ( $feature ) {
590
+	switch ($feature) {
591 591
 		case 'buy_now':
592
-			if ( '' === $item_type || 'fee' === $item_type || 'custom' === $item_type ) {
592
+			if ('' === $item_type || 'fee' === $item_type || 'custom' === $item_type) {
593 593
 				$supports = true;
594 594
 			}
595 595
 			break;
596 596
 	}
597 597
 
598
-	return apply_filters( 'getpaid_item_type_supports', $supports, $item_type, $feature, $item_ID );
598
+	return apply_filters('getpaid_item_type_supports', $supports, $item_type, $feature, $item_ID);
599 599
 }
600 600
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
     if (!headers_sent()) {
7 7
         header('HTTP/1.1 500 Internal Server Error');
8 8
     }
9
-    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
9
+    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running ' . PHP_VERSION . ', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.' . PHP_EOL;
10 10
     if (!ini_get('display_errors')) {
11 11
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12 12
             fwrite(STDERR, $err);
Please login to merge, or discard this patch.
vendor/composer/InstalledVersions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -327,11 +327,11 @@
 block discarded – undo
327 327
             foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
328 328
                 if (isset(self::$installedByVendor[$vendorDir])) {
329 329
                     $installed[] = self::$installedByVendor[$vendorDir];
330
-                } elseif (is_file($vendorDir.'/composer/installed.php')) {
330
+                } elseif (is_file($vendorDir . '/composer/installed.php')) {
331 331
                     /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332
-                    $required = require $vendorDir.'/composer/installed.php';
332
+                    $required = require $vendorDir . '/composer/installed.php';
333 333
                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
334
-                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
334
+                    if (null === self::$installed && strtr($vendorDir . '/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335 335
                         self::$installed = $installed[count($installed) - 1];
336 336
                     }
337 337
                 }
Please login to merge, or discard this patch.
vendor/composer/autoload_real.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         $loader->register(true);
35 35
 
36 36
         $filesToLoad = \Composer\Autoload\ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$files;
37
-        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
37
+        $requireFile = \Closure::bind(static function($fileIdentifier, $file) {
38 38
             if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
39 39
                 $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
40 40
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @return array|mixed|string|string[]
15 15
  */
16
-function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
16
+function aui_bs_convert_sd_output($output, $instance = '', $args = '', $sd = '') {
17 17
 	global $aui_bs5;
18 18
 
19
-	if ( $aui_bs5 ) {
19
+	if ($aui_bs5) {
20 20
 		$convert = array(
21 21
 			'"ml-' => '"ms-',
22 22
 			'"mr-' => '"me-',
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 			'class="close"' => 'class="btn-close"',
76 76
 			'<span aria-hidden="true">&times;</span>' => '',
77 77
 		);
78
-		$output  = str_replace(
79
-			array_keys( $convert ),
80
-			array_values( $convert ),
78
+		$output = str_replace(
79
+			array_keys($convert),
80
+			array_values($convert),
81 81
 			$output
82 82
 		);
83 83
 	}
@@ -85,4 +85,4 @@  discard block
 block discarded – undo
85 85
 	return $output;
86 86
 }
87 87
 
88
-add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
88
+add_filter('wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4); //$output, $instance, $args, $this
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -14,76 +14,76 @@
 block discarded – undo
14 14
  * @return array|mixed|string|string[]
15 15
  */
16 16
 function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
17
-	global $aui_bs5;
17
+    global $aui_bs5;
18 18
 
19
-	if ( $aui_bs5 ) {
20
-		$convert = array(
21
-			'"ml-' => '"ms-',
22
-			'"mr-' => '"me-',
23
-			'"pl-' => '"ps-',
24
-			'"pr-' => '"pe-',
25
-			"'ml-" => "'ms-",
26
-			"'mr-" => "'me-",
27
-			"'pl-" => "'ps-",
28
-			"'pr-" => "'pe-",
29
-			' ml-' => ' ms-',
30
-			' mr-' => ' me-',
31
-			' pl-' => ' ps-',
32
-			' pr-' => ' pe-',
33
-			'.ml-' => '.ms-',
34
-			'.mr-' => '.me-',
35
-			'.pl-' => '.ps-',
36
-			'.pr-' => '.pe-',
37
-			' form-row' => ' row',
38
-			' embed-responsive-item' => '',
39
-			' embed-responsive' => ' ratio',
40
-			'-1by1'    => '-1x1',
41
-			'-4by3'    => '-4x3',
42
-			'-16by9'    => '-16x9',
43
-			'-21by9'    => '-21x9',
44
-			'geodir-lightbox-image' => 'aui-lightbox-image',
45
-			'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
-			' badge-'   => ' text-bg-',
47
-			'form-group'   => 'mb-3',
48
-			'custom-select'   => 'form-select',
49
-			'float-left'   => 'float-start',
50
-			'float-right'   => 'float-end',
51
-			'text-left'    => 'text-start',
52
-			'text-sm-left'    => 'text-sm-start',
53
-			'text-md-left'    => 'text-md-start',
54
-			'text-lg-left'    => 'text-lg-start',
55
-			'text-right'    => 'text-end',
56
-			'text-sm-right'    => 'text-sm-end',
57
-			'text-md-right'    => 'text-md-end',
58
-			'text-lg-right'    => 'text-lg-end',
59
-			'border-right'    => 'border-end',
60
-			'border-left'    => 'border-start',
61
-			'font-weight-'  => 'fw-',
62
-			'btn-block'     => 'w-100',
63
-			'rounded-left'  => 'rounded-start',
64
-			'rounded-right'  => 'rounded-end',
65
-			'font-italic' => 'fst-italic',
19
+    if ( $aui_bs5 ) {
20
+        $convert = array(
21
+            '"ml-' => '"ms-',
22
+            '"mr-' => '"me-',
23
+            '"pl-' => '"ps-',
24
+            '"pr-' => '"pe-',
25
+            "'ml-" => "'ms-",
26
+            "'mr-" => "'me-",
27
+            "'pl-" => "'ps-",
28
+            "'pr-" => "'pe-",
29
+            ' ml-' => ' ms-',
30
+            ' mr-' => ' me-',
31
+            ' pl-' => ' ps-',
32
+            ' pr-' => ' pe-',
33
+            '.ml-' => '.ms-',
34
+            '.mr-' => '.me-',
35
+            '.pl-' => '.ps-',
36
+            '.pr-' => '.pe-',
37
+            ' form-row' => ' row',
38
+            ' embed-responsive-item' => '',
39
+            ' embed-responsive' => ' ratio',
40
+            '-1by1'    => '-1x1',
41
+            '-4by3'    => '-4x3',
42
+            '-16by9'    => '-16x9',
43
+            '-21by9'    => '-21x9',
44
+            'geodir-lightbox-image' => 'aui-lightbox-image',
45
+            'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
+            ' badge-'   => ' text-bg-',
47
+            'form-group'   => 'mb-3',
48
+            'custom-select'   => 'form-select',
49
+            'float-left'   => 'float-start',
50
+            'float-right'   => 'float-end',
51
+            'text-left'    => 'text-start',
52
+            'text-sm-left'    => 'text-sm-start',
53
+            'text-md-left'    => 'text-md-start',
54
+            'text-lg-left'    => 'text-lg-start',
55
+            'text-right'    => 'text-end',
56
+            'text-sm-right'    => 'text-sm-end',
57
+            'text-md-right'    => 'text-md-end',
58
+            'text-lg-right'    => 'text-lg-end',
59
+            'border-right'    => 'border-end',
60
+            'border-left'    => 'border-start',
61
+            'font-weight-'  => 'fw-',
62
+            'btn-block'     => 'w-100',
63
+            'rounded-left'  => 'rounded-start',
64
+            'rounded-right'  => 'rounded-end',
65
+            'font-italic' => 'fst-italic',
66 66
 
67 67
 //			'custom-control custom-checkbox'    => 'form-check',
68
-			// data
69
-			' data-toggle=' => ' data-bs-toggle=',
70
-			'data-ride=' => 'data-bs-ride=',
71
-			'data-controlnav=' => 'data-bs-controlnav=',
72
-			'data-slide='   => 'data-bs-slide=',
73
-			'data-slide-to=' => 'data-bs-slide-to=',
74
-			'data-target='  => 'data-bs-target=',
75
-			'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
-			'class="close"' => 'class="btn-close"',
77
-			'<span aria-hidden="true">&times;</span>' => '',
78
-		);
79
-		$output  = str_replace(
80
-			array_keys( $convert ),
81
-			array_values( $convert ),
82
-			$output
83
-		);
84
-	}
68
+            // data
69
+            ' data-toggle=' => ' data-bs-toggle=',
70
+            'data-ride=' => 'data-bs-ride=',
71
+            'data-controlnav=' => 'data-bs-controlnav=',
72
+            'data-slide='   => 'data-bs-slide=',
73
+            'data-slide-to=' => 'data-bs-slide-to=',
74
+            'data-target='  => 'data-bs-target=',
75
+            'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
+            'class="close"' => 'class="btn-close"',
77
+            '<span aria-hidden="true">&times;</span>' => '',
78
+        );
79
+        $output  = str_replace(
80
+            array_keys( $convert ),
81
+            array_values( $convert ),
82
+            $output
83
+        );
84
+    }
85 85
 
86
-	return $output;
86
+    return $output;
87 87
 }
88 88
 
89 89
 add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
Please login to merge, or discard this patch.
Switch Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Functionality to convert BS4 to BS5.
4 4
  */
@@ -13,77 +13,77 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @return array|mixed|string|string[]
15 15
  */
16
-function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
17
-	global $aui_bs5;
16
+    function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
17
+	    global $aui_bs5;
18 18
 
19
-	if ( $aui_bs5 ) {
20
-		$convert = array(
21
-			'"ml-' => '"ms-',
22
-			'"mr-' => '"me-',
23
-			'"pl-' => '"ps-',
24
-			'"pr-' => '"pe-',
25
-			"'ml-" => "'ms-",
26
-			"'mr-" => "'me-",
27
-			"'pl-" => "'ps-",
28
-			"'pr-" => "'pe-",
29
-			' ml-' => ' ms-',
30
-			' mr-' => ' me-',
31
-			' pl-' => ' ps-',
32
-			' pr-' => ' pe-',
33
-			'.ml-' => '.ms-',
34
-			'.mr-' => '.me-',
35
-			'.pl-' => '.ps-',
36
-			'.pr-' => '.pe-',
37
-			' form-row' => ' row',
38
-			' embed-responsive-item' => '',
39
-			' embed-responsive' => ' ratio',
40
-			'-1by1'    => '-1x1',
41
-			'-4by3'    => '-4x3',
42
-			'-16by9'    => '-16x9',
43
-			'-21by9'    => '-21x9',
44
-			'geodir-lightbox-image' => 'aui-lightbox-image',
45
-			'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
-			' badge-'   => ' text-bg-',
47
-			'form-group'   => 'mb-3',
48
-			'custom-select'   => 'form-select',
49
-			'float-left'   => 'float-start',
50
-			'float-right'   => 'float-end',
51
-			'text-left'    => 'text-start',
52
-			'text-sm-left'    => 'text-sm-start',
53
-			'text-md-left'    => 'text-md-start',
54
-			'text-lg-left'    => 'text-lg-start',
55
-			'text-right'    => 'text-end',
56
-			'text-sm-right'    => 'text-sm-end',
57
-			'text-md-right'    => 'text-md-end',
58
-			'text-lg-right'    => 'text-lg-end',
59
-			'border-right'    => 'border-end',
60
-			'border-left'    => 'border-start',
61
-			'font-weight-'  => 'fw-',
62
-			'btn-block'     => 'w-100',
63
-			'rounded-left'  => 'rounded-start',
64
-			'rounded-right'  => 'rounded-end',
65
-			'font-italic' => 'fst-italic',
19
+	    if ( $aui_bs5 ) {
20
+		    $convert = array(
21
+			    '"ml-' => '"ms-',
22
+			    '"mr-' => '"me-',
23
+			    '"pl-' => '"ps-',
24
+			    '"pr-' => '"pe-',
25
+			    "'ml-" => "'ms-",
26
+			    "'mr-" => "'me-",
27
+			    "'pl-" => "'ps-",
28
+			    "'pr-" => "'pe-",
29
+			    ' ml-' => ' ms-',
30
+			    ' mr-' => ' me-',
31
+			    ' pl-' => ' ps-',
32
+			    ' pr-' => ' pe-',
33
+			    '.ml-' => '.ms-',
34
+			    '.mr-' => '.me-',
35
+			    '.pl-' => '.ps-',
36
+			    '.pr-' => '.pe-',
37
+			    ' form-row' => ' row',
38
+			    ' embed-responsive-item' => '',
39
+			    ' embed-responsive' => ' ratio',
40
+			    '-1by1'    => '-1x1',
41
+			    '-4by3'    => '-4x3',
42
+			    '-16by9'    => '-16x9',
43
+			    '-21by9'    => '-21x9',
44
+			    'geodir-lightbox-image' => 'aui-lightbox-image',
45
+			    'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
+			    ' badge-'   => ' text-bg-',
47
+			    'form-group'   => 'mb-3',
48
+			    'custom-select'   => 'form-select',
49
+			    'float-left'   => 'float-start',
50
+			    'float-right'   => 'float-end',
51
+			    'text-left'    => 'text-start',
52
+			    'text-sm-left'    => 'text-sm-start',
53
+			    'text-md-left'    => 'text-md-start',
54
+			    'text-lg-left'    => 'text-lg-start',
55
+			    'text-right'    => 'text-end',
56
+			    'text-sm-right'    => 'text-sm-end',
57
+			    'text-md-right'    => 'text-md-end',
58
+			    'text-lg-right'    => 'text-lg-end',
59
+			    'border-right'    => 'border-end',
60
+			    'border-left'    => 'border-start',
61
+			    'font-weight-'  => 'fw-',
62
+			    'btn-block'     => 'w-100',
63
+			    'rounded-left'  => 'rounded-start',
64
+			    'rounded-right'  => 'rounded-end',
65
+			    'font-italic' => 'fst-italic',
66 66
 
67
-//			'custom-control custom-checkbox'    => 'form-check',
68
-			// data
69
-			' data-toggle=' => ' data-bs-toggle=',
70
-			'data-ride=' => 'data-bs-ride=',
71
-			'data-controlnav=' => 'data-bs-controlnav=',
72
-			'data-slide='   => 'data-bs-slide=',
73
-			'data-slide-to=' => 'data-bs-slide-to=',
74
-			'data-target='  => 'data-bs-target=',
75
-			'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
-			'class="close"' => 'class="btn-close"',
77
-			'<span aria-hidden="true">&times;</span>' => '',
78
-		);
79
-		$output  = str_replace(
80
-			array_keys( $convert ),
81
-			array_values( $convert ),
82
-			$output
83
-		);
84
-	}
67
+    //			'custom-control custom-checkbox'    => 'form-check',
68
+			    // data
69
+			    ' data-toggle=' => ' data-bs-toggle=',
70
+			    'data-ride=' => 'data-bs-ride=',
71
+			    'data-controlnav=' => 'data-bs-controlnav=',
72
+			    'data-slide='   => 'data-bs-slide=',
73
+			    'data-slide-to=' => 'data-bs-slide-to=',
74
+			    'data-target='  => 'data-bs-target=',
75
+			    'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
+			    'class="close"' => 'class="btn-close"',
77
+			    '<span aria-hidden="true">&times;</span>' => '',
78
+		    );
79
+		    $output  = str_replace(
80
+			    array_keys( $convert ),
81
+			    array_values( $convert ),
82
+			    $output
83
+		    );
84
+	    }
85 85
 
86
-	return $output;
86
+	    return $output;
87 87
 }
88 88
 
89
-add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
89
+    add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
Please login to merge, or discard this patch.
templates/invoice/billing-address.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  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
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
12
+$invoice     = new WPInv_Invoice($invoice);
13
+$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info());
14 14
 $phone       = $invoice->get_phone();
15 15
 $email       = $invoice->get_email();
16 16
 $vat_number  = $invoice->get_vat_number();
@@ -22,47 +22,47 @@  discard block
 block discarded – undo
22 22
 
23 23
 
24 24
             <div class="invoice-billing-address-label col-2">
25
-                <strong><?php esc_html_e( 'To:', 'invoicing' ); ?></strong>
25
+                <strong><?php esc_html_e('To:', 'invoicing'); ?></strong>
26 26
             </div>
27 27
 
28 28
 
29 29
             <div class="invoice-billing-address-value col-10">
30 30
 
31
-                <?php do_action( 'getpaid_billing_address_top' ); ?>
31
+                <?php do_action('getpaid_billing_address_top'); ?>
32 32
 
33
-                <?php if ( ! empty( $address_row ) ) : ?>
33
+                <?php if (!empty($address_row)) : ?>
34 34
                     <div class="billing-address">
35
-                        <?php echo wp_kses_post( $address_row ); ?>
35
+                        <?php echo wp_kses_post($address_row); ?>
36 36
                     </div>
37 37
                 <?php endif; ?>
38 38
 
39 39
 
40
-                <?php if ( ! empty( $phone ) ) : ?>
40
+                <?php if (!empty($phone)) : ?>
41 41
                     <div class="billing-phone">
42
-                        <?php echo wp_sprintf( esc_html__( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
42
+                        <?php echo wp_sprintf(esc_html__('Phone: %s', 'invoicing'), esc_html($phone)); ?>
43 43
                     </div>
44 44
                 <?php endif; ?>
45 45
 
46 46
 
47
-                <?php if ( ! empty( $email ) ) : ?>
47
+                <?php if (!empty($email)) : ?>
48 48
                     <div class="billing-email">
49
-                        <?php echo wp_sprintf( esc_html__( 'Email: %s', 'invoicing' ), esc_html( $email ) ); ?>
49
+                        <?php echo wp_sprintf(esc_html__('Email: %s', 'invoicing'), esc_html($email)); ?>
50 50
                     </div>
51 51
                 <?php endif; ?>
52 52
 
53
-                <?php if ( ! empty( $vat_number ) && wpinv_use_taxes() ) : ?>
53
+                <?php if (!empty($vat_number) && wpinv_use_taxes()) : ?>
54 54
                     <div class="vat-number">
55
-                        <?php echo wp_sprintf( esc_html__( 'Vat Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?>
55
+                        <?php echo wp_sprintf(esc_html__('Vat Number: %s', 'invoicing'), esc_html($vat_number)); ?>
56 56
                     </div>
57 57
                 <?php endif; ?>
58 58
 
59
-                <?php if ( ! empty( $company_id ) ) : ?>
59
+                <?php if (!empty($company_id)) : ?>
60 60
                     <div class="company-id">
61
-                        <?php echo wp_sprintf( esc_html__( 'Company ID: %s', 'invoicing' ), esc_html( $company_id ) ); ?>
61
+                        <?php echo wp_sprintf(esc_html__('Company ID: %s', 'invoicing'), esc_html($company_id)); ?>
62 62
                     </div>
63 63
                 <?php endif; ?>
64 64
 
65
-                <?php do_action( 'getpaid_billing_address_bottom' ); ?>
65
+                <?php do_action('getpaid_billing_address_bottom'); ?>
66 66
 
67 67
             </div>
68 68
 
Please login to merge, or discard this patch.
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Displays the billing address.
4 4
  *
@@ -7,15 +7,15 @@  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
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
14
-$phone       = $invoice->get_phone();
15
-$email       = $invoice->get_email();
16
-$vat_number  = $invoice->get_vat_number();
17
-$company_id  = $invoice->get_company_id();
18
-?>
12
+    $invoice     = new WPInv_Invoice( $invoice );
13
+    $address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
14
+    $phone       = $invoice->get_phone();
15
+    $email       = $invoice->get_email();
16
+    $vat_number  = $invoice->get_vat_number();
17
+    $company_id  = $invoice->get_company_id();
18
+    ?>
19 19
     <div class="getpaid-billing-address form-group mb-3 text-break">
20 20
 
21 21
         <div class="row">
@@ -29,39 +29,39 @@  discard block
 block discarded – undo
29 29
             <div class="invoice-billing-address-value col-10">
30 30
 
31 31
                 <?php do_action( 'getpaid_billing_address_top' ); ?>
32
-
32
+    
33 33
                 <?php if ( ! empty( $address_row ) ) : ?>
34
-                    <div class="billing-address">
34
+                        <div class="billing-address">
35 35
                         <?php echo wp_kses_post( $address_row ); ?>
36
-                    </div>
36
+                        </div>
37 37
                 <?php endif; ?>
38
-
38
+    
39 39
 
40 40
                 <?php if ( ! empty( $phone ) ) : ?>
41
-                    <div class="billing-phone">
41
+                        <div class="billing-phone">
42 42
                         <?php echo wp_sprintf( esc_html__( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
43
-                    </div>
43
+                        </div>
44 44
                 <?php endif; ?>
45
-
45
+    
46 46
 
47 47
                 <?php if ( ! empty( $email ) ) : ?>
48
-                    <div class="billing-email">
48
+                        <div class="billing-email">
49 49
                         <?php echo wp_sprintf( esc_html__( 'Email: %s', 'invoicing' ), esc_html( $email ) ); ?>
50
-                    </div>
50
+                        </div>
51 51
                 <?php endif; ?>
52
-
52
+    
53 53
                 <?php if ( ! empty( $vat_number ) && wpinv_use_taxes() ) : ?>
54
-                    <div class="vat-number">
54
+                        <div class="vat-number">
55 55
                         <?php echo wp_sprintf( esc_html__( 'Vat Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?>
56
-                    </div>
56
+                        </div>
57 57
                 <?php endif; ?>
58
-
58
+    
59 59
                 <?php if ( ! empty( $company_id ) ) : ?>
60
-                    <div class="company-id">
60
+                        <div class="company-id">
61 61
                         <?php echo wp_sprintf( esc_html__( 'Company ID: %s', 'invoicing' ), esc_html( $company_id ) ); ?>
62
-                    </div>
62
+                        </div>
63 63
                 <?php endif; ?>
64
-
64
+    
65 65
                 <?php do_action( 'getpaid_billing_address_bottom' ); ?>
66 66
 
67 67
             </div>
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-plugin.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
  */
16 16
 
17 17
 if ( ! defined( 'ABSPATH' ) ) {
18
-	exit;
18
+    exit;
19 19
 }
20 20
 
21 21
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
22
-	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
22
+    // include the class if needed
23
+    include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
24 24
 }
25 25
 
26 26
 /*
@@ -35,5 +35,5 @@  discard block
 block discarded – undo
35 35
 
36 36
 
37 37
 if ( ! function_exists( 'sd_get_class_build_keys' ) ) {
38
-	include_once( dirname( __FILE__ ) . "/sd-functions.php" );
38
+    include_once( dirname( __FILE__ ) . "/sd-functions.php" );
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@
 block discarded – undo
14 14
  * Tested up to: 6.7
15 15
  */
16 16
 
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
21
+if (!class_exists('WP_Super_Duper')) {
22 22
 	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
23
+	include_once(dirname(__FILE__) . "/wp-super-duper.php");
24 24
 }
25 25
 
26 26
 /*
27 27
  * Hello world example.
28 28
  */
29
-include_once( dirname( __FILE__ ) . "/hello-world.php" );
29
+include_once(dirname(__FILE__) . "/hello-world.php");
30 30
 
31 31
 /*
32 32
  * Map example.
33 33
  */
34
-include_once( dirname( __FILE__ ) . "/map.php" );
34
+include_once(dirname(__FILE__) . "/map.php");
35 35
 
36 36
 
37
-if ( ! function_exists( 'sd_get_class_build_keys' ) ) {
38
-	include_once( dirname( __FILE__ ) . "/sd-functions.php" );
37
+if (!function_exists('sd_get_class_build_keys')) {
38
+	include_once(dirname(__FILE__) . "/sd-functions.php");
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * This is a Hello World test plugin for WP Super Duper Class.
4 4
  *
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
  * Tested up to: 6.7
15 15
  */
16 16
 
17
-if ( ! defined( 'ABSPATH' ) ) {
18
-	exit;
17
+    if ( ! defined( 'ABSPATH' ) ) {
18
+	    exit;
19 19
 }
20 20
 
21
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
22
-	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
21
+    if ( ! class_exists( 'WP_Super_Duper' ) ) {
22
+	    // include the class if needed
23
+	    include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
24 24
 }
25 25
 
26 26
 /*
27 27
  * Hello world example.
28 28
  */
29
-include_once( dirname( __FILE__ ) . "/hello-world.php" );
29
+    include_once( dirname( __FILE__ ) . "/hello-world.php" );
30 30
 
31 31
 /*
32 32
  * Map example.
33 33
  */
34
-include_once( dirname( __FILE__ ) . "/map.php" );
34
+    include_once( dirname( __FILE__ ) . "/map.php" );
35 35
 
36 36
 
37
-if ( ! function_exists( 'sd_get_class_build_keys' ) ) {
38
-	include_once( dirname( __FILE__ ) . "/sd-functions.php" );
37
+    if ( ! function_exists( 'sd_get_class_build_keys' ) ) {
38
+	    include_once( dirname( __FILE__ ) . "/sd-functions.php" );
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/hello-world.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -3,114 +3,114 @@  discard block
 block discarded – undo
3 3
 class SD_Hello_World extends WP_Super_Duper {
4 4
 
5 5
 
6
-	public $arguments;
7
-
8
-	/**
9
-	 * Sets up the widgets name etc
10
-	 */
11
-	public function __construct() {
12
-
13
-		$options = array(
14
-			'textdomain'     => 'super-duper',
15
-			// textdomain of the plugin/theme (used to prefix the Gutenberg block)
16
-			'block-icon'     => 'fas fa-globe-americas',
17
-			// Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
18
-			// OR font-awesome 5 class name: fas fa-globe-americas
19
-			'block-category' => 'widgets',
20
-			// the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
21
-			'block-keywords' => "['hello','world']",
22
-			// used in the block search, MAX 3
23
-			'block-output'   => array( // the block visual output elements as an array
6
+    public $arguments;
7
+
8
+    /**
9
+     * Sets up the widgets name etc
10
+     */
11
+    public function __construct() {
12
+
13
+        $options = array(
14
+            'textdomain'     => 'super-duper',
15
+            // textdomain of the plugin/theme (used to prefix the Gutenberg block)
16
+            'block-icon'     => 'fas fa-globe-americas',
17
+            // Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
18
+            // OR font-awesome 5 class name: fas fa-globe-americas
19
+            'block-category' => 'widgets',
20
+            // the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
21
+            'block-keywords' => "['hello','world']",
22
+            // used in the block search, MAX 3
23
+            'block-output'   => array( // the block visual output elements as an array
24 24
 //				array(
25 25
 //					'element' => 'p',
26 26
 //					'title'   => __( 'Placeholder', 'ayecode-connect' ),
27 27
 //					'class'   => '[%className%]',
28 28
 //					'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
29 29
 //				)
30
-				array(
31
-					'element'       => 'BlocksProps',
32
-					'inner_element' => 'p',
33
-					'blockProps'    => array(
34
-						'className'               => '[%WrapClass%]',
30
+                array(
31
+                    'element'       => 'BlocksProps',
32
+                    'inner_element' => 'p',
33
+                    'blockProps'    => array(
34
+                        'className'               => '[%WrapClass%]',
35 35
 //						'content' => 'Hello: [%after_text%]'
36 36
 //						'if_dangerouslySetInnerHTML' => '{__html: blockstrap_build_shape(props.attributes) }',
37
-					),
38
-					'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
39
-
40
-
41
-				),
42
-			),
43
-			'block-wrap'    => '', // You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
44
-			'class_name'     => __CLASS__,
45
-			// The calling class name
46
-			'base_id'        => 'hello_world',
47
-			// this is used as the widget id and the shortcode id.
48
-			'name'           => __( 'Hello World', 'ayecode-connect' ),
49
-			// the name of the widget/block
50
-			'widget_ops'     => array(
51
-				'classname'   => 'hello-world-class',
52
-				// widget class
53
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ),
54
-				// widget description
55
-			),
56
-			'no_wrap'       => true, // This will prevent the widget being wrapped in the containing widget class div.
57
-			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
58
-				'after_text' => array( // this is the input name=''
59
-					'title'       => __( 'Text after hello:', 'ayecode-connect' ),
60
-					// input title
61
-					'desc'        => __( 'This is the text that will appear after `Hello:`.', 'ayecode-connect' ),
62
-					// input description
63
-					'type'        => 'text',
64
-					// the type of input, test, select, checkbox etc.
65
-					'placeholder' => 'World',
66
-					// the input placeholder text.
67
-					'desc_tip'    => true,
68
-					// if the input should show the widget description text as a tooltip.
69
-					'default'     => 'World',
70
-					// the input default value.
71
-					'advanced'    => false
72
-					// not yet implemented
73
-				),
74
-			)
75
-		);
76
-
77
-		parent::__construct( $options );
78
-	}
79
-
80
-
81
-	/**
82
-	 * This is the output function for the widget, shortcode and block (front end).
83
-	 *
84
-	 * @param array $args The arguments values.
85
-	 * @param array $widget_args The widget arguments when used.
86
-	 * @param string $content The shortcode content argument
87
-	 *
88
-	 * @return string
89
-	 */
90
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
91
-
92
-		/**
93
-		 * @var string $after_text
94
-		 * @var string $another_input This is added by filter below.
95
-		 */
96
-		extract( $args, EXTR_SKIP );
97
-
98
-		/*
37
+                    ),
38
+                    'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
39
+
40
+
41
+                ),
42
+            ),
43
+            'block-wrap'    => '', // You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
44
+            'class_name'     => __CLASS__,
45
+            // The calling class name
46
+            'base_id'        => 'hello_world',
47
+            // this is used as the widget id and the shortcode id.
48
+            'name'           => __( 'Hello World', 'ayecode-connect' ),
49
+            // the name of the widget/block
50
+            'widget_ops'     => array(
51
+                'classname'   => 'hello-world-class',
52
+                // widget class
53
+                'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ),
54
+                // widget description
55
+            ),
56
+            'no_wrap'       => true, // This will prevent the widget being wrapped in the containing widget class div.
57
+            'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
58
+                'after_text' => array( // this is the input name=''
59
+                    'title'       => __( 'Text after hello:', 'ayecode-connect' ),
60
+                    // input title
61
+                    'desc'        => __( 'This is the text that will appear after `Hello:`.', 'ayecode-connect' ),
62
+                    // input description
63
+                    'type'        => 'text',
64
+                    // the type of input, test, select, checkbox etc.
65
+                    'placeholder' => 'World',
66
+                    // the input placeholder text.
67
+                    'desc_tip'    => true,
68
+                    // if the input should show the widget description text as a tooltip.
69
+                    'default'     => 'World',
70
+                    // the input default value.
71
+                    'advanced'    => false
72
+                    // not yet implemented
73
+                ),
74
+            )
75
+        );
76
+
77
+        parent::__construct( $options );
78
+    }
79
+
80
+
81
+    /**
82
+     * This is the output function for the widget, shortcode and block (front end).
83
+     *
84
+     * @param array $args The arguments values.
85
+     * @param array $widget_args The widget arguments when used.
86
+     * @param string $content The shortcode content argument
87
+     *
88
+     * @return string
89
+     */
90
+    public function output( $args = array(), $widget_args = array(), $content = '' ) {
91
+
92
+        /**
93
+         * @var string $after_text
94
+         * @var string $another_input This is added by filter below.
95
+         */
96
+        extract( $args, EXTR_SKIP );
97
+
98
+        /*
99 99
 		 * This value is added by filter so might not exist if filter is removed so we check.
100 100
 		 */
101
-		if ( ! isset( $another_input ) ) {
102
-			$another_input = '';
103
-		}
101
+        if ( ! isset( $another_input ) ) {
102
+            $another_input = '';
103
+        }
104 104
 
105
-		return "Helllo: " . $after_text . "" . $another_input;
105
+        return "Helllo: " . $after_text . "" . $another_input;
106 106
 
107
-	}
107
+    }
108 108
 
109 109
 }
110 110
 
111 111
 // register it.
112 112
 add_action( 'widgets_init', function () {
113
-	register_widget( 'SD_Hello_World' );
113
+    register_widget( 'SD_Hello_World' );
114 114
 } );
115 115
 
116 116
 
@@ -123,26 +123,26 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _my_extra_arguments( $options ) {
125 125
 
126
-	/*
126
+    /*
127 127
 	 * Add a new input option.
128 128
 	 */
129
-	$options['arguments']['another_input'] = array(
130
-		'name'        => 'another_input', // this is the input name=''
131
-		'title'       => __( 'Another input:', 'ayecode-connect' ), // input title
132
-		'desc'        => __( 'This is an input added via filter.', 'ayecode-connect' ), // input description
133
-		'type'        => 'text', // the type of input, test, select, checkbox etc.
134
-		'placeholder' => 'Placeholder text', // the input placeholder text.
135
-		'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
136
-		'default'     => '', // the input default value.
137
-		'advanced'    => false // not yet implemented
138
-	);
139
-
140
-	/*
129
+    $options['arguments']['another_input'] = array(
130
+        'name'        => 'another_input', // this is the input name=''
131
+        'title'       => __( 'Another input:', 'ayecode-connect' ), // input title
132
+        'desc'        => __( 'This is an input added via filter.', 'ayecode-connect' ), // input description
133
+        'type'        => 'text', // the type of input, test, select, checkbox etc.
134
+        'placeholder' => 'Placeholder text', // the input placeholder text.
135
+        'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
136
+        'default'     => '', // the input default value.
137
+        'advanced'    => false // not yet implemented
138
+    );
139
+
140
+    /*
141 141
 	 * Output the new option in the block output also.
142 142
 	 */
143
-	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
143
+    $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
144 144
 
145
-	return $options;
145
+    return $options;
146 146
 }
147 147
 
148 148
 //add_filter( 'wp_super_duper_options_hello_world', '_my_extra_arguments' );
149 149
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 			// The calling class name
46 46
 			'base_id'        => 'hello_world',
47 47
 			// this is used as the widget id and the shortcode id.
48
-			'name'           => __( 'Hello World', 'ayecode-connect' ),
48
+			'name'           => __('Hello World', 'ayecode-connect'),
49 49
 			// the name of the widget/block
50 50
 			'widget_ops'     => array(
51 51
 				'classname'   => 'hello-world-class',
52 52
 				// widget class
53
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ),
53
+				'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect'),
54 54
 				// widget description
55 55
 			),
56 56
 			'no_wrap'       => true, // This will prevent the widget being wrapped in the containing widget class div.
57 57
 			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
58 58
 				'after_text' => array( // this is the input name=''
59
-					'title'       => __( 'Text after hello:', 'ayecode-connect' ),
59
+					'title'       => __('Text after hello:', 'ayecode-connect'),
60 60
 					// input title
61
-					'desc'        => __( 'This is the text that will appear after `Hello:`.', 'ayecode-connect' ),
61
+					'desc'        => __('This is the text that will appear after `Hello:`.', 'ayecode-connect'),
62 62
 					// input description
63 63
 					'type'        => 'text',
64 64
 					// the type of input, test, select, checkbox etc.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			)
75 75
 		);
76 76
 
77
-		parent::__construct( $options );
77
+		parent::__construct($options);
78 78
 	}
79 79
 
80 80
 
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string
89 89
 	 */
90
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
90
+	public function output($args = array(), $widget_args = array(), $content = '') {
91 91
 
92 92
 		/**
93 93
 		 * @var string $after_text
94 94
 		 * @var string $another_input This is added by filter below.
95 95
 		 */
96
-		extract( $args, EXTR_SKIP );
96
+		extract($args, EXTR_SKIP);
97 97
 
98 98
 		/*
99 99
 		 * This value is added by filter so might not exist if filter is removed so we check.
100 100
 		 */
101
-		if ( ! isset( $another_input ) ) {
101
+		if (!isset($another_input)) {
102 102
 			$another_input = '';
103 103
 		}
104 104
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 }
110 110
 
111 111
 // register it.
112
-add_action( 'widgets_init', function () {
113
-	register_widget( 'SD_Hello_World' );
112
+add_action('widgets_init', function() {
113
+	register_widget('SD_Hello_World');
114 114
 } );
115 115
 
116 116
 
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return mixed
123 123
  */
124
-function _my_extra_arguments( $options ) {
124
+function _my_extra_arguments($options) {
125 125
 
126 126
 	/*
127 127
 	 * Add a new input option.
128 128
 	 */
129 129
 	$options['arguments']['another_input'] = array(
130 130
 		'name'        => 'another_input', // this is the input name=''
131
-		'title'       => __( 'Another input:', 'ayecode-connect' ), // input title
132
-		'desc'        => __( 'This is an input added via filter.', 'ayecode-connect' ), // input description
131
+		'title'       => __('Another input:', 'ayecode-connect'), // input title
132
+		'desc'        => __('This is an input added via filter.', 'ayecode-connect'), // input description
133 133
 		'type'        => 'text', // the type of input, test, select, checkbox etc.
134 134
 		'placeholder' => 'Placeholder text', // the input placeholder text.
135 135
 		'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	/*
141 141
 	 * Output the new option in the block output also.
142 142
 	 */
143
-	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
143
+	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]"; ;
144 144
 
145 145
 	return $options;
146 146
 }
Please login to merge, or discard this patch.