Passed
Push — master ( def67b...f4bb32 )
by Stiofan
08:12 queued 04:13
created
includes/wpinv-invoice-functions.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 }
670 670
 
671 671
 function wpinv_get_payment_key( $invoice_id = 0 ) {
672
-	$invoice = new WPInv_Invoice( $invoice_id );
672
+    $invoice = new WPInv_Invoice( $invoice_id );
673 673
     return $invoice->get_key();
674 674
 }
675 675
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
         return false;
920 920
     }
921 921
     $invoice = wpinv_get_invoice_cart();
922
-	if ( empty( $invoice ) ) {
922
+    if ( empty( $invoice ) ) {
923 923
         return false;
924 924
     }
925 925
 
@@ -1212,20 +1212,20 @@  discard block
 block discarded – undo
1212 1212
 }
1213 1213
 
1214 1214
 function wpinv_checkout_get_cc_info() {
1215
-	$cc_info = array();
1216
-	$cc_info['card_name']      = isset( $_POST['card_name'] )       ? sanitize_text_field( $_POST['card_name'] )       : '';
1217
-	$cc_info['card_number']    = isset( $_POST['card_number'] )     ? sanitize_text_field( $_POST['card_number'] )     : '';
1218
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] )        ? sanitize_text_field( $_POST['card_cvc'] )        : '';
1219
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] )  ? sanitize_text_field( $_POST['card_exp_month'] )  : '';
1220
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] )   ? sanitize_text_field( $_POST['card_exp_year'] )   : '';
1221
-	$cc_info['card_address']   = isset( $_POST['wpinv_address'] )  ? sanitize_text_field( $_POST['wpinv_address'] ) : '';
1222
-	$cc_info['card_city']      = isset( $_POST['wpinv_city'] )     ? sanitize_text_field( $_POST['wpinv_city'] )    : '';
1223
-	$cc_info['card_state']     = isset( $_POST['wpinv_state'] )    ? sanitize_text_field( $_POST['wpinv_state'] )   : '';
1224
-	$cc_info['card_country']   = isset( $_POST['wpinv_country'] )  ? sanitize_text_field( $_POST['wpinv_country'] ) : '';
1225
-	$cc_info['card_zip']       = isset( $_POST['wpinv_zip'] )      ? sanitize_text_field( $_POST['wpinv_zip'] )     : '';
1226
-
1227
-	// Return cc info
1228
-	return $cc_info;
1215
+    $cc_info = array();
1216
+    $cc_info['card_name']      = isset( $_POST['card_name'] )       ? sanitize_text_field( $_POST['card_name'] )       : '';
1217
+    $cc_info['card_number']    = isset( $_POST['card_number'] )     ? sanitize_text_field( $_POST['card_number'] )     : '';
1218
+    $cc_info['card_cvc']       = isset( $_POST['card_cvc'] )        ? sanitize_text_field( $_POST['card_cvc'] )        : '';
1219
+    $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] )  ? sanitize_text_field( $_POST['card_exp_month'] )  : '';
1220
+    $cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] )   ? sanitize_text_field( $_POST['card_exp_year'] )   : '';
1221
+    $cc_info['card_address']   = isset( $_POST['wpinv_address'] )  ? sanitize_text_field( $_POST['wpinv_address'] ) : '';
1222
+    $cc_info['card_city']      = isset( $_POST['wpinv_city'] )     ? sanitize_text_field( $_POST['wpinv_city'] )    : '';
1223
+    $cc_info['card_state']     = isset( $_POST['wpinv_state'] )    ? sanitize_text_field( $_POST['wpinv_state'] )   : '';
1224
+    $cc_info['card_country']   = isset( $_POST['wpinv_country'] )  ? sanitize_text_field( $_POST['wpinv_country'] ) : '';
1225
+    $cc_info['card_zip']       = isset( $_POST['wpinv_zip'] )      ? sanitize_text_field( $_POST['wpinv_zip'] )     : '';
1226
+
1227
+    // Return cc info
1228
+    return $cc_info;
1229 1229
 }
1230 1230
 
