Passed
Pull Request — master (#387)
by Brian
08:47
created
includes/wpinv-general-functions.php 3 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 function wpinv_can_checkout() {
34
-	$can_checkout = true; // Always true for now
34
+    $can_checkout = true; // Always true for now
35 35
 
36
-	return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
36
+    return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
37 37
 }
38 38
 
39 39
 function wpinv_get_success_page_uri() {
40
-	$page_id = wpinv_get_option( 'success_page', 0 );
41
-	$page_id = absint( $page_id );
40
+    $page_id = wpinv_get_option( 'success_page', 0 );
41
+    $page_id = absint( $page_id );
42 42
 
43
-	return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
43
+    return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
44 44
 }
45 45
 
46 46
 function wpinv_get_history_page_uri() {
47
-	$page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
-	$page_id = absint( $page_id );
47
+    $page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
+    $page_id = absint( $page_id );
49 49
 
50
-	return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
50
+    return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
51 51
 }
52 52
 
53 53
 function wpinv_is_success_page() {
54
-	$is_success_page = wpinv_get_option( 'success_page', false );
55
-	$is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
54
+    $is_success_page = wpinv_get_option( 'success_page', false );
55
+    $is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
56 56
 
57
-	return apply_filters( 'wpinv_is_success_page', $is_success_page );
57
+    return apply_filters( 'wpinv_is_success_page', $is_success_page );
58 58
 }
59 59
 
60 60
 function wpinv_is_invoice_history_page() {
61
-	$ret = wpinv_get_option( 'invoice_history_page', false );
62
-	$ret = $ret ? is_page( $ret ) : false;
63
-	return apply_filters( 'wpinv_is_invoice_history_page', $ret );
61
+    $ret = wpinv_get_option( 'invoice_history_page', false );
62
+    $ret = $ret ? is_page( $ret ) : false;
63
+    return apply_filters( 'wpinv_is_invoice_history_page', $ret );
64 64
 }
65 65
 
66 66
 function wpinv_is_subscriptions_history_page() {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 }
84 84
 
85 85
 function wpinv_send_to_failed_page( $args = null ) {
86
-	$redirect = wpinv_get_failed_transaction_uri();
86
+    $redirect = wpinv_get_failed_transaction_uri();
87 87
     
88 88
     if ( !empty( $args ) ) {
89 89
         // Check for backward compatibility
@@ -103,73 +103,73 @@  discard block
 block discarded – undo
103 103
 }
104 104
 
105 105
 function wpinv_get_checkout_uri( $args = array() ) {
106
-	$uri = wpinv_get_option( 'checkout_page', false );
107
-	$uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
106
+    $uri = wpinv_get_option( 'checkout_page', false );
107
+    $uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
108 108
 
109
-	if ( !empty( $args ) ) {
110
-		// Check for backward compatibility
111
-		if ( is_string( $args ) )
112
-			$args = str_replace( '?', '', $args );
109
+    if ( !empty( $args ) ) {
110
+        // Check for backward compatibility
111
+        if ( is_string( $args ) )
112
+            $args = str_replace( '?', '', $args );
113 113
 
114
-		$args = wp_parse_args( $args );
114
+        $args = wp_parse_args( $args );
115 115
 
116
-		$uri = add_query_arg( $args, $uri );
117
-	}
116
+        $uri = add_query_arg( $args, $uri );
117
+    }
118 118
 
119
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
119
+    $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
120 120
 
121
-	$ajax_url = admin_url( 'admin-ajax.php', $scheme );
121
+    $ajax_url = admin_url( 'admin-ajax.php', $scheme );
122 122
 
123
-	if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
124
-		$uri = preg_replace( '/^http:/', 'https:', $uri );
125
-	}
123
+    if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
124
+        $uri = preg_replace( '/^http:/', 'https:', $uri );
125
+    }
126 126
 
127
-	return apply_filters( 'wpinv_get_checkout_uri', $uri );
127
+    return apply_filters( 'wpinv_get_checkout_uri', $uri );
128 128
 }
129 129
 
130 130
 function wpinv_send_back_to_checkout( $args = array() ) {
131
-	$redirect = wpinv_get_checkout_uri();
131
+    $redirect = wpinv_get_checkout_uri();
132 132
 
133
-	if ( ! empty( $args ) ) {
134
-		// Check for backward compatibility
135
-		if ( is_string( $args ) )
136
-			$args = str_replace( '?', '', $args );
133
+    if ( ! empty( $args ) ) {
134
+        // Check for backward compatibility
135
+        if ( is_string( $args ) )
136
+            $args = str_replace( '?', '', $args );
137 137
 
138
-		$args = wp_parse_args( $args );
138
+        $args = wp_parse_args( $args );
139 139
 
140
-		$redirect = add_query_arg( $args, $redirect );
141
-	}
140
+        $redirect = add_query_arg( $args, $redirect );
141
+    }
142 142
 
143 143
     do_action( 'wpinv_pre_send_back_to_checkout', $args );
144
-	wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
145
-	exit;
144
+    wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
145
+    exit;
146 146
 }
147 147
 
148 148
 function wpinv_get_success_page_url( $query_string = null ) {
149
-	$success_page = wpinv_get_option( 'success_page', 0 );
150
-	$success_page = get_permalink( $success_page );
149
+    $success_page = wpinv_get_option( 'success_page', 0 );
150
+    $success_page = get_permalink( $success_page );
151 151
 
152
-	if ( $query_string )
153
-		$success_page .= $query_string;
152
+    if ( $query_string )
153
+        $success_page .= $query_string;
154 154
 
155
-	return apply_filters( 'wpinv_success_page_url', $success_page );
155
+    return apply_filters( 'wpinv_success_page_url', $success_page );
156 156
 }
157 157
 
158 158
 function wpinv_get_failed_transaction_uri( $extras = false ) {
159
-	$uri = wpinv_get_option( 'failure_page', '' );
160
-	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
159
+    $uri = wpinv_get_option( 'failure_page', '' );
160
+    $uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
161 161
 
162
-	if ( $extras )
163
-		$uri .= $extras;
162
+    if ( $extras )
163
+        $uri .= $extras;
164 164
 
165
-	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
165
+    return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
166 166
 }
167 167
 
168 168
 function wpinv_is_failed_transaction_page() {
169
-	$ret = wpinv_get_option( 'failure_page', false );
170
-	$ret = isset( $ret ) ? is_page( $ret ) : false;
169
+    $ret = wpinv_get_option( 'failure_page', false );
170
+    $ret = isset( $ret ) ? is_page( $ret ) : false;
171 171
 
172
-	return apply_filters( 'wpinv_is_failure_page', $ret );
172
+    return apply_filters( 'wpinv_is_failure_page', $ret );
173 173
 }
174 174
 
175 175
 function wpinv_transaction_query( $type = 'start' ) {
@@ -244,36 +244,36 @@  discard block
 block discarded – undo
244 244
     $require_billing_details = apply_filters( 'wpinv_checkout_required_billing_details', wpinv_use_taxes() );
245 245
     
246 246
     if ( $require_billing_details ) {
247
-		if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
248
-			$required_fields['first_name'] = array(
249
-				'error_id' => 'invalid_first_name',
250
-				'error_message' => __( 'Please enter your first name', 'invoicing' )
251
-			);
252
-		}
253
-		if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
254
-			$required_fields['address'] = array(
255
-				'error_id' => 'invalid_address',
256
-				'error_message' => __( 'Please enter your address', 'invoicing' )
257
-			);
258
-		}
259
-		if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
260
-			$required_fields['city'] = array(
261
-				'error_id' => 'invalid_city',
262
-				'error_message' => __( 'Please enter your billing city', 'invoicing' )
263
-			);
264
-		}
265
-		if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
266
-			$required_fields['state'] = array(
267
-				'error_id' => 'invalid_state',
268
-				'error_message' => __( 'Please enter billing state / province', 'invoicing' )
269
-			);
270
-		}
271
-		if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
272
-			$required_fields['country'] = array(
273
-				'error_id' => 'invalid_country',
274
-				'error_message' => __( 'Please select your billing country', 'invoicing' )
275
-			);
276
-		}
247
+        if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
248
+            $required_fields['first_name'] = array(
249
+                'error_id' => 'invalid_first_name',
250
+                'error_message' => __( 'Please enter your first name', 'invoicing' )
251
+            );
252
+        }
253
+        if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
254
+            $required_fields['address'] = array(
255
+                'error_id' => 'invalid_address',
256
+                'error_message' => __( 'Please enter your address', 'invoicing' )
257
+            );
258
+        }
259
+        if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
260
+            $required_fields['city'] = array(
261
+                'error_id' => 'invalid_city',
262
+                'error_message' => __( 'Please enter your billing city', 'invoicing' )
263
+            );
264
+        }
265
+        if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
266
+            $required_fields['state'] = array(
267
+                'error_id' => 'invalid_state',
268
+                'error_message' => __( 'Please enter billing state / province', 'invoicing' )
269
+            );
270
+        }
271
+        if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
272
+            $required_fields['country'] = array(
273
+                'error_id' => 'invalid_country',
274
+                'error_message' => __( 'Please select your billing country', 'invoicing' )
275
+            );
276
+        }
277 277
     }
278 278
 
279 279
     return apply_filters( 'wpinv_checkout_required_fields', $required_fields );
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -7,190 +7,190 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 function wpinv_is_checkout() {
15 15
     global $wp_query;
16 16
 
17
-    $is_object_set    = isset( $wp_query->queried_object );
18
-    $is_object_id_set = isset( $wp_query->queried_object_id );
19
-    $checkout_page    = wpinv_get_option( 'checkout_page' );
20
-    $is_checkout      = ! empty( $checkout_page ) && is_page( $checkout_page );
17
+    $is_object_set    = isset($wp_query->queried_object);
18
+    $is_object_id_set = isset($wp_query->queried_object_id);
19
+    $checkout_page    = wpinv_get_option('checkout_page');
20
+    $is_checkout      = !empty($checkout_page) && is_page($checkout_page);
21 21
 
22
-    if ( !$is_object_set ) {
23
-        unset( $wp_query->queried_object );
22
+    if (!$is_object_set) {
23
+        unset($wp_query->queried_object);
24 24
     }
25 25
 
26
-    if ( !$is_object_id_set ) {
27
-        unset( $wp_query->queried_object_id );
26
+    if (!$is_object_id_set) {
27
+        unset($wp_query->queried_object_id);
28 28
     }
29 29
 
30
-    return apply_filters( 'wpinv_is_checkout', $is_checkout );
30
+    return apply_filters('wpinv_is_checkout', $is_checkout);
31 31
 }
32 32
 
33 33
 function wpinv_can_checkout() {
34 34
 	$can_checkout = true; // Always true for now
35 35
 
36
-	return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
36
+	return (bool) apply_filters('wpinv_can_checkout', $can_checkout);
37 37
 }
38 38
 
39 39
 function wpinv_get_success_page_uri() {
40
-	$page_id = wpinv_get_option( 'success_page', 0 );
41
-	$page_id = absint( $page_id );
40
+	$page_id = wpinv_get_option('success_page', 0);
41
+	$page_id = absint($page_id);
42 42
 
43
-	return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
43
+	return apply_filters('wpinv_get_success_page_uri', get_permalink($page_id));
44 44
 }
45 45
 
46 46
 function wpinv_get_history_page_uri() {
47
-	$page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
-	$page_id = absint( $page_id );
47
+	$page_id = wpinv_get_option('invoice_history_page', 0);
48
+	$page_id = absint($page_id);
49 49
 
50
-	return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
50
+	return apply_filters('wpinv_get_history_page_uri', get_permalink($page_id));
51 51
 }
52 52
 
53 53
 function wpinv_is_success_page() {
54
-	$is_success_page = wpinv_get_option( 'success_page', false );
55
-	$is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
54
+	$is_success_page = wpinv_get_option('success_page', false);
55
+	$is_success_page = !empty($is_success_page) ? is_page($is_success_page) : false;
56 56
 
57
-	return apply_filters( 'wpinv_is_success_page', $is_success_page );
57
+	return apply_filters('wpinv_is_success_page', $is_success_page);
58 58
 }
59 59
 
60 60
 function wpinv_is_invoice_history_page() {
61
-	$ret = wpinv_get_option( 'invoice_history_page', false );
62
-	$ret = $ret ? is_page( $ret ) : false;
63
-	return apply_filters( 'wpinv_is_invoice_history_page', $ret );
61
+	$ret = wpinv_get_option('invoice_history_page', false);
62
+	$ret = $ret ? is_page($ret) : false;
63
+	return apply_filters('wpinv_is_invoice_history_page', $ret);
64 64
 }
65 65
 
66 66
 function wpinv_is_subscriptions_history_page() {
67
-    $ret = wpinv_get_option( 'invoice_subscription_page', false );
68
-    $ret = $ret ? is_page( $ret ) : false;
69
-    return apply_filters( 'wpinv_is_subscriptions_history_page', $ret );
67
+    $ret = wpinv_get_option('invoice_subscription_page', false);
68
+    $ret = $ret ? is_page($ret) : false;
69
+    return apply_filters('wpinv_is_subscriptions_history_page', $ret);
70 70
 }
71 71
 
72 72
 /**
73 73
  * Redirects a user the success page.
74 74
  */
75
-function wpinv_send_to_success_page( $args = array() ) {
75
+function wpinv_send_to_success_page($args = array()) {
76 76
     $redirect = add_query_arg(
77
-        wp_parse_args( $args ),
77
+        wp_parse_args($args),
78 78
         wpinv_get_success_page_uri()
79 79
     );
80 80
 
81
-    wp_redirect( $redirect );
81
+    wp_redirect($redirect);
82 82
     exit;
83 83
 }
84 84
 
85
-function wpinv_send_to_failed_page( $args = null ) {
85
+function wpinv_send_to_failed_page($args = null) {
86 86
 	$redirect = wpinv_get_failed_transaction_uri();
87 87
     
88
-    if ( !empty( $args ) ) {
88
+    if (!empty($args)) {
89 89
         // Check for backward compatibility
90
-        if ( is_string( $args ) )
91
-            $args = str_replace( '?', '', $args );
90
+        if (is_string($args))
91
+            $args = str_replace('?', '', $args);
92 92
 
93
-        $args = wp_parse_args( $args );
93
+        $args = wp_parse_args($args);
94 94
 
95
-        $redirect = add_query_arg( $args, $redirect );
95
+        $redirect = add_query_arg($args, $redirect);
96 96
     }
97 97
 
98
-    $gateway = isset( $_REQUEST['wpi-gateway'] ) ? $_REQUEST['wpi-gateway'] : '';
98
+    $gateway = isset($_REQUEST['wpi-gateway']) ? $_REQUEST['wpi-gateway'] : '';
99 99
     
100
-    $redirect = apply_filters( 'wpinv_failed_page_redirect', $redirect, $gateway, $args );
101
-    wp_redirect( $redirect );
100
+    $redirect = apply_filters('wpinv_failed_page_redirect', $redirect, $gateway, $args);
101
+    wp_redirect($redirect);
102 102
     exit;
103 103
 }
104 104
 
105
-function wpinv_get_checkout_uri( $args = array() ) {
106
-	$uri = wpinv_get_option( 'checkout_page', false );
107
-	$uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
105
+function wpinv_get_checkout_uri($args = array()) {
106
+	$uri = wpinv_get_option('checkout_page', false);
107
+	$uri = isset($uri) ? get_permalink($uri) : NULL;
108 108
 
109
-	if ( !empty( $args ) ) {
109
+	if (!empty($args)) {
110 110
 		// Check for backward compatibility
111
-		if ( is_string( $args ) )
112
-			$args = str_replace( '?', '', $args );
111
+		if (is_string($args))
112
+			$args = str_replace('?', '', $args);
113 113
 
114
-		$args = wp_parse_args( $args );
114
+		$args = wp_parse_args($args);
115 115
 
116
-		$uri = add_query_arg( $args, $uri );
116
+		$uri = add_query_arg($args, $uri);
117 117
 	}
118 118
 
119
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
119
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
120 120
 
121
-	$ajax_url = admin_url( 'admin-ajax.php', $scheme );
121
+	$ajax_url = admin_url('admin-ajax.php', $scheme);
122 122
 
123
-	if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
124
-		$uri = preg_replace( '/^http:/', 'https:', $uri );
123
+	if ((!preg_match('/^https/', $uri) && preg_match('/^https/', $ajax_url)) || wpinv_is_ssl_enforced()) {
124
+		$uri = preg_replace('/^http:/', 'https:', $uri);
125 125
 	}
126 126
 
127
-	return apply_filters( 'wpinv_get_checkout_uri', $uri );
127
+	return apply_filters('wpinv_get_checkout_uri', $uri);
128 128
 }
129 129
 
130
-function wpinv_send_back_to_checkout( $args = array() ) {
130
+function wpinv_send_back_to_checkout($args = array()) {
131 131
 	$redirect = wpinv_get_checkout_uri();
132 132
 
133
-	if ( ! empty( $args ) ) {
133
+	if (!empty($args)) {
134 134
 		// Check for backward compatibility
135
-		if ( is_string( $args ) )
136
-			$args = str_replace( '?', '', $args );
135
+		if (is_string($args))
136
+			$args = str_replace('?', '', $args);
137 137
 
138
-		$args = wp_parse_args( $args );
138
+		$args = wp_parse_args($args);
139 139
 
140
-		$redirect = add_query_arg( $args, $redirect );
140
+		$redirect = add_query_arg($args, $redirect);
141 141
 	}
142 142
 
143
-    do_action( 'wpinv_pre_send_back_to_checkout', $args );
144
-	wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
143
+    do_action('wpinv_pre_send_back_to_checkout', $args);
144
+	wp_redirect(apply_filters('wpinv_send_back_to_checkout', $redirect, $args));
145 145
 	exit;
146 146
 }
147 147
 
148
-function wpinv_get_success_page_url( $query_string = null ) {
149
-	$success_page = wpinv_get_option( 'success_page', 0 );
150
-	$success_page = get_permalink( $success_page );
148
+function wpinv_get_success_page_url($query_string = null) {
149
+	$success_page = wpinv_get_option('success_page', 0);
150
+	$success_page = get_permalink($success_page);
151 151
 
152
-	if ( $query_string )
152
+	if ($query_string)
153 153
 		$success_page .= $query_string;
154 154
 
155
-	return apply_filters( 'wpinv_success_page_url', $success_page );
155
+	return apply_filters('wpinv_success_page_url', $success_page);
156 156
 }
157 157
 
158
-function wpinv_get_failed_transaction_uri( $extras = false ) {
159
-	$uri = wpinv_get_option( 'failure_page', '' );
160
-	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
158
+function wpinv_get_failed_transaction_uri($extras = false) {
159
+	$uri = wpinv_get_option('failure_page', '');
160
+	$uri = !empty($uri) ? trailingslashit(get_permalink($uri)) : home_url();
161 161
 
162
-	if ( $extras )
162
+	if ($extras)
163 163
 		$uri .= $extras;
164 164
 
165
-	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
165
+	return apply_filters('wpinv_get_failed_transaction_uri', $uri);
166 166
 }
167 167
 
168 168
 function wpinv_is_failed_transaction_page() {
169
-	$ret = wpinv_get_option( 'failure_page', false );
170
-	$ret = isset( $ret ) ? is_page( $ret ) : false;
169
+	$ret = wpinv_get_option('failure_page', false);
170
+	$ret = isset($ret) ? is_page($ret) : false;
171 171
 
172
-	return apply_filters( 'wpinv_is_failure_page', $ret );
172
+	return apply_filters('wpinv_is_failure_page', $ret);
173 173
 }
174 174
 
175
-function wpinv_transaction_query( $type = 'start' ) {
175
+function wpinv_transaction_query($type = 'start') {
176 176
     global $wpdb;
177 177
 
178 178
     $wpdb->hide_errors();
179 179
 
180
-    if ( ! defined( 'WPINV_USE_TRANSACTIONS' ) ) {
181
-        define( 'WPINV_USE_TRANSACTIONS', true );
180
+    if (!defined('WPINV_USE_TRANSACTIONS')) {
181
+        define('WPINV_USE_TRANSACTIONS', true);
182 182
     }
183 183
 
184
-    if ( WPINV_USE_TRANSACTIONS ) {
185
-        switch ( $type ) {
184
+    if (WPINV_USE_TRANSACTIONS) {
185
+        switch ($type) {
186 186
             case 'commit' :
187
-                $wpdb->query( 'COMMIT' );
187
+                $wpdb->query('COMMIT');
188 188
                 break;
189 189
             case 'rollback' :
190
-                $wpdb->query( 'ROLLBACK' );
190
+                $wpdb->query('ROLLBACK');
191 191
                 break;
192 192
             default :
193
-                $wpdb->query( 'START TRANSACTION' );
193
+                $wpdb->query('START TRANSACTION');
194 194
             break;
195 195
         }
196 196
     }
@@ -199,157 +199,157 @@  discard block
 block discarded – undo
199 199
 function wpinv_get_prefix() {
200 200
     $invoice_prefix = 'INV-';
201 201
     
202
-    return apply_filters( 'wpinv_get_prefix', $invoice_prefix );
202
+    return apply_filters('wpinv_get_prefix', $invoice_prefix);
203 203
 }
204 204
 
205 205
 function wpinv_get_business_logo() {
206
-    $business_logo = wpinv_get_option( 'logo' );
207
-    return apply_filters( 'wpinv_get_business_logo', $business_logo );
206
+    $business_logo = wpinv_get_option('logo');
207
+    return apply_filters('wpinv_get_business_logo', $business_logo);
208 208
 }
209 209
 
210 210
 function wpinv_get_business_name() {
211 211
     $business_name = wpinv_get_option('store_name');
212
-    return apply_filters( 'wpinv_get_business_name', $business_name );
212
+    return apply_filters('wpinv_get_business_name', $business_name);
213 213
 }
214 214
 
215 215
 function wpinv_get_blogname() {
216
-    return wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
216
+    return wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
217 217
 }
218 218
 
219 219
 function wpinv_get_admin_email() {
220
-    $admin_email = wpinv_get_option( 'admin_email', get_option( 'admin_email' ) );
221
-    return apply_filters( 'wpinv_admin_email', $admin_email );
220
+    $admin_email = wpinv_get_option('admin_email', get_option('admin_email'));
221
+    return apply_filters('wpinv_admin_email', $admin_email);
222 222
 }
223 223
 
224 224
 function wpinv_get_business_website() {
225
-    $business_website = home_url( '/' );
226
-    return apply_filters( 'wpinv_get_business_website', $business_website );
225
+    $business_website = home_url('/');
226
+    return apply_filters('wpinv_get_business_website', $business_website);
227 227
 }
228 228
 
229
-function wpinv_get_terms_text( $invoice_id = 0 ) {
229
+function wpinv_get_terms_text($invoice_id = 0) {
230 230
     $terms_text = '';
231
-    return apply_filters( 'wpinv_get_terms_text', $terms_text, $invoice_id );
231
+    return apply_filters('wpinv_get_terms_text', $terms_text, $invoice_id);
232 232
 }
233 233
 
234 234
 function wpinv_get_business_footer() {
235
-    $site_link = '<a target="_blank" href="' . esc_url( wpinv_get_business_website() ) . '">' . esc_html( wpinv_get_business_name() ) . '</a>';
236
-    $business_footer = wp_sprintf( __( 'Thanks for using %s', 'invoicing' ), $site_link );
237
-    return apply_filters( 'wpinv_get_business_footer', $business_footer );
235
+    $site_link = '<a target="_blank" href="' . esc_url(wpinv_get_business_website()) . '">' . esc_html(wpinv_get_business_name()) . '</a>';
236
+    $business_footer = wp_sprintf(__('Thanks for using %s', 'invoicing'), $site_link);
237
+    return apply_filters('wpinv_get_business_footer', $business_footer);
238 238
 }
239 239
 
240 240
 function wpinv_checkout_required_fields() {
241 241
     $required_fields = array();
242 242
     
243 243
     // Let payment gateways and other extensions determine if address fields should be required
244
-    $require_billing_details = apply_filters( 'wpinv_checkout_required_billing_details', wpinv_use_taxes() );
244
+    $require_billing_details = apply_filters('wpinv_checkout_required_billing_details', wpinv_use_taxes());
245 245
     
246
-    if ( $require_billing_details ) {
247
-		if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
246
+    if ($require_billing_details) {
247
+		if ((bool) wpinv_get_option('fname_mandatory')) {
248 248
 			$required_fields['first_name'] = array(
249 249
 				'error_id' => 'invalid_first_name',
250
-				'error_message' => __( 'Please enter your first name', 'invoicing' )
250
+				'error_message' => __('Please enter your first name', 'invoicing')
251 251
 			);
252 252
 		}
253
-		if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
253
+		if ((bool) wpinv_get_option('address_mandatory')) {
254 254
 			$required_fields['address'] = array(
255 255
 				'error_id' => 'invalid_address',
256
-				'error_message' => __( 'Please enter your address', 'invoicing' )
256
+				'error_message' => __('Please enter your address', 'invoicing')
257 257
 			);
258 258
 		}
259
-		if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
259
+		if ((bool) wpinv_get_option('city_mandatory')) {
260 260
 			$required_fields['city'] = array(
261 261
 				'error_id' => 'invalid_city',
262
-				'error_message' => __( 'Please enter your billing city', 'invoicing' )
262
+				'error_message' => __('Please enter your billing city', 'invoicing')
263 263
 			);
264 264
 		}
265
-		if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
265
+		if ((bool) wpinv_get_option('state_mandatory')) {
266 266
 			$required_fields['state'] = array(
267 267
 				'error_id' => 'invalid_state',
268
-				'error_message' => __( 'Please enter billing state / province', 'invoicing' )
268
+				'error_message' => __('Please enter billing state / province', 'invoicing')
269 269
 			);
270 270
 		}
271
-		if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
271
+		if ((bool) wpinv_get_option('country_mandatory')) {
272 272
 			$required_fields['country'] = array(
273 273
 				'error_id' => 'invalid_country',
274
-				'error_message' => __( 'Please select your billing country', 'invoicing' )
274
+				'error_message' => __('Please select your billing country', 'invoicing')
275 275
 			);
276 276
 		}
277 277
     }
278 278
 
279
-    return apply_filters( 'wpinv_checkout_required_fields', $required_fields );
279
+    return apply_filters('wpinv_checkout_required_fields', $required_fields);
280 280
 }
281 281
 
282 282
 function wpinv_is_ssl_enforced() {
283
-    $ssl_enforced = wpinv_get_option( 'enforce_ssl', false );
284
-    return (bool) apply_filters( 'wpinv_is_ssl_enforced', $ssl_enforced );
283
+    $ssl_enforced = wpinv_get_option('enforce_ssl', false);
284
+    return (bool) apply_filters('wpinv_is_ssl_enforced', $ssl_enforced);
285 285
 }
286 286
 
287 287
 function wpinv_schedule_events() {
288 288
 
289 289
     // Get the timestamp for the next event.
290
-    $timestamp = wp_next_scheduled( 'wpinv_register_schedule_event_twicedaily' );
290
+    $timestamp = wp_next_scheduled('wpinv_register_schedule_event_twicedaily');
291 291
 
292
-    if ( $timestamp ) {
293
-        wp_unschedule_event( $timestamp, 'wpinv_register_schedule_event_twicedaily' );
292
+    if ($timestamp) {
293
+        wp_unschedule_event($timestamp, 'wpinv_register_schedule_event_twicedaily');
294 294
     }
295 295
 
296
-    if ( ! wp_next_scheduled( 'wpinv_register_schedule_event_daily' ) ) {
297
-        wp_schedule_event( current_time( 'timestamp' ), 'daily', 'wpinv_register_schedule_event_daily' );
296
+    if (!wp_next_scheduled('wpinv_register_schedule_event_daily')) {
297
+        wp_schedule_event(current_time('timestamp'), 'daily', 'wpinv_register_schedule_event_daily');
298 298
     }
299 299
 }
300
-add_action( 'wp', 'wpinv_schedule_events' );
300
+add_action('wp', 'wpinv_schedule_events');
301 301
 
302 302
 function wpinv_schedule_event_twicedaily() {
303 303
     wpinv_email_payment_reminders();
304 304
     wpinv_email_renewal_reminders();
305 305
 }
306
-add_action( 'wpinv_register_schedule_event_daily', 'wpinv_schedule_event_twicedaily' );
306
+add_action('wpinv_register_schedule_event_daily', 'wpinv_schedule_event_twicedaily');
307 307
 
308 308
 function wpinv_require_login_to_checkout() {
309
-    $return = wpinv_get_option( 'login_to_checkout', false );
310
-    return (bool) apply_filters( 'wpinv_require_login_to_checkout', $return );
309
+    $return = wpinv_get_option('login_to_checkout', false);
310
+    return (bool) apply_filters('wpinv_require_login_to_checkout', $return);
311 311
 }
312 312
 
313
-function wpinv_sequential_number_active( $type = '' ) {
314
-    $check = apply_filters( 'wpinv_pre_check_sequential_number_active', null, $type );
315
-    if ( null !== $check ) {
313
+function wpinv_sequential_number_active($type = '') {
314
+    $check = apply_filters('wpinv_pre_check_sequential_number_active', null, $type);
315
+    if (null !== $check) {
316 316
         return $check;
317 317
     }
318 318
     
319
-    return wpinv_get_option( 'sequential_invoice_number' );
319
+    return wpinv_get_option('sequential_invoice_number');
320 320
 }
321 321
 
322
-function wpinv_switch_to_locale( $locale = NULL ) {
322
+function wpinv_switch_to_locale($locale = NULL) {
323 323
     global $invoicing, $wpi_switch_locale;
324 324
 
325
-    if ( ! empty( $invoicing ) && function_exists( 'switch_to_locale' ) ) {
326
-        $locale = empty( $locale ) ? get_locale() : $locale;
325
+    if (!empty($invoicing) && function_exists('switch_to_locale')) {
326
+        $locale = empty($locale) ? get_locale() : $locale;
327 327
 
328
-        switch_to_locale( $locale );
328
+        switch_to_locale($locale);
329 329
 
330 330
         $wpi_switch_locale = $locale;
331 331
 
332
-        add_filter( 'plugin_locale', 'get_locale' );
332
+        add_filter('plugin_locale', 'get_locale');
333 333
 
334 334
         $invoicing->load_textdomain();
335 335
 
336
-        do_action( 'wpinv_switch_to_locale', $locale );
336
+        do_action('wpinv_switch_to_locale', $locale);
337 337
     }
338 338
 }
339 339
 
340 340
 function wpinv_restore_locale() {
341 341
     global $invoicing, $wpi_switch_locale;
342 342
     
343
-    if ( ! empty( $invoicing ) && function_exists( 'restore_previous_locale' ) && $wpi_switch_locale ) {
343
+    if (!empty($invoicing) && function_exists('restore_previous_locale') && $wpi_switch_locale) {
344 344
         restore_previous_locale();
345 345
 
346 346
         $wpi_switch_locale = NULL;
347 347
 
348
-        remove_filter( 'plugin_locale', 'get_locale' );
348
+        remove_filter('plugin_locale', 'get_locale');
349 349
 
350 350
         $invoicing->load_textdomain();
351 351
 
352
-        do_action( 'wpinv_restore_locale' );
352
+        do_action('wpinv_restore_locale');
353 353
     }
354 354
 }
355 355
 
@@ -357,22 +357,22 @@  discard block
 block discarded – undo
357 357
  * Returns the default form's id.
358 358
  */
359 359
 function wpinv_get_default_payment_form() {
360
-    $form = get_option( 'wpinv_default_payment_form' );
360
+    $form = get_option('wpinv_default_payment_form');
361 361
 
362
-    if ( empty( $form ) || 'publish' != get_post_status( $form ) ) {
362
+    if (empty($form) || 'publish' != get_post_status($form)) {
363 363
         $form = wp_insert_post(
364 364
             array(
365 365
                 'post_type'   => 'wpi_payment_form',
366
-                'post_title'  => __( 'Checkout (default)', 'invoicing' ),
366
+                'post_title'  => __('Checkout (default)', 'invoicing'),
367 367
                 'post_status' => 'publish',
368 368
                 'meta_input'  => array(
369
-                    'wpinv_form_elements' => wpinv_get_data( 'default-payment-form' ),
369
+                    'wpinv_form_elements' => wpinv_get_data('default-payment-form'),
370 370
                     'wpinv_form_items'    => array(),
371 371
                 )
372 372
             )
373 373
         );
374 374
 
375
-        update_option( 'wpinv_default_payment_form', $form );
375
+        update_option('wpinv_default_payment_form', $form);
376 376
     }
377 377
 
378 378
     return $form;
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
     
88 88
     if ( !empty( $args ) ) {
89 89
         // Check for backward compatibility
90
-        if ( is_string( $args ) )
91
-            $args = str_replace( '?', '', $args );
90
+        if ( is_string( $args ) ) {
91
+                    $args = str_replace( '?', '', $args );
92
+        }
92 93
 
93 94
         $args = wp_parse_args( $args );
94 95
 
@@ -108,8 +109,9 @@  discard block
 block discarded – undo
108 109
 
109 110
 	if ( !empty( $args ) ) {
110 111
 		// Check for backward compatibility
111
-		if ( is_string( $args ) )
112
-			$args = str_replace( '?', '', $args );
112
+		if ( is_string( $args ) ) {
113
+					$args = str_replace( '?', '', $args );
114
+		}
113 115
 
114 116
 		$args = wp_parse_args( $args );
115 117
 
@@ -132,8 +134,9 @@  discard block
 block discarded – undo
132 134
 
133 135
 	if ( ! empty( $args ) ) {
134 136
 		// Check for backward compatibility
135
-		if ( is_string( $args ) )
136
-			$args = str_replace( '?', '', $args );
137
+		if ( is_string( $args ) ) {
138
+					$args = str_replace( '?', '', $args );
139
+		}
137 140
 
138 141
 		$args = wp_parse_args( $args );
139 142
 
@@ -149,8 +152,9 @@  discard block
 block discarded – undo
149 152
 	$success_page = wpinv_get_option( 'success_page', 0 );
150 153
 	$success_page = get_permalink( $success_page );
151 154
 
152
-	if ( $query_string )
153
-		$success_page .= $query_string;
155
+	if ( $query_string ) {
156
+			$success_page .= $query_string;
157
+	}
154 158
 
155 159
 	return apply_filters( 'wpinv_success_page_url', $success_page );
156 160
 }
@@ -159,8 +163,9 @@  discard block
 block discarded – undo
159 163
 	$uri = wpinv_get_option( 'failure_page', '' );
160 164
 	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
161 165
 
162
-	if ( $extras )
163
-		$uri .= $extras;
166
+	if ( $extras ) {
167
+			$uri .= $extras;
168
+	}
164 169
 
165 170
 	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
166 171
 }
Please login to merge, or discard this patch.
templates/emails/wpinv-email-invoice-items.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  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
-$column_count = count( $columns );
12
+$column_count = count($columns);
13 13
 ?>
14 14
 
15
-<?php do_action( 'wpinv_before_email_items', $invoice ); ?>
15
+<?php do_action('wpinv_before_email_items', $invoice); ?>
16 16
 
17 17
 
18 18
 <div id="wpinv-email-items">
19 19
 
20 20
     <h3 class="wpinv-items-t">
21
-        <?php echo apply_filters( 'wpinv_email_items_title', __( 'Items', 'invoicing' ) ); ?>
21
+        <?php echo apply_filters('wpinv_email_items_title', __('Items', 'invoicing')); ?>
22 22
     </h3>
23 23
 
24 24
     <table id="wpinv_checkout_cart" class="table table-bordered table-hover">
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
             <tr class="wpinv_cart_header_row">
29 29
 
30
-                <?php foreach ( $columns as $key => $label ) : ?>
31
-                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $key ); ?>">
32
-                        <?php echo sanitize_text_field( $label ); ?>
30
+                <?php foreach ($columns as $key => $label) : ?>
31
+                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($key); ?>">
32
+                        <?php echo sanitize_text_field($label); ?>
33 33
                     </th>
34 34
                 <?php endforeach; ?>
35 35
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
             <?php
43 43
 
44 44
                 // Display the item totals.
45
-                foreach ( $invoice->get_items() as $item ) {
46
-                    wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) );
45
+                foreach ($invoice->get_items() as $item) {
46
+                    wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns'));
47 47
                 }
48 48
 
49 49
             ?>
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         </tbody>
52 52
 
53 53
         <tfoot>
54
-            <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?>
54
+            <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?>
55 55
         </tfoot>
56 56
     
57 57
     </table>
Please login to merge, or discard this patch.
templates/payment-forms/cart-totals.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  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
 // Totals rows.
13 13
 $totals = apply_filters(
14 14
     'getpaid_payment_form_cart_table_totals',
15 15
     array(
16
-        'subtotal' => __( 'Subtotal', 'invoicing' ),
17
-        'tax'      => __( 'Tax', 'invoicing' ),
18
-        'discount' => __( 'Discount', 'invoicing' ),
19
-        'total'    => __( 'Total', 'invoicing' ),
16
+        'subtotal' => __('Subtotal', 'invoicing'),
17
+        'tax'      => __('Tax', 'invoicing'),
18
+        'discount' => __('Discount', 'invoicing'),
19
+        'total'    => __('Total', 'invoicing'),
20 20
     ),
21 21
     $form
22 22
 );
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 $currency = $form->get_currency();
25 25
 $country  = wpinv_get_default_country();
26 26
 
27
-if ( ! empty( $form->invoice ) ) {
28
-    $country  = $form->invoice->get_country();
27
+if (!empty($form->invoice)) {
28
+    $country = $form->invoice->get_country();
29 29
 }
30 30
 
31
-if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) {
32
-    unset( $totals['tax'] );
31
+if (!wpinv_use_taxes() && isset($totals['tax'])) {
32
+    unset($totals['tax']);
33 33
 }
34 34
 
35
-do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals );
35
+do_action('getpaid_before_payment_form_cart_totals', $form, $totals);
36 36
 
37 37
 $tax       = 0;
38 38
 $sub_total = 0;
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 $discount  = 0;
41 41
 
42 42
 // Calculate totals.
43
-foreach ( $form->get_items() as $item ) {
43
+foreach ($form->get_items() as $item) {
44 44
 
45
-    if ( ! empty( $form->invoice ) && 'amount' == $form->invoice->get_template() ) {
45
+    if (!empty($form->invoice) && 'amount' == $form->invoice->get_template()) {
46 46
         $amount = $item->get_price();
47 47
     } else {
48 48
         $amount = $item->get_sub_total();
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
     // Include the tax.
53
-    if ( wpinv_use_taxes() ) {
54
-        $rate = wpinv_get_tax_rate( $country, false, $item->get_id() );
53
+    if (wpinv_use_taxes()) {
54
+        $rate = wpinv_get_tax_rate($country, false, $item->get_id());
55 55
 
56
-        if ( wpinv_prices_include_tax() ) {
57
-            $pre_tax  = ( $amount - $amount * $rate * 0.01 );
56
+        if (wpinv_prices_include_tax()) {
57
+            $pre_tax  = ($amount - $amount * $rate * 0.01);
58 58
             $item_tax = $amount - $pre_tax;
59 59
         } else {
60 60
             $pre_tax  = $amount;
@@ -66,41 +66,41 @@  discard block
 block discarded – undo
66 66
         $total     = $sub_total + $tax;
67 67
 
68 68
     } else {
69
-        $total  = $total + $amount;
69
+        $total = $total + $amount;
70 70
     }
71 71
 
72 72
 }
73 73
 
74 74
 ?>
75 75
 <div class='border-top getpaid-payment-form-items-cart-totals'>
76
-    <?php foreach ( $totals as $key => $label ) : ?>
77
-        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?>">
76
+    <?php foreach ($totals as $key => $label) : ?>
77
+        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?>">
78 78
             <div class="row">
79 79
                 <div class="col-12 offset-sm-5 col-sm-4">
80
-                    <?php echo sanitize_text_field( $label ); ?>
80
+                    <?php echo sanitize_text_field($label); ?>
81 81
                 </div>
82
-                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>">
82
+                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>">
83 83
                     <?php
84
-                        do_action( "getpaid_payment_form_cart_totals_$key", $form );
84
+                        do_action("getpaid_payment_form_cart_totals_$key", $form);
85 85
 
86 86
                         // Total tax.
87
-                        if ( 'tax' == $key ) {
88
-                            echo wpinv_price( wpinv_format_amount( $tax ), $currency );
87
+                        if ('tax' == $key) {
88
+                            echo wpinv_price(wpinv_format_amount($tax), $currency);
89 89
                         }
90 90
 
91 91
                         // Total discount.
92
-                        if ( 'discount' == $key ) {
93
-                            echo wpinv_price( wpinv_format_amount( $discount ), $currency );
92
+                        if ('discount' == $key) {
93
+                            echo wpinv_price(wpinv_format_amount($discount), $currency);
94 94
                         }
95 95
 
96 96
                         // Sub total.
97
-                        if ( 'subtotal' == $key ) {
98
-                            echo wpinv_price( wpinv_format_amount( $sub_total ), $currency );
97
+                        if ('subtotal' == $key) {
98
+                            echo wpinv_price(wpinv_format_amount($sub_total), $currency);
99 99
                         }
100 100
 
101 101
                         // Total.
102
-                        if ( 'total' == $key ) {
103
-                            echo wpinv_price( wpinv_format_amount( $total ), $currency );
102
+                        if ('total' == $key) {
103
+                            echo wpinv_price(wpinv_format_amount($total), $currency);
104 104
                         }
105 105
                     ?>
106 106
                 </div>
@@ -110,4 +110,4 @@  discard block
 block discarded – undo
110 110
 </div>
111 111
 
112 112
 <?php
113
-do_action(  'getpaid_payment_form_cart_totals', $form, $totals );
113
+do_action('getpaid_payment_form_cart_totals', $form, $totals);
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@  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
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
12
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
13 13
 
14 14
 $currency = $form->get_currency();
15 15
 
16 16
 ?>
17
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
17
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
18 18
     <div class="form-row">
19
-        <?php foreach ( $columns as $key => $label ) : ?>
20
-            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo $item->get_id(); ?>">
19
+        <?php foreach ($columns as $key => $label) : ?>
20
+            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo $item->get_id(); ?>">
21 21
                 <?php
22
-                    do_action( "getpaid_payment_form_cart_item_$key", $form, $item );
22
+                    do_action("getpaid_payment_form_cart_item_$key", $form, $item);
23 23
 
24 24
                     // Item name.
25
-                    if ( 'name' == $key ) {
26
-                        echo sanitize_text_field( $item->get_name() );
25
+                    if ('name' == $key) {
26
+                        echo sanitize_text_field($item->get_name());
27 27
                         $description = $item->get_description();
28 28
 
29
-                        if ( ! empty( $description ) ) {
30
-                            $description = wp_kses_post( $description );
29
+                        if (!empty($description)) {
30
+                            $description = wp_kses_post($description);
31 31
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
32 32
                         }
33 33
 
34
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
34
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
35 35
 
36
-                        if ( $description ) {
36
+                        if ($description) {
37 37
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
38 38
                         }
39 39
                     }
40 40
 
41 41
                     // Item price.
42
-                    if ( 'price' == $key ) {
42
+                    if ('price' == $key) {
43 43
 
44 44
                         // Set the currency position.
45 45
                         $position = wpinv_currency_position();
46 46
 
47
-                        if ( $position == 'left_space' ) {
47
+                        if ($position == 'left_space') {
48 48
                             $position = 'left';
49 49
                         }
50 50
 
51
-                        if ( $position == 'right_space' ) {
51
+                        if ($position == 'right_space') {
52 52
                             $position = 'right';
53 53
                         }
54 54
 
55
-                        if ( $item->user_can_set_their_price() ) {
55
+                        if ($item->user_can_set_their_price()) {
56 56
                             ?>
57 57
                                 <div class="input-group input-group-sm">
58
-                                    <?php if( 'left' == $position ) : ?>
58
+                                    <?php if ('left' == $position) : ?>
59 59
                                         <div class="input-group-prepend">
60
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
60
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
61 61
                                         </div>
62 62
                                     <?php endif; ?>
63
-                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( $item->get_price() ); ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input">
63
+                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr($item->get_price()); ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input">
64 64
 
65
-                                    <?php if( 'left' != $position ) : ?>
65
+                                    <?php if ('left' != $position) : ?>
66 66
                                         <div class="input-group-append">
67
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
67
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
68 68
                                         </div>
69 69
                                     <?php endif; ?>
70 70
                                 </div>
71 71
                             <?php
72 72
                         } else {
73
-                            echo wpinv_price( wpinv_format_amount( $item->get_price() ), $currency );
73
+                            echo wpinv_price(wpinv_format_amount($item->get_price()), $currency);
74 74
                             ?>
75
-                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
75
+                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
76 76
                             <?php
77 77
                         }
78 78
                     }
79 79
 
80 80
                     // Item quantity.
81
-                    if ( 'quantity' == $key ) {
81
+                    if ('quantity' == $key) {
82 82
 
83
-                        if ( $item->allows_quantities() ) {
83
+                        if ($item->allows_quantities()) {
84 84
                             ?>
85 85
                                 <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='number' class='getpaid-item-quantity-input pr-1' value='<?php echo (int) $item->get_qantity(); ?>' min='1' required>
86 86
                             <?php
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
                     }
95 95
 
96 96
                     // Item sub total.
97
-                    if ( 'subtotal' == $key ) {
98
-                        echo wpinv_price( wpinv_format_amount( $item->get_sub_total() ), $currency );
97
+                    if ('subtotal' == $key) {
98
+                        echo wpinv_price(wpinv_format_amount($item->get_sub_total()), $currency);
99 99
                     }
100 100
                 ?>
101 101
             </div>
@@ -103,4 +103,4 @@  discard block
 block discarded – undo
103 103
     </div>
104 104
 </div>
105 105
 <?php
106
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
106
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
templates/payment-forms/elements/gateway_select.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@  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
 // The payment methods select title.
13
-if ( empty( $text ) ) {
14
-    $text = __( 'Select Payment Method', 'invoicing' );
13
+if (empty($text)) {
14
+    $text = __('Select Payment Method', 'invoicing');
15 15
 }
16 16
 
17 17
 // An array of active payment methods.
18
-$gateways = wpinv_get_enabled_payment_gateways( true );
18
+$gateways = wpinv_get_enabled_payment_gateways(true);
19 19
 
20 20
 // Make it possible to filter active gateways.
21
-$gateways = apply_filters( 'getpaid_payment_form_gateways', $gateways, $form );
21
+$gateways = apply_filters('getpaid_payment_form_gateways', $gateways, $form);
22 22
 
23 23
 //@deprecated
24
-$gateways = apply_filters( 'wpinv_payment_gateways_on_cart', $gateways );
24
+$gateways = apply_filters('wpinv_payment_gateways_on_cart', $gateways);
25 25
 
26 26
 // The current invoice id.
27 27
 $invoice_id     = 0;
28 28
 $chosen_gateway = wpinv_get_default_gateway();
29 29
 
30
-if ( ! empty( $form->invoice ) ) {
30
+if (!empty($form->invoice)) {
31 31
     $invoice_id = $form->invoice->get_id();
32 32
     $chosen_gateway = $form->invoice->get_gateway();
33 33
 }
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
 
37 37
     <div class="mt-4 mb-4">
38 38
 
39
-        <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?>
39
+        <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?>
40 40
 
41 41
         <div class="getpaid-gateways-select-title-div">
42
-            <h6><?php echo sanitize_text_field( $text ); ?></h6>
42
+            <h6><?php echo sanitize_text_field($text); ?></h6>
43 43
         </div>
44 44
 
45 45
         
46 46
         <div class="getpaid-gateways-select-gateways-div">
47 47
 
48
-            <?php foreach ( array_keys( $gateways ) as $gateway ) : ?>
48
+            <?php foreach (array_keys($gateways) as $gateway) : ?>
49 49
 
50
-                <div class="pt-2 pb-2 getpaid-gateways-select-gateway getpaid-gateways-select-gateway-<?php echo sanitize_html_class( $gateway ) ;?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_$gateway_checkout_button_label", '' ) ); ?>'>
50
+                <div class="pt-2 pb-2 getpaid-gateways-select-gateway getpaid-gateways-select-gateway-<?php echo sanitize_html_class($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_$gateway_checkout_button_label", '')); ?>'>
51 51
 
52 52
                     <div class="getpaid-gateway-radio-div">
53 53
                         <label>
54
-                            <input type="radio" value="<?php echo esc_attr( $gateway ) ;?>" <?php checked( $gateway, $chosen_gateway ) ;?> name="wpi-gateway">
55
-                            <span><?php echo sanitize_text_field( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span>
54
+                            <input type="radio" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway">
55
+                            <span><?php echo sanitize_text_field(wpinv_get_gateway_checkout_label($gateway)); ?></span>
56 56
                         </label>
57 57
                     </div>
58 58
 
59 59
                     <div class="getpaid-gateway-description-div" style="display: none;">
60
-                        <?php do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ) ;?>
61
-                        <?php if ( wpinv_get_gateway_description( $gateway ) ) : ?>
60
+                        <?php do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); ?>
61
+                        <?php if (wpinv_get_gateway_description($gateway)) : ?>
62 62
                             <div class="getpaid-gateway-description">
63
-                                <?php echo wpinv_get_gateway_description( $gateway ); ?>
63
+                                <?php echo wpinv_get_gateway_description($gateway); ?>
64 64
                             </div>
65 65
                         <?php endif; ?>
66 66
 
67
-                        <?php do_action( 'getpaid_after_gateway_description', $invoice_id, $gateway, $form ) ;?>
68
-                        <?php do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ) ;?>
67
+                        <?php do_action('getpaid_after_gateway_description', $invoice_id, $gateway, $form); ?>
68
+                        <?php do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); ?>
69 69
 
70 70
                     </div>
71 71
 
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
             <?php
77 77
 
78 78
 
79
-                if ( empty( $gateways ) ) {
79
+                if (empty($gateways)) {
80 80
 
81
-                    $enabled_gateways = wpinv_get_enabled_payment_gateways( true );
81
+                    $enabled_gateways = wpinv_get_enabled_payment_gateways(true);
82 82
 
83
-                    if ( ! empty( $enabled_gateways ) && $form->is_recurring() ) {
83
+                    if (!empty($enabled_gateways) && $form->is_recurring()) {
84 84
 
85 85
 
86 86
                         echo aui()->alert(
87 87
                             array(
88
-                                'content'     => __( 'Non of the available payment gateways support subscriptions.', 'invoicing' ),
88
+                                'content'     => __('Non of the available payment gateways support subscriptions.', 'invoicing'),
89 89
                                 'type'        => 'danger',
90 90
                             )
91 91
                         );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                         echo aui()->alert(
97 97
                             array(
98
-                                'content'     => __( 'No active payment gateway available.', 'invoicing' ),
98
+                                'content'     => __('No active payment gateway available.', 'invoicing'),
99 99
                                 'type'        => 'danger',
100 100
                             )
101 101
                         );
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         </div>
112 112
 
113
-        <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?>
113
+        <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?>
114 114
 
115 115
     </div>
116 116
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_input.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
         'label_type'        => 'vertical',
31 31
         'help_text'         => empty( $description ) ? '' : wp_kses_post( $description ),
32 32
         'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
-		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
+        'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
34 34
     )
35 35
 );
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 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
 // Set the currency position.
13 13
 $position = wpinv_currency_position();
14 14
 
15
-if ( $position == 'left_space' ) {
15
+if ($position == 'left_space') {
16 16
     $position = 'left';
17 17
 }
18 18
 
19
-if ( $position == 'right_space' ) {
19
+if ($position == 'right_space') {
20 20
     $position = 'right';
21 21
 }
22 22
 
23 23
 echo aui()->input(
24 24
     array(
25
-        'name'              => esc_attr( $id ),
26
-        'id'                => esc_attr( $id ) . uniqid( '_' ),
27
-        'placeholder'       => empty( $placeholder ) ? wpinv_format_amount(0) : wpinv_format_amount( $placeholder ),
28
-        'value'             => empty( $value ) ? wpinv_format_amount(0) : wpinv_format_amount( $value ),
29
-        'label'             => empty( $label ) ? '' : wp_kses_post( $label ),
25
+        'name'              => esc_attr($id),
26
+        'id'                => esc_attr($id) . uniqid('_'),
27
+        'placeholder'       => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder),
28
+        'value'             => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value),
29
+        'label'             => empty($label) ? '' : wp_kses_post($label),
30 30
         'label_type'        => 'vertical',
31
-        'help_text'         => empty( $description ) ? '' : wp_kses_post( $description ),
32
-        'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
-		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
31
+        'help_text'         => empty($description) ? '' : wp_kses_post($description),
32
+        'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '',
33
+		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '',
34 34
     )
35 35
 );
Please login to merge, or discard this patch.