Passed
Pull Request — master (#775)
by
unknown
13:25
created
templates/payment-forms/form.php 1 patch
Switch Indentation   +75 added lines, -75 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 a payment form
4 4
  *
@@ -7,112 +7,112 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
11
-
12
-// Standardize IDs.
13
-global $rendered_getpaid_forms;
14
-
15
-// Make sure that the form is active.
16
-if ( ! $form->is_active() ) {
17
-    aui()->alert(
18
-        array(
19
-            'type'    => 'warning',
20
-            'content' => __( 'This payment form is no longer active', 'invoicing' ),
21
-        ),
22
-        true
23
-    );
24
-    return;
10
+    defined( 'ABSPATH' ) || exit;
11
+
12
+    // Standardize IDs.
13
+    global $rendered_getpaid_forms;
14
+
15
+    // Make sure that the form is active.
16
+    if ( ! $form->is_active() ) {
17
+        aui()->alert(
18
+            array(
19
+                'type'    => 'warning',
20
+                'content' => __( 'This payment form is no longer active', 'invoicing' ),
21
+            ),
22
+            true
23
+        );
24
+        return;
25 25
 }
26 26
 
27
-// Require login to checkout.
28
-if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) {
27
+    // Require login to checkout.
28
+    if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) {
29 29
 
30
-    aui()->alert(
31
-        array(
32
-            'type'    => 'danger',
33
-            'content' => __( 'You must be logged in to checkout.', 'invoicing' ),
34
-        ),
35
-        true
36
-    );
37
-    return;
30
+        aui()->alert(
31
+            array(
32
+                'type'    => 'danger',
33
+                'content' => __( 'You must be logged in to checkout.', 'invoicing' ),
34
+            ),
35
+            true
36
+        );
37
+        return;
38 38
 
39 39
 }
40 40
 
41
-if ( ! is_array( $rendered_getpaid_forms ) ) {
42
-    $rendered_getpaid_forms = array();
41
+    if ( ! is_array( $rendered_getpaid_forms ) ) {
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
-// Fires before displaying a payment form.
48
-do_action( 'getpaid_before_payment_form', $form );
49
-?>
47
+    // Fires before displaying a payment form.
48
+    do_action( 'getpaid_before_payment_form', $form );
49
+    ?>
50 50
 
51 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
-        // Fires when printing the top of a payment form.
56
-        do_action( 'getpaid_payment_form_top', $form );
55
+            // Fires when printing the top of a payment form.
56
+            do_action( 'getpaid_payment_form_top', $form );
57 57
 
58
-        // And the optional invoice id.
59
-        if ( ! empty( $form->invoice ) ) {
60
-		    getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
61
-        }
58
+            // And the optional invoice id.
59
+            if ( ! empty( $form->invoice ) ) {
60
+		        getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
61
+            }
62 62
 
63
-        // We also want to include the form id.
64
-        getpaid_hidden_field( 'form_id', $form->get_id() );
63
+            // We also want to include the form id.
64
+            getpaid_hidden_field( 'form_id', $form->get_id() );
65 65
 
66
-        // And an indication that this is a payment form submission.
67
-        getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
66
+            // And an indication that this is a payment form submission.
67
+            getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
68 68
 
69
-        // Fires before displaying payment form elements.
70
-        do_action( 'getpaid_payment_form_before_elements', $form );
69
+            // Fires before displaying payment form elements.
70
+            do_action( 'getpaid_payment_form_before_elements', $form );
71 71
 
72
-        // Display the elements.
73
-        ?>
72
+            // Display the elements.
73
+            ?>
74 74
         <div class="container-fluid">
75 75
             <div class="row">
76 76
                 <?php
77 77
 
78
-                    foreach ( $form->get_elements() as $element ) {
79
-					    if ( isset( $element['type'] ) ) {
80
-                            $grid_class = getpaid_get_form_element_grid_class( $element );
81
-                            do_action( 'getpaid_payment_form_element_before', $element, $form );
82
-                            do_action( "getpaid_payment_form_element_before_{$element['type']}_template", $element, $form );
83
-                            echo "<div class='" . esc_attr( $grid_class ) . "'>";
84
-                            do_action( 'getpaid_payment_form_element', $element, $form );
85
-                            do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
86
-                            echo '</div>';
87
-                            do_action( 'getpaid_payment_form_element_after', $element, $form );
88
-                            do_action( "getpaid_payment_form_element_after_{$element['type']}_template", $element, $form );
78
+                        foreach ( $form->get_elements() as $element ) {
79
+					        if ( isset( $element['type'] ) ) {
80
+                                $grid_class = getpaid_get_form_element_grid_class( $element );
81
+                                do_action( 'getpaid_payment_form_element_before', $element, $form );
82
+                                do_action( "getpaid_payment_form_element_before_{$element['type']}_template", $element, $form );
83
+                                echo "<div class='" . esc_attr( $grid_class ) . "'>";
84
+                                do_action( 'getpaid_payment_form_element', $element, $form );
85
+                                do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
86
+                                echo '</div>';
87
+                                do_action( 'getpaid_payment_form_element_after', $element, $form );
88
+                                do_action( "getpaid_payment_form_element_after_{$element['type']}_template", $element, $form );
89
+                            }
89 90
                         }
90
-                    }
91 91
 
92
-                ?>
92
+                    ?>
93 93
             </div>
94 94
         </div>
95 95
 
96 96
         <?php
97
-        // Fires after displaying payment form elements.
98
-        do_action( 'getpaid_payment_form_after_elements', $form );
97
+            // Fires after displaying payment form elements.
98
+            do_action( 'getpaid_payment_form_after_elements', $form );
99 99
 
100
-        echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
100
+            echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
101 101
 
102
-        if ( wpinv_current_user_can_manage_invoicing() ) {
102
+            if ( wpinv_current_user_can_manage_invoicing() ) {
103 103
 
104
-            edit_post_link(
105
-                __( 'Edit this form.', 'invoicing' ),
106
-                '<small class="form-text text-muted">',
107
-                '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
108
-                $form->get_id(),
109
-                'text-danger'
110
-            );
104
+                edit_post_link(
105
+                    __( 'Edit this form.', 'invoicing' ),
106
+                    '<small class="form-text text-muted">',
107
+                    '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
108
+                    $form->get_id(),
109
+                    'text-danger'
110
+                );
111 111
 
112
-        }
112
+            }
113 113
 
114
-        echo wp_kses( $extra_markup, getpaid_allowed_html() );
115
-    ?>
114
+            echo wp_kses( $extra_markup, getpaid_allowed_html() );
115
+        ?>
116 116
 
117 117
     <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;">
118 118
         <div class="spinner-border mx-auto align-self-center text-white" role="status">
@@ -124,5 +124,5 @@  discard block
 block discarded – undo
124 124
 
125 125
 <?php
126 126
 
127
-// Fires after displaying a payment form.
128
-do_action( 'getpaid_after_payment_form', $form );
127
+    // Fires after displaying a payment form.
128
+    do_action( 'getpaid_after_payment_form', $form );
Please login to merge, or discard this patch.