@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | * @var GetPaid_Payment_Form $form The current payment form |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -if ( ! getpaid_has_published_discount() ) { |
|
13 | +if (!getpaid_has_published_discount()) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | -$placeholder = esc_attr( $input_label ); |
|
18 | -$label = esc_html( $button_label ); |
|
17 | +$placeholder = esc_attr($input_label); |
|
18 | +$label = esc_html($button_label); |
|
19 | 19 | |
20 | -if ( ! empty( $description ) ) { |
|
20 | +if (!empty($description)) { |
|
21 | 21 | $description = "<small class='form-text text-muted'>$description</small>"; |
22 | 22 | } else { |
23 | 23 | $description = ''; |
24 | 24 | } |
25 | 25 | |
26 | 26 | $discount_code = ''; |
27 | -if ( ! empty( $form->invoice ) ) { |
|
28 | - $discount_code = esc_attr( $form->invoice->get_discount_code() ); |
|
27 | +if (!empty($form->invoice)) { |
|
28 | + $discount_code = esc_attr($form->invoice->get_discount_code()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | ?> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | <input name="discount" placeholder="<?php echo $placeholder; ?>" value="<?php echo $discount_code; ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text"> |
37 | 37 | <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo $label; ?></a> |
38 | 38 | </div> |
39 | - <?php echo wp_kses_post( $description ); ?> |
|
39 | + <?php echo wp_kses_post($description); ?> |
|
40 | 40 | <div class="getpaid-custom-payment-form-errors alert alert-danger d-none"></div> |
41 | 41 | </div> |
42 | 42 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$tag = isset( $element['level'] ) ? trim( $element['level'] ) : 'h3'; |
|
13 | -$text = isset( $element['text'] ) ? wp_kses_post( trim( $element['text'] ) ) : ''; |
|
12 | +$tag = isset($element['level']) ? trim($element['level']) : 'h3'; |
|
13 | +$text = isset($element['text']) ? wp_kses_post(trim($element['text'])) : ''; |
|
14 | 14 | |
15 | -if ( ! empty( $text ) ) { |
|
15 | +if (!empty($text)) { |
|
16 | 16 | echo "<$tag>$text</$tag>"; |
17 | 17 | } |
@@ -7,10 +7,10 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$text = isset( $element['text'] ) ? wp_kses_post( trim( $element['text'] ) ) : ''; |
|
12 | +$text = isset($element['text']) ? wp_kses_post(trim($element['text'])) : ''; |
|
13 | 13 | |
14 | -if ( ! empty( $text ) ) { |
|
14 | +if (!empty($text)) { |
|
15 | 15 | echo "<p>$text</p>"; |
16 | 16 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -72,28 +72,28 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param int|object|GetPaid_Payment_Form|WP_Post $form Form to read. |
74 | 74 | */ |
75 | - public function __construct( $form = 0 ) { |
|
76 | - parent::__construct( $form ); |
|
75 | + public function __construct($form = 0) { |
|
76 | + parent::__construct($form); |
|
77 | 77 | |
78 | - if ( is_numeric( $form ) && $form > 0 ) { |
|
79 | - $this->set_id( $form ); |
|
80 | - } elseif ( $form instanceof self ) { |
|
78 | + if (is_numeric($form) && $form > 0) { |
|
79 | + $this->set_id($form); |
|
80 | + } elseif ($form instanceof self) { |
|
81 | 81 | |
82 | - $this->set_id( $form->get_id() ); |
|
82 | + $this->set_id($form->get_id()); |
|
83 | 83 | $this->invoice = $form->invoice; |
84 | 84 | |
85 | - } elseif ( ! empty( $form->ID ) ) { |
|
86 | - $this->set_id( $form->ID ); |
|
85 | + } elseif (!empty($form->ID)) { |
|
86 | + $this->set_id($form->ID); |
|
87 | 87 | } else { |
88 | - $this->set_object_read( true ); |
|
88 | + $this->set_object_read(true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // Load the datastore. |
92 | - $this->data_store = GetPaid_Data_Store::load( $this->data_store_name ); |
|
92 | + $this->data_store = GetPaid_Data_Store::load($this->data_store_name); |
|
93 | 93 | |
94 | - if ( $this->get_id() > 0 ) { |
|
95 | - $this->post = get_post( $this->get_id() ); |
|
96 | - $this->data_store->read( $this ); |
|
94 | + if ($this->get_id() > 0) { |
|
95 | + $this->post = get_post($this->get_id()); |
|
96 | + $this->data_store->read($this); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @param string $context View or edit context. |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - public function get_version( $context = 'view' ) { |
|
124 | - return $this->get_prop( 'version', $context ); |
|
123 | + public function get_version($context = 'view') { |
|
124 | + return $this->get_prop('version', $context); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param string $context View or edit context. |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public function get_date_created( $context = 'view' ) { |
|
135 | - return $this->get_prop( 'date_created', $context ); |
|
134 | + public function get_date_created($context = 'view') { |
|
135 | + return $this->get_prop('date_created', $context); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param string $context View or edit context. |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function get_date_created_gmt( $context = 'view' ) { |
|
146 | - $date = $this->get_date_created( $context ); |
|
145 | + public function get_date_created_gmt($context = 'view') { |
|
146 | + $date = $this->get_date_created($context); |
|
147 | 147 | |
148 | - if ( $date ) { |
|
149 | - $date = get_gmt_from_date( $date ); |
|
148 | + if ($date) { |
|
149 | + $date = get_gmt_from_date($date); |
|
150 | 150 | } |
151 | 151 | return $date; |
152 | 152 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @param string $context View or edit context. |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public function get_date_modified( $context = 'view' ) { |
|
162 | - return $this->get_prop( 'date_modified', $context ); |
|
161 | + public function get_date_modified($context = 'view') { |
|
162 | + return $this->get_prop('date_modified', $context); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param string $context View or edit context. |
170 | 170 | * @return string |
171 | 171 | */ |
172 | - public function get_date_modified_gmt( $context = 'view' ) { |
|
173 | - $date = $this->get_date_modified( $context ); |
|
172 | + public function get_date_modified_gmt($context = 'view') { |
|
173 | + $date = $this->get_date_modified($context); |
|
174 | 174 | |
175 | - if ( $date ) { |
|
176 | - $date = get_gmt_from_date( $date ); |
|
175 | + if ($date) { |
|
176 | + $date = get_gmt_from_date($date); |
|
177 | 177 | } |
178 | 178 | return $date; |
179 | 179 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param string $context View or edit context. |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function get_name( $context = 'view' ) { |
|
189 | - return $this->get_prop( 'name', $context ); |
|
188 | + public function get_name($context = 'view') { |
|
189 | + return $this->get_prop('name', $context); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | * @param string $context View or edit context. |
197 | 197 | * @return string |
198 | 198 | */ |
199 | - public function get_title( $context = 'view' ) { |
|
200 | - return $this->get_name( $context ); |
|
199 | + public function get_title($context = 'view') { |
|
200 | + return $this->get_name($context); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $context View or edit context. |
208 | 208 | * @return int |
209 | 209 | */ |
210 | - public function get_author( $context = 'view' ) { |
|
211 | - return (int) $this->get_prop( 'author', $context ); |
|
210 | + public function get_author($context = 'view') { |
|
211 | + return (int) $this->get_prop('author', $context); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | * @param string $context View or edit context. |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - public function get_elements( $context = 'view' ) { |
|
222 | - $elements = $this->get_prop( 'elements', $context ); |
|
221 | + public function get_elements($context = 'view') { |
|
222 | + $elements = $this->get_prop('elements', $context); |
|
223 | 223 | |
224 | - if ( empty( $elements ) || ! is_array( $elements ) ) { |
|
225 | - return wpinv_get_data( 'sample-payment-form' ); |
|
224 | + if (empty($elements) || !is_array($elements)) { |
|
225 | + return wpinv_get_data('sample-payment-form'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Ensure that all required elements exist. |
229 | 229 | $_elements = array(); |
230 | - foreach ( $elements as $element ) { |
|
230 | + foreach ($elements as $element) { |
|
231 | 231 | |
232 | - if ( $element['type'] == 'pay_button' && ! $this->has_element_type( 'gateway_select' ) ) { |
|
232 | + if ($element['type'] == 'pay_button' && !$this->has_element_type('gateway_select')) { |
|
233 | 233 | |
234 | 234 | $_elements[] = array( |
235 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
235 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
236 | 236 | 'id' => 'gtscicd', |
237 | 237 | 'name' => 'gtscicd', |
238 | 238 | 'type' => 'gateway_select', |
@@ -257,22 +257,22 @@ discard block |
||
257 | 257 | * @param string $return objects or arrays. |
258 | 258 | * @return GetPaid_Form_Item[] |
259 | 259 | */ |
260 | - public function get_items( $context = 'view', $return = 'objects' ) { |
|
261 | - $items = $this->get_prop( 'items', $context ); |
|
260 | + public function get_items($context = 'view', $return = 'objects') { |
|
261 | + $items = $this->get_prop('items', $context); |
|
262 | 262 | |
263 | - if ( empty( $items ) || ! is_array( $items ) ) { |
|
264 | - $items = wpinv_get_data( 'sample-payment-form-items' ); |
|
263 | + if (empty($items) || !is_array($items)) { |
|
264 | + $items = wpinv_get_data('sample-payment-form-items'); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | // Convert the items. |
268 | 268 | $prepared = array(); |
269 | 269 | |
270 | - foreach ( $items as $key => $value ) { |
|
270 | + foreach ($items as $key => $value) { |
|
271 | 271 | |
272 | 272 | // Form items. |
273 | - if ( $value instanceof GetPaid_Form_Item ) { |
|
273 | + if ($value instanceof GetPaid_Form_Item) { |
|
274 | 274 | |
275 | - if ( $value->can_purchase() ) { |
|
275 | + if ($value->can_purchase()) { |
|
276 | 276 | $prepared[] = $value; |
277 | 277 | } |
278 | 278 | |
@@ -281,16 +281,16 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | // $item_id => $quantity (buy buttons) |
284 | - if ( is_numeric( $key ) && is_numeric( $value ) ) { |
|
285 | - $item = new GetPaid_Form_Item( $key ); |
|
284 | + if (is_numeric($key) && is_numeric($value)) { |
|
285 | + $item = new GetPaid_Form_Item($key); |
|
286 | 286 | |
287 | - if ( $item->can_purchase() ) { |
|
287 | + if ($item->can_purchase()) { |
|
288 | 288 | |
289 | 289 | $value = (float) $value; |
290 | - $item->set_quantity( $value ); |
|
291 | - if ( 0 == $value ) { |
|
292 | - $item->set_quantity( 1 ); |
|
293 | - $item->set_allow_quantities( true ); |
|
290 | + $item->set_quantity($value); |
|
291 | + if (0 == $value) { |
|
292 | + $item->set_quantity(1); |
|
293 | + $item->set_allow_quantities(true); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $prepared[] = $item; |
@@ -300,33 +300,33 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Items saved via payment forms editor. |
303 | - if ( is_array( $value ) && isset( $value['id'] ) ) { |
|
303 | + if (is_array($value) && isset($value['id'])) { |
|
304 | 304 | |
305 | - $item = new GetPaid_Form_Item( $value['id'] ); |
|
305 | + $item = new GetPaid_Form_Item($value['id']); |
|
306 | 306 | |
307 | - if ( ! $item->can_purchase() ) { |
|
307 | + if (!$item->can_purchase()) { |
|
308 | 308 | continue; |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Sub-total (Cart items). |
312 | - if ( isset( $value['subtotal'] ) ) { |
|
313 | - $item->set_price( $value['subtotal'] ); |
|
312 | + if (isset($value['subtotal'])) { |
|
313 | + $item->set_price($value['subtotal']); |
|
314 | 314 | } |
315 | 315 | |
316 | - if ( isset( $value['quantity'] ) ) { |
|
317 | - $item->set_quantity( $value['quantity'] ); |
|
316 | + if (isset($value['quantity'])) { |
|
317 | + $item->set_quantity($value['quantity']); |
|
318 | 318 | } |
319 | 319 | |
320 | - if ( isset( $value['allow_quantities'] ) ) { |
|
321 | - $item->set_allow_quantities( $value['allow_quantities'] ); |
|
320 | + if (isset($value['allow_quantities'])) { |
|
321 | + $item->set_allow_quantities($value['allow_quantities']); |
|
322 | 322 | } |
323 | 323 | |
324 | - if ( isset( $value['required'] ) ) { |
|
325 | - $item->set_is_required( $value['required'] ); |
|
324 | + if (isset($value['required'])) { |
|
325 | + $item->set_is_required($value['required']); |
|
326 | 326 | } |
327 | 327 | |
328 | - if ( isset( $value['description'] ) ) { |
|
329 | - $item->set_custom_description( $value['description'] ); |
|
328 | + if (isset($value['description'])) { |
|
329 | + $item->set_custom_description($value['description']); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | $prepared[] = $item; |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // $item_id => array( 'price' => 10 ) (item variations) |
338 | - if ( is_numeric( $key ) && is_array( $value ) ) { |
|
339 | - $item = new GetPaid_Form_Item( $key ); |
|
338 | + if (is_numeric($key) && is_array($value)) { |
|
339 | + $item = new GetPaid_Form_Item($key); |
|
340 | 340 | |
341 | - if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) { |
|
342 | - $item->set_price( $value['price'] ); |
|
341 | + if (isset($value['price']) && $item->user_can_set_their_price()) { |
|
342 | + $item->set_price($value['price']); |
|
343 | 343 | } |
344 | 344 | |
345 | - if ( $item->can_purchase() ) { |
|
345 | + if ($item->can_purchase()) { |
|
346 | 346 | $prepared[] = $item; |
347 | 347 | } |
348 | 348 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | - if ( 'objects' == $return && 'view' == $context ) { |
|
354 | + if ('objects' == $return && 'view' == $context) { |
|
355 | 355 | return $prepared; |
356 | 356 | } |
357 | 357 | |
358 | 358 | $items = array(); |
359 | - foreach ( $prepared as $item ) { |
|
359 | + foreach ($prepared as $item) { |
|
360 | 360 | $items[] = $item->prepare_data_for_use(); |
361 | 361 | } |
362 | 362 | |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | * @param int $item_id The item id to return. |
371 | 371 | * @return GetPaid_Form_Item|bool |
372 | 372 | */ |
373 | - public function get_item( $item_id ) { |
|
373 | + public function get_item($item_id) { |
|
374 | 374 | |
375 | - if ( empty( $item_id ) || ! is_numeric( $item_id ) ) { |
|
375 | + if (empty($item_id) || !is_numeric($item_id)) { |
|
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | |
379 | - foreach( $this->get_items() as $item ) { |
|
380 | - if ( $item->get_id() == (int) $item_id ) { |
|
379 | + foreach ($this->get_items() as $item) { |
|
380 | + if ($item->get_id() == (int) $item_id) { |
|
381 | 381 | return $item; |
382 | 382 | } |
383 | 383 | } |
@@ -393,15 +393,15 @@ discard block |
||
393 | 393 | * @param string $element_type The element type to return. |
394 | 394 | * @return array|bool |
395 | 395 | */ |
396 | - public function get_element_type( $element_type ) { |
|
396 | + public function get_element_type($element_type) { |
|
397 | 397 | |
398 | - if ( empty( $element_type ) || ! is_scalar( $element_type ) ) { |
|
398 | + if (empty($element_type) || !is_scalar($element_type)) { |
|
399 | 399 | return false; |
400 | 400 | } |
401 | 401 | |
402 | - foreach ( $this->get_prop( 'elements' ) as $element ) { |
|
402 | + foreach ($this->get_prop('elements') as $element) { |
|
403 | 403 | |
404 | - if ( $element['type'] == $element_type ) { |
|
404 | + if ($element['type'] == $element_type) { |
|
405 | 405 | return $element; |
406 | 406 | } |
407 | 407 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | * @param string $context View or edit context. |
419 | 419 | * @return float |
420 | 420 | */ |
421 | - public function get_earned( $context = 'view' ) { |
|
422 | - return $this->get_prop( 'earned', $context ); |
|
421 | + public function get_earned($context = 'view') { |
|
422 | + return $this->get_prop('earned', $context); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | * @param string $context View or edit context. |
430 | 430 | * @return float |
431 | 431 | */ |
432 | - public function get_refunded( $context = 'view' ) { |
|
433 | - return $this->get_prop( 'refunded', $context ); |
|
432 | + public function get_refunded($context = 'view') { |
|
433 | + return $this->get_prop('refunded', $context); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | * @param string $context View or edit context. |
441 | 441 | * @return float |
442 | 442 | */ |
443 | - public function get_cancelled( $context = 'view' ) { |
|
444 | - return $this->get_prop( 'cancelled', $context ); |
|
443 | + public function get_cancelled($context = 'view') { |
|
444 | + return $this->get_prop('cancelled', $context); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | * @param string $context View or edit context. |
452 | 452 | * @return float |
453 | 453 | */ |
454 | - public function get_failed( $context = 'view' ) { |
|
455 | - return $this->get_prop( 'failed', $context ); |
|
454 | + public function get_failed($context = 'view') { |
|
455 | + return $this->get_prop('failed', $context); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public function get_currency() { |
466 | - $currency = empty( $this->invoice ) ? wpinv_get_currency() : $this->invoice->get_currency(); |
|
467 | - return apply_filters( 'getpaid-payment-form-currency', $currency, $this ); |
|
466 | + $currency = empty($this->invoice) ? wpinv_get_currency() : $this->invoice->get_currency(); |
|
467 | + return apply_filters('getpaid-payment-form-currency', $currency, $this); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /* |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @since 1.0.19 |
484 | 484 | */ |
485 | - public function set_version( $value ) { |
|
486 | - $this->set_prop( 'version', $value ); |
|
485 | + public function set_version($value) { |
|
486 | + $this->set_prop('version', $value); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @param string $value Value to set. |
494 | 494 | * @return bool Whether or not the date was set. |
495 | 495 | */ |
496 | - public function set_date_created( $value ) { |
|
497 | - $date = strtotime( $value ); |
|
496 | + public function set_date_created($value) { |
|
497 | + $date = strtotime($value); |
|
498 | 498 | |
499 | - if ( $date ) { |
|
500 | - $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) ); |
|
499 | + if ($date) { |
|
500 | + $this->set_prop('date_created', date('Y-m-d H:i:s', $date)); |
|
501 | 501 | return true; |
502 | 502 | } |
503 | 503 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | * @param string $value Value to set. |
513 | 513 | * @return bool Whether or not the date was set. |
514 | 514 | */ |
515 | - public function set_date_modified( $value ) { |
|
516 | - $date = strtotime( $value ); |
|
515 | + public function set_date_modified($value) { |
|
516 | + $date = strtotime($value); |
|
517 | 517 | |
518 | - if ( $date ) { |
|
519 | - $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) ); |
|
518 | + if ($date) { |
|
519 | + $this->set_prop('date_modified', date('Y-m-d H:i:s', $date)); |
|
520 | 520 | return true; |
521 | 521 | } |
522 | 522 | |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | * @since 1.0.19 |
531 | 531 | * @param string $value New name. |
532 | 532 | */ |
533 | - public function set_name( $value ) { |
|
534 | - $this->set_prop( 'name', sanitize_text_field( $value ) ); |
|
533 | + public function set_name($value) { |
|
534 | + $this->set_prop('name', sanitize_text_field($value)); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | /** |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | * @since 1.0.19 |
541 | 541 | * @param string $value New name. |
542 | 542 | */ |
543 | - public function set_title( $value ) { |
|
544 | - $this->set_name( $value ); |
|
543 | + public function set_title($value) { |
|
544 | + $this->set_name($value); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
@@ -550,8 +550,8 @@ discard block |
||
550 | 550 | * @since 1.0.19 |
551 | 551 | * @param int $value New author. |
552 | 552 | */ |
553 | - public function set_author( $value ) { |
|
554 | - $this->set_prop( 'author', (int) $value ); |
|
553 | + public function set_author($value) { |
|
554 | + $this->set_prop('author', (int) $value); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -561,9 +561,9 @@ discard block |
||
561 | 561 | * @sinve 2.3.4 Array values sanitized. |
562 | 562 | * @param array $value Form elements. |
563 | 563 | */ |
564 | - public function set_elements( $value ) { |
|
565 | - if ( is_array( $value ) ) { |
|
566 | - $this->set_prop( 'elements', wp_kses_post_deep( $value ) ); |
|
564 | + public function set_elements($value) { |
|
565 | + if (is_array($value)) { |
|
566 | + $this->set_prop('elements', wp_kses_post_deep($value)); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
@@ -574,18 +574,18 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @return mixed |
576 | 576 | */ |
577 | - public function sanitize_array_values($value){ |
|
577 | + public function sanitize_array_values($value) { |
|
578 | 578 | |
579 | 579 | // sanitize |
580 | - if(!empty($value )){ |
|
580 | + if (!empty($value)) { |
|
581 | 581 | |
582 | - foreach($value as $key => $val_arr){ |
|
582 | + foreach ($value as $key => $val_arr) { |
|
583 | 583 | |
584 | - if(is_array($val_arr)){ |
|
584 | + if (is_array($val_arr)) { |
|
585 | 585 | // check if we have sub array items. |
586 | 586 | $sub_arr = array(); |
587 | - foreach($val_arr as $key2 => $val2){ |
|
588 | - if(is_array($val2)){ |
|
587 | + foreach ($val_arr as $key2 => $val2) { |
|
588 | + if (is_array($val2)) { |
|
589 | 589 | $sub_arr[$key2] = $this->sanitize_array_values($val2); |
590 | 590 | unset($val_arr[$key][$key2]); |
591 | 591 | } |
@@ -595,14 +595,14 @@ discard block |
||
595 | 595 | $help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : ''; |
596 | 596 | |
597 | 597 | // sanitize array elements |
598 | - $value[$key] = array_map( 'sanitize_text_field', $val_arr ); |
|
598 | + $value[$key] = array_map('sanitize_text_field', $val_arr); |
|
599 | 599 | |
600 | 600 | // add back the description if set |
601 | - if(isset($val_arr['description'])){ $value[$key]['description'] = $help_text;} |
|
601 | + if (isset($val_arr['description'])) { $value[$key]['description'] = $help_text; } |
|
602 | 602 | |
603 | 603 | // add back sub array items after its been sanitized. |
604 | - if ( ! empty( $sub_arr ) ) { |
|
605 | - $value[$key] = array_merge($value[$key],$sub_arr); |
|
604 | + if (!empty($sub_arr)) { |
|
605 | + $value[$key] = array_merge($value[$key], $sub_arr); |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | * @since 1.0.19 |
620 | 620 | * @param array $value Form elements. |
621 | 621 | */ |
622 | - public function set_items( $value ) { |
|
623 | - if ( is_array( $value ) ) { |
|
624 | - $this->set_prop( 'items', $value ); |
|
622 | + public function set_items($value) { |
|
623 | + if (is_array($value)) { |
|
624 | + $this->set_prop('items', $value); |
|
625 | 625 | } |
626 | 626 | } |
627 | 627 | |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | * @since 1.0.19 |
632 | 632 | * @param float $value Amount earned. |
633 | 633 | */ |
634 | - public function set_earned( $value ) { |
|
635 | - $value = max( (float) $value, 0 ); |
|
636 | - $this->set_prop( 'earned', $value ); |
|
634 | + public function set_earned($value) { |
|
635 | + $value = max((float) $value, 0); |
|
636 | + $this->set_prop('earned', $value); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | * @since 1.0.19 |
643 | 643 | * @param float $value Amount refunded. |
644 | 644 | */ |
645 | - public function set_refunded( $value ) { |
|
646 | - $value = max( (float) $value, 0 ); |
|
647 | - $this->set_prop( 'refunded', $value ); |
|
645 | + public function set_refunded($value) { |
|
646 | + $value = max((float) $value, 0); |
|
647 | + $this->set_prop('refunded', $value); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | /** |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | * @since 1.0.19 |
654 | 654 | * @param float $value Amount cancelled. |
655 | 655 | */ |
656 | - public function set_cancelled( $value ) { |
|
657 | - $value = max( (float) $value, 0 ); |
|
658 | - $this->set_prop( 'cancelled', $value ); |
|
656 | + public function set_cancelled($value) { |
|
657 | + $value = max((float) $value, 0); |
|
658 | + $this->set_prop('cancelled', $value); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | /** |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | * @since 1.0.19 |
665 | 665 | * @param float $value Amount cancelled. |
666 | 666 | */ |
667 | - public function set_failed( $value ) { |
|
668 | - $value = max( (float) $value, 0 ); |
|
669 | - $this->set_prop( 'failed', $value ); |
|
667 | + public function set_failed($value) { |
|
668 | + $value = max((float) $value, 0); |
|
669 | + $this->set_prop('failed', $value); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -675,11 +675,11 @@ discard block |
||
675 | 675 | * @deprecated |
676 | 676 | * @return int item id |
677 | 677 | */ |
678 | - public function create( $data = array() ) { |
|
678 | + public function create($data = array()) { |
|
679 | 679 | |
680 | 680 | // Set the properties. |
681 | - if ( is_array( $data ) ) { |
|
682 | - $this->set_props( $data ); |
|
681 | + if (is_array($data)) { |
|
682 | + $this->set_props($data); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | // Save the item. |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | * @deprecated |
694 | 694 | * @return int item id |
695 | 695 | */ |
696 | - public function update( $data = array() ) { |
|
697 | - return $this->create( $data ); |
|
696 | + public function update($data = array()) { |
|
697 | + return $this->create($data); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /* |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function is_default() { |
716 | 716 | $is_default = $this->get_id() == wpinv_get_default_payment_form(); |
717 | - return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->get_id(), $this ); |
|
717 | + return (bool) apply_filters('wpinv_is_default_payment_form', $is_default, $this->get_id(), $this); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -726,11 +726,11 @@ discard block |
||
726 | 726 | public function is_active() { |
727 | 727 | $is_active = 0 !== (int) $this->get_id(); |
728 | 728 | |
729 | - if ( $is_active && ! current_user_can( 'edit_post', $this->get_id() ) && $this->get_status() != 'publish' ) { |
|
729 | + if ($is_active && !current_user_can('edit_post', $this->get_id()) && $this->get_status() != 'publish') { |
|
730 | 730 | $is_active = false; |
731 | 731 | } |
732 | 732 | |
733 | - return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this ); |
|
733 | + return (bool) apply_filters('wpinv_is_payment_form_active', $is_active, $this); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | * @since 1.0.19 |
740 | 740 | * @return bool |
741 | 741 | */ |
742 | - public function has_item( $item_id ) { |
|
743 | - return false !== $this->get_item( $item_id ); |
|
742 | + public function has_item($item_id) { |
|
743 | + return false !== $this->get_item($item_id); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | /** |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | * @since 1.0.19 |
750 | 750 | * @return bool |
751 | 751 | */ |
752 | - public function has_element_type( $element_type ) { |
|
753 | - return false !== $this->get_element_type( $element_type ); |
|
752 | + public function has_element_type($element_type) { |
|
753 | + return false !== $this->get_element_type($element_type); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | /** |
@@ -761,13 +761,13 @@ discard block |
||
761 | 761 | */ |
762 | 762 | public function is_recurring() { |
763 | 763 | |
764 | - if ( ! empty( $this->invoice ) ) { |
|
764 | + if (!empty($this->invoice)) { |
|
765 | 765 | return $this->invoice->is_recurring(); |
766 | 766 | } |
767 | 767 | |
768 | - foreach ( $this->get_items() as $item ) { |
|
768 | + foreach ($this->get_items() as $item) { |
|
769 | 769 | |
770 | - if ( $item->is_recurring() ) { |
|
770 | + if ($item->is_recurring()) { |
|
771 | 771 | return true; |
772 | 772 | } |
773 | 773 | |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @since 1.0.19 |
783 | 783 | */ |
784 | - public function get_html( $extra_markup = '' ) { |
|
784 | + public function get_html($extra_markup = '') { |
|
785 | 785 | |
786 | 786 | // Return the HTML. |
787 | 787 | return wpinv_get_template_html( |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | * |
800 | 800 | * @since 1.0.19 |
801 | 801 | */ |
802 | - public function display( $extra_markup = '' ) { |
|
803 | - echo $this->get_html( $extra_markup ); |
|
802 | + public function display($extra_markup = '') { |
|
803 | + echo $this->get_html($extra_markup); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | } |