Passed
Push — master ( 32accd...dc49db )
by Brian
05:22
created
templates/payment-forms/elements/website.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19
-$current_url = ! empty( $_GET['current_url'] ) ? esc_url_raw( urldecode( $_GET['current_url'] ) ) : get_permalink();
19
+$current_url = !empty($_GET['current_url']) ? esc_url_raw(urldecode($_GET['current_url'])) : get_permalink();
20 20
 aui()->input(
21 21
     array(
22
-        'name'        => esc_attr( $id ),
23
-        'id'          => esc_attr( $element_id ),
24
-        'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
25
-        'required'    => ! empty( $required ),
22
+        'name'        => esc_attr($id),
23
+        'id'          => esc_attr($element_id),
24
+        'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
25
+        'required'    => !empty($required),
26 26
         'label'       => $label,
27 27
         'label_type'  => 'vertical',
28
-        'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
28
+        'help_text'   => empty($description) ? '' : wp_kses_post($description),
29 29
         'type'        => 'url',
30
-        'value'       => ! empty( $default_current_post ) ? $current_url : '',
30
+        'value'       => !empty($default_current_post) ? $current_url : '',
31 31
         'class'       => $label_class,
32 32
     ),
33 33
     true
Please login to merge, or discard this patch.
templates/payment-forms/elements/radio.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->radio(
20 20
     array(
21
-        'name'       => esc_attr( $id ),
22
-        'id'         => esc_attr( $element_id ),
23
-        'required'   => ! empty( $required ),
21
+        'name'       => esc_attr($id),
22
+        'id'         => esc_attr($element_id),
23
+        'required'   => !empty($required),
24 24
         'label'      => $label,
25 25
         'label_type' => 'vertical',
26 26
         'class'      => 'w-auto',
27 27
         'inline'     => false,
28
-        'options'    => empty( $options ) ? array() : array_combine( $options, $options ),
29
-        'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
28
+        'options'    => empty($options) ? array() : array_combine($options, $options),
29
+        'help_text'  => empty($description) ? '' : wp_kses_post($description),
30 30
         'class'      => $label_class,
31 31
     ),
32 32
     true
Please login to merge, or discard this patch.
templates/payment-forms/elements/billing_email.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 $value = $query_value;
13 13
 $class = '';
14 14
 
15
-if ( ! empty( $form->invoice ) ) {
16
-    $value   = sanitize_email( $form->invoice->get_email() );
17
-} elseif ( is_user_logged_in() ) {
15
+if (!empty($form->invoice)) {
16
+    $value = sanitize_email($form->invoice->get_email());
17
+} elseif (is_user_logged_in()) {
18 18
     $user  = wp_get_current_user();
19
-    $value = sanitize_email( $user->user_email );
19
+    $value = sanitize_email($user->user_email);
20 20
 }
21 21
 
22
-if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) {
22
+if (!empty($value) && !empty($hide_billing_email)) {
23 23
     $class = 'd-none';
24 24
 }
25 25
 
26
-do_action( 'getpaid_before_payment_form_billing_email', $form );
26
+do_action('getpaid_before_payment_form_billing_email', $form);
27 27
 
28
-echo "<span class='" . esc_attr( $class ) . "'>";
28
+echo "<span class='" . esc_attr($class) . "'>";
29 29
 
30 30
 aui()->input(
31 31
     array(
32 32
         'name'             => 'billing_email',
33
-        'id'               => esc_attr( $element_id ),
34
-        'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
35
-        'required'         => ! empty( $required ),
36
-        'label'            => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>',
33
+        'id'               => esc_attr($element_id),
34
+        'placeholder'      => empty($placeholder) ? '' : esc_attr($placeholder),
35
+        'required'         => !empty($required),
36
+        'label'            => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>',
37 37
         'label_type'       => 'vertical',
38
-        'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
38
+        'help_text'        => empty($description) ? '' : wp_kses_post($description),
39 39
         'type'             => 'email',
40 40
         'value'            => $value,
41 41
         'class'            => 'wpinv_billing_email',
@@ -48,4 +48,4 @@  discard block
 block discarded – undo
48 48
 
49 49
 echo '</span>';
50 50
 
51
-do_action( 'getpaid_after_payment_form_billing_email', $form );
51
+do_action('getpaid_after_payment_form_billing_email', $form);
Please login to merge, or discard this patch.
templates/payment-forms/elements/textarea.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->textarea(
20 20
     array(
21
-        'name'        => esc_attr( $id ),
22
-        'id'          => esc_attr( $element_id ),
23
-        'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
24
-        'required'    => ! empty( $required ),
21
+        'name'        => esc_attr($id),
22
+        'id'          => esc_attr($element_id),
23
+        'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
24
+        'required'    => !empty($required),
25 25
         'label'       => $label,
26 26
         'label_type'  => 'vertical',
27
-        'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
27
+        'help_text'   => empty($description) ? '' : wp_kses_post($description),
28 28
         'class'       => $label_class,
29 29
     ),
30 30
     true
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_select.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Ensure that we have options.
13
-if ( empty( $options ) ) {
13
+if (empty($options)) {
14 14
     return;
15 15
 }
16 16
 
17 17
 // Prepare price options.
18
-$options = getpaid_convert_price_string_to_options( $options );
19
-$keys    = array_keys( $options );
20
-$value   = empty( $options ) ? '' : $keys[0];
18
+$options = getpaid_convert_price_string_to_options($options);
19
+$keys    = array_keys($options);
20
+$value   = empty($options) ? '' : $keys[0];
21 21
 
22 22
 // Prepare id.
23
-$id = esc_attr( $id );
23
+$id = esc_attr($id);
24 24
 
25
-$select_type = empty( $select_type ) ? 'select' : $select_type;
25
+$select_type = empty($select_type) ? 'select' : $select_type;
26 26
 
27 27
 // Item select;
28
-if ( $select_type == 'select' ) {
28
+if ($select_type == 'select') {
29 29
     aui()->select(
30 30
         array(
31 31
             'name'        => $id,
32
-            'id'          => esc_attr( $element_id ),
33
-            'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
32
+            'id'          => esc_attr($element_id),
33
+            'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
34 34
             'value'       => $value,
35
-            'label'       => empty( $label ) ? '' : esc_html( $label ),
35
+            'label'       => empty($label) ? '' : esc_html($label),
36 36
             'label_type'  => 'vertical',
37 37
             'class'       => 'getpaid-price-select-dropdown getpaid-refresh-on-change',
38
-            'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
38
+            'help_text'   => empty($description) ? '' : wp_kses_post($description),
39 39
             'options'     => $options,
40 40
         ),
41 41
         true
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 }
45 45
 
46 46
 // Item radios;
47
-if ( $select_type == 'radios' ) {
47
+if ($select_type == 'radios') {
48 48
     aui()->radio(
49 49
         array(
50
-            'name'       => esc_attr( $id ),
51
-            'id'         => esc_attr( $id ) . uniqid( '_' ),
52
-            'label'      => empty( $label ) ? '' : esc_html( $label ),
50
+            'name'       => esc_attr($id),
51
+            'id'         => esc_attr($id) . uniqid('_'),
52
+            'label'      => empty($label) ? '' : esc_html($label),
53 53
             'label_type' => 'vertical',
54 54
             'class'      => 'getpaid-price-select-radio getpaid-refresh-on-change w-100',
55 55
             'value'      => $value,
56 56
             'inline'     => false,
57 57
             'options'    => $options,
58
-            'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
58
+            'help_text'  => empty($description) ? '' : wp_kses_post($description),
59 59
         ),
60 60
         true
61 61
     );
@@ -64,32 +64,32 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 // Display the label.
67
-if ( ! empty( $label ) ) {
68
-    echo '<label>' . esc_html( $label ) . '</label>';
67
+if (!empty($label)) {
68
+    echo '<label>' . esc_html($label) . '</label>';
69 69
 }
70 70
 
71 71
 // Item buttons;
72
-if ( $select_type == 'buttons' || $select_type == 'circles' ) {
72
+if ($select_type == 'buttons' || $select_type == 'circles') {
73 73
 
74 74
     $class = 'getpaid-price-buttons';
75 75
 
76
-    if ( $select_type == 'circles' ) {
76
+    if ($select_type == 'circles') {
77 77
         $class .= ' getpaid-price-circles';
78 78
     }
79
-    echo "<div class='" . esc_attr( $class ) . "'>";
79
+    echo "<div class='" . esc_attr($class) . "'>";
80 80
 
81
-    foreach ( $options as $price => $label ) {
82
-        $_id = $id . uniqid( '_' );
81
+    foreach ($options as $price => $label) {
82
+        $_id = $id . uniqid('_');
83 83
 
84 84
         $class = 'rounded';
85 85
 
86
-        if ( $select_type == 'circles' ) {
86
+        if ($select_type == 'circles') {
87 87
             $class = '';
88 88
         }
89 89
         echo "
90 90
             <span class='d-inline-block'>
91
-                <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr( $_id ) . "' value='" . esc_attr( $price ) . "' name='" . esc_attr( $id ) . "' " . checked( $price, $value, false ) . " />
92
-                <label for='" . esc_attr( $_id ) . "' class='" . esc_attr( $class ) . "'><span>" . esc_html( $label ) . '</span></label>
91
+                <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr($_id) . "' value='" . esc_attr($price) . "' name='" . esc_attr($id) . "' " . checked($price, $value, false) . " />
92
+                <label for='" . esc_attr($_id) . "' class='" . esc_attr($class) . "'><span>" . esc_html($label) . '</span></label>
93 93
             </span>
94 94
             ';
95 95
     }
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 // Item checkboxes;
102
-if ( $select_type == 'checkboxes' ) {
102
+if ($select_type == 'checkboxes') {
103 103
     echo '<div class="form-group">';
104 104
 
105
-    foreach ( $options as $price => $label ) {
105
+    foreach ($options as $price => $label) {
106 106
         echo "
107 107
             <label class='d-block'>
108
-                <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr( $id ) . "[]' value='" . esc_attr( $price ) . "' " . checked( $price, $value, false ) . ' />
109
-                <span>' . esc_html( $label ) . '</span>
108
+                <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr($id) . "[]' value='" . esc_attr($price) . "' " . checked($price, $value, false) . ' />
109
+                <span>' . esc_html($label) . '</span>
110 110
             </label>
111 111
             ';
112 112
     }
@@ -115,6 +115,6 @@  discard block
 block discarded – undo
115 115
 
116 116
 }
117 117
 
118
-if ( ! empty( $description ) ) {
119
-    echo "<small class='form-text text-muted'>" . wp_kses_post( $description ) . '</small>';
118
+if (!empty($description)) {
119
+    echo "<small class='form-text text-muted'>" . wp_kses_post($description) . '</small>';
120 120
 }
Please login to merge, or discard this patch.
templates/payment-forms/form.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         // And the optional invoice id.
59 59
         if ( ! empty( $form->invoice ) ) {
60
-		    getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
60
+            getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
61 61
         }
62 62
 
63 63
         // We also want to include the form id.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
                     foreach ( $form->get_elements() as $element ) {
79 79
 
80
-					    if ( isset( $element['type'] ) ) {
80
+                        if ( isset( $element['type'] ) ) {
81 81
                             $grid_class = getpaid_get_form_element_grid_class( $element );
82 82
                             echo "<div class='" . esc_attr( $grid_class ) . "'>";
83 83
                             do_action( 'getpaid_payment_form_element', $element, $form );
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Standardize IDs.
13 13
 global $rendered_getpaid_forms;
14 14
 
15 15
 // Make sure that the form is active.
16
-if ( ! $form->is_active() ) {
16
+if (!$form->is_active()) {
17 17
     aui()->alert(
18 18
         array(
19 19
             'type'    => 'warning',
20
-            'content' => __( 'This payment form is no longer active', 'invoicing' ),
20
+            'content' => __('This payment form is no longer active', 'invoicing'),
21 21
         ),
22 22
         true
23 23
     );
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 }
26 26
 
27 27
 // Require login to checkout.
28
-if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) {
28
+if (wpinv_require_login_to_checkout() && !get_current_user_id()) {
29 29
 
30 30
     aui()->alert(
31 31
         array(
32 32
             'type'    => 'danger',
33
-            'content' => __( 'You must be logged in to checkout.', 'invoicing' ),
33
+            'content' => __('You must be logged in to checkout.', 'invoicing'),
34 34
         ),
35 35
         true
36 36
     );
@@ -38,36 +38,36 @@  discard block
 block discarded – undo
38 38
 
39 39
 }
40 40
 
41
-if ( ! is_array( $rendered_getpaid_forms ) ) {
41
+if (!is_array($rendered_getpaid_forms)) {
42 42
     $rendered_getpaid_forms = array();
43 43
 }
44 44
 
45
-$rendered_getpaid_forms[ $form->get_id() ] = isset( $rendered_getpaid_forms[ $form->get_id() ] ) ? $rendered_getpaid_forms[ $form->get_id() ] + 1 : 0;
45
+$rendered_getpaid_forms[$form->get_id()] = isset($rendered_getpaid_forms[$form->get_id()]) ? $rendered_getpaid_forms[$form->get_id()] + 1 : 0;
46 46
 
47 47
 // Fires before displaying a payment form.
48
-do_action( 'getpaid_before_payment_form', $form );
48
+do_action('getpaid_before_payment_form', $form);
49 49
 ?>
50 50
 
51
-<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr( uniqid( 'gpf' ) ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate>
51
+<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr(uniqid('gpf')); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate>
52 52
 
53 53
     <?php
54 54
 
55 55
         // Fires when printing the top of a payment form.
56
-        do_action( 'getpaid_payment_form_top', $form );
56
+        do_action('getpaid_payment_form_top', $form);
57 57
 
58 58
         // And the optional invoice id.
59
-        if ( ! empty( $form->invoice ) ) {
60
-		    getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
59
+        if (!empty($form->invoice)) {
60
+		    getpaid_hidden_field('invoice_id', $form->invoice->get_id());
61 61
         }
62 62
 
63 63
         // We also want to include the form id.
64
-        getpaid_hidden_field( 'form_id', $form->get_id() );
64
+        getpaid_hidden_field('form_id', $form->get_id());
65 65
 
66 66
         // And an indication that this is a payment form submission.
67
-        getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
67
+        getpaid_hidden_field('getpaid_payment_form_submission', '1');
68 68
 
69 69
         // Fires before displaying payment form elements.
70
-        do_action( 'getpaid_payment_form_before_elements', $form );
70
+        do_action('getpaid_payment_form_before_elements', $form);
71 71
 
72 72
         // Display the elements.
73 73
         ?>
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
             <div class="row">
76 76
                 <?php
77 77
 
78
-                    foreach ( $form->get_elements() as $element ) {
78
+                    foreach ($form->get_elements() as $element) {
79 79
 
80
-					    if ( isset( $element['type'] ) ) {
81
-                            $grid_class = getpaid_get_form_element_grid_class( $element );
82
-                            echo "<div class='" . esc_attr( $grid_class ) . "'>";
83
-                            do_action( 'getpaid_payment_form_element', $element, $form );
84
-                            do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
80
+					    if (isset($element['type'])) {
81
+                            $grid_class = getpaid_get_form_element_grid_class($element);
82
+                            echo "<div class='" . esc_attr($grid_class) . "'>";
83
+                            do_action('getpaid_payment_form_element', $element, $form);
84
+                            do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form);
85 85
                             echo '</div>';
86 86
                         }
87 87
                     }
@@ -92,28 +92,28 @@  discard block
 block discarded – undo
92 92
 
93 93
         <?php
94 94
         // Fires after displaying payment form elements.
95
-        do_action( 'getpaid_payment_form_after_elements', $form );
95
+        do_action('getpaid_payment_form_after_elements', $form);
96 96
 
97 97
         echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
98 98
 
99
-        if ( wpinv_current_user_can_manage_invoicing() ) {
99
+        if (wpinv_current_user_can_manage_invoicing()) {
100 100
 
101 101
             edit_post_link(
102
-                __( 'Edit this form.', 'invoicing' ),
102
+                __('Edit this form.', 'invoicing'),
103 103
                 '<small class="form-text text-muted">',
104
-                '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
104
+                '&nbsp;' . __('This is only visible to website administators.', 'invoicing') . '</small>',
105 105
                 $form->get_id(),
106 106
                 'text-danger'
107 107
             );
108 108
 
109 109
         }
110 110
 
111
-        echo wp_kses( $extra_markup, getpaid_allowed_html() );
111
+        echo wp_kses($extra_markup, getpaid_allowed_html());
112 112
     ?>
113 113
 
114 114
     <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;">
115 115
         <div class="spinner-border mx-auto align-self-center text-white" role="status">
116
-            <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span>
116
+            <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span>
117 117
         </div>
118 118
     </div>
119 119
 
@@ -122,4 +122,4 @@  discard block
 block discarded – undo
122 122
 <?php
123 123
 
124 124
 // Fires after displaying a payment form.
125
-do_action( 'getpaid_after_payment_form', $form );
125
+do_action('getpaid_after_payment_form', $form);
Please login to merge, or discard this patch.