1231 1231
 function wpinv_checkout_validate_cc_zip( $zip = 0, $country_code = '' ) {
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
         $required_fields  = wpinv_checkout_required_fields();
1423 1423
 
1424 1424
         // Loop through required fields and show error messages
1425
-         if ( !empty( $required_fields ) ) {
1425
+            if ( !empty( $required_fields ) ) {
1426 1426
             foreach ( $required_fields as $field_name => $value ) {
1427 1427
                 if ( in_array( $value, $required_fields ) && empty( $_POST[ 'wpinv_' . $field_name ] ) ) {
1428 1428
                     wpinv_set_error( $value['error_id'], $value['error_message'] );
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 }
1529 1529
 
1530 1530
 function wpinv_get_checkout_session() {
1531
-	global $wpi_session;
1531
+    global $wpi_session;
1532 1532
     
1533 1533
     return $wpi_session->get( 'wpinv_checkout' );
1534 1534
 }
@@ -1891,57 +1891,57 @@  discard block
 block discarded – undo
1891 1891
 }
1892 1892
 
1893 1893
 function wpinv_get_invoice_id_by_key( $key ) {
1894
-	global $wpdb;
1894
+    global $wpdb;
1895 1895
 
1896
-	$invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_key' AND meta_value = %s LIMIT 1", $key ) );
1896
+    $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_key' AND meta_value = %s LIMIT 1", $key ) );
1897 1897
 
1898
-	if ( $invoice_id != NULL )
1899
-		return $invoice_id;
1898
+    if ( $invoice_id != NULL )
1899
+        return $invoice_id;
1900 1900
 
1901
-	return 0;
1901
+    return 0;
1902 1902
 }
1903 1903
 
1904 1904
 function wpinv_can_view_receipt( $invoice_key = '' ) {
1905
-	$return = false;
1906
-
1907
-	if ( empty( $invoice_key ) ) {
1908
-		return $return;
1909
-	}
1910
-
1911
-	global $wpinv_receipt_args;
1912
-
1913
-	$wpinv_receipt_args['id'] = wpinv_get_invoice_id_by_key( $invoice_key );
1914
-	if ( isset( $_GET['invoice-id'] ) ) {
1915
-		$wpinv_receipt_args['id'] = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? (int)$_GET['invoice-id'] : 0;
1916
-	}
1917
-
1918
-	if ( empty( $wpinv_receipt_args['id'] ) ) {
1919
-		return $return;
1920
-	}
1921
-
1922
-	$invoice = wpinv_get_invoice( $wpinv_receipt_args['id'] );
1923
-	if ( !( !empty( $invoice->ID ) && $invoice->get_key() === $invoice_key ) ) {
1924
-		return $return;
1925
-	}
1926
-
1927
-	if ( is_user_logged_in() ) {
1928
-		if ( (int)$invoice->get_user_id() === (int) get_current_user_id() ) {
1929
-			$return = true;
1930
-		}
1931
-	}
1932
-
1933
-	$session = wpinv_get_checkout_session();
1934
-	if ( isset( $_GET['invoice_key'] ) || ( $session && isset( $session['invoice_key'] ) ) ) {
1935
-		$check_key = isset( $_GET['invoice_key'] ) ? $_GET['invoice_key'] : $session['invoice_key'];
1936
-
1937
-		if ( wpinv_require_login_to_checkout() ) {
1938
-			$return = $return && $check_key === $invoice_key;
1939
-		} else {
1940
-			$return = $check_key === $invoice_key;
1941
-		}
1942
-	}
1943
-
1944
-	return (bool) apply_filters( 'wpinv_can_view_receipt', $return, $invoice_key );
1905
+    $return = false;
1906
+
1907
+    if ( empty( $invoice_key ) ) {
1908
+        return $return;
1909
+    }
1910
+
1911
+    global $wpinv_receipt_args;
1912
+
1913
+    $wpinv_receipt_args['id'] = wpinv_get_invoice_id_by_key( $invoice_key );
1914
+    if ( isset( $_GET['invoice-id'] ) ) {
1915
+        $wpinv_receipt_args['id'] = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? (int)$_GET['invoice-id'] : 0;
1916
+    }
1917
+
1918
+    if ( empty( $wpinv_receipt_args['id'] ) ) {
1919
+        return $return;
1920
+    }
1921
+
1922
+    $invoice = wpinv_get_invoice( $wpinv_receipt_args['id'] );
1923
+    if ( !( !empty( $invoice->ID ) && $invoice->get_key() === $invoice_key ) ) {
1924
+        return $return;
1925
+    }
1926
+
1927
+    if ( is_user_logged_in() ) {
1928
+        if ( (int)$invoice->get_user_id() === (int) get_current_user_id() ) {
1929
+            $return = true;
1930
+        }
1931
+    }
1932
+
1933
+    $session = wpinv_get_checkout_session();
1934
+    if ( isset( $_GET['invoice_key'] ) || ( $session && isset( $session['invoice_key'] ) ) ) {
1935
+        $check_key = isset( $_GET['invoice_key'] ) ? $_GET['invoice_key'] : $session['invoice_key'];
1936
+
1937
+        if ( wpinv_require_login_to_checkout() ) {
1938
+            $return = $return && $check_key === $invoice_key;
1939
+        } else {
1940
+            $return = $check_key === $invoice_key;
1941
+        }
1942
+    }
1943
+
1944
+    return (bool) apply_filters( 'wpinv_can_view_receipt', $return, $invoice_key );
1945 1945
 }
1946 1946
 
1947 1947
 function wpinv_pay_for_invoice() {
Please login to merge, or discard this patch.
includes/class-wpinv-privacy.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@
 block discarded – undo
31 31
     public function get_privacy_message() {
32 32
 
33 33
         $content = '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' .
34
-                   '<div contenteditable="false">' .
35
-                   '<p class="wp-policy-help">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' .
36
-                   '</div>' .
37
-                   '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' .
38
-                   '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' .
39
-                   '<ul>' .
40
-                   '<li>' . __( '- Send you important account/order/service information.', 'invoicing' ) . '</li>' .
41
-                   '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' .
42
-                   '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' .
43
-                   '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
44
-                   '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' .
45
-                   '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
46
-                   '</ul>' .
47
-                   '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' .
48
-                   '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' .
49
-                   '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' .
50
-                   '<div contenteditable="false">' .
51
-                   '<p class="wp-policy-help">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' .
52
-                   '</div>' .
53
-                   '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' .
54
-                   '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>';
34
+                    '<div contenteditable="false">' .
35
+                    '<p class="wp-policy-help">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' .
36
+                    '</div>' .
37
+                    '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' .
38
+                    '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' .
39
+                    '<ul>' .
40
+                    '<li>' . __( '- Send you important account/order/service information.', 'invoicing' ) . '</li>' .
41
+                    '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' .
42
+                    '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' .
43
+                    '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
44
+                    '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' .
45
+                    '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
46
+                    '</ul>' .
47
+                    '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' .
48
+                    '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' .
49
+                    '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' .
50
+                    '<div contenteditable="false">' .
51
+                    '<p class="wp-policy-help">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' .
52
+                    '</div>' .
53
+                    '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' .
54
+                    '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>';
55 55
 
56 56
 
57 57
 
Please login to merge, or discard this patch.