@@ -165,20 +165,17 @@ |
||
165 | 165 | { |
166 | 166 | $xmlx = $xml; |
167 | 167 | $first = false; |
168 | - } |
|
169 | - else |
|
168 | + } else |
|
170 | 169 | { |
171 | 170 | $parent = $xml->xpath('parent::*'); |
172 | 171 | $xmlx = $parent[0]->addChild($xml->getName()); |
173 | 172 | } |
174 | - } |
|
175 | - else |
|
173 | + } else |
|
176 | 174 | { |
177 | 175 | $xmlx = $xml->addChild($key); |
178 | 176 | } |
179 | 177 | $this->setParameters($xmlx, $value); |
180 | - } |
|
181 | - else |
|
178 | + } else |
|
182 | 179 | { |
183 | 180 | $xml->$key = $value; |
184 | 181 | } |
@@ -53,16 +53,14 @@ discard block |
||
53 | 53 | { |
54 | 54 | // Do your processing here. |
55 | 55 | $redirect_url = $url . '?response_code=1&transaction_id=' . $response->transaction_id; |
56 | - } |
|
57 | - else |
|
56 | + } else |
|
58 | 57 | { |
59 | 58 | // Redirect to error page. |
60 | 59 | $redirect_url = $url . '?response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text; |
61 | 60 | } |
62 | 61 | // Send the Javascript back to AuthorizeNet, which will redirect user back to your site. |
63 | 62 | echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url); |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | echo "Error -- not AuthorizeNet. Check your MD5 Setting."; |
68 | 66 | } |
@@ -73,8 +71,7 @@ discard block |
||
73 | 71 | if ($_GET['response_code'] == 1) |
74 | 72 | { |
75 | 73 | echo "Thank you for your purchase! Transaction id: " . htmlentities($_GET['transaction_id']); |
76 | - } |
|
77 | - else |
|
74 | + } else |
|
78 | 75 | { |
79 | 76 | echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']); |
80 | 77 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | add_filter( 'wpinv_authorizenet_support_subscription', '__return_true' ); |
6 | 8 |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | add_action( 'wpinv_manual_cc_form', '__return_false' ); |
6 | 8 |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | add_action( 'wpinv_bank_transfer_cc_form', '__return_false' ); |
6 | 8 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | add_action( 'wpinv_paypal_cc_form', '__return_false' ); |
6 | 8 | add_filter( 'wpinv_paypal_support_subscription', '__return_true' ); |
@@ -307,8 +309,9 @@ discard block |
||
307 | 309 | } |
308 | 310 | |
309 | 311 | // Check if $post_data_array has been populated |
310 | - if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) |
|
311 | - return; |
|
312 | + if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) { |
|
313 | + return; |
|
314 | + } |
|
312 | 315 | |
313 | 316 | $defaults = array( |
314 | 317 | 'txn_type' => '', |
@@ -95,20 +95,24 @@ |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( !empty( $user_info ) ) { |
98 | - if( empty( $address['first_name'] ) ) |
|
99 | - $address['first_name'] = $user_info->first_name; |
|
98 | + if( empty( $address['first_name'] ) ) { |
|
99 | + $address['first_name'] = $user_info->first_name; |
|
100 | + } |
|
100 | 101 | |
101 | - if( empty( $address['last_name'] ) ) |
|
102 | - $address['last_name'] = $user_info->last_name; |
|
102 | + if( empty( $address['last_name'] ) ) { |
|
103 | + $address['last_name'] = $user_info->last_name; |
|
104 | + } |
|
103 | 105 | } |
104 | 106 | |
105 | 107 | $address['name'] = trim( trim( $address['first_name'] . ' ' . $address['last_name'] ), "," ); |
106 | 108 | |
107 | - if( empty( $address['state'] ) && $with_default ) |
|
108 | - $address['state'] = wpinv_get_default_state(); |
|
109 | + if( empty( $address['state'] ) && $with_default ) { |
|
110 | + $address['state'] = wpinv_get_default_state(); |
|
111 | + } |
|
109 | 112 | |
110 | - if( empty( $address['country'] ) && $with_default ) |
|
111 | - $address['country'] = wpinv_get_default_country(); |
|
113 | + if( empty( $address['country'] ) && $with_default ) { |
|
114 | + $address['country'] = wpinv_get_default_country(); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | |
114 | 118 | return $address; |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | function wpinv_get_item_by( $field = '', $value = '', $type = '' ) { |
6 | 8 | if( empty( $field ) || empty( $value ) ) { |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | function wpinv_get_item( $item = 0 ) { |
119 | 121 | if ( is_numeric( $item ) ) { |
120 | 122 | $item = get_post( $item ); |
121 | - if ( ! $item || 'wpi_item' !== $item->post_type ) |
|
122 | - return null; |
|
123 | + if ( ! $item || 'wpi_item' !== $item->post_type ) { |
|
124 | + return null; |
|
125 | + } |
|
123 | 126 | return $item; |
124 | 127 | } |
125 | 128 | |
@@ -283,8 +286,9 @@ discard block |
||
283 | 286 | } |
284 | 287 | |
285 | 288 | function wpinv_remove_item_logs_on_delete( $item_id = 0 ) { |
286 | - if ( 'wpi_item' !== get_post_type( $item_id ) ) |
|
287 | - return; |
|
289 | + if ( 'wpi_item' !== get_post_type( $item_id ) ) { |
|
290 | + return; |
|
291 | + } |
|
288 | 292 | |
289 | 293 | global $wpinv_logs; |
290 | 294 |
@@ -83,8 +83,9 @@ discard block |
||
83 | 83 | |
84 | 84 | $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_transaction_id' AND meta_value = %s LIMIT 1", $key ) ); |
85 | 85 | |
86 | - if ( $invoice_id != NULL ) |
|
87 | - return $invoice_id; |
|
86 | + if ( $invoice_id != NULL ) { |
|
87 | + return $invoice_id; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | return 0; |
90 | 91 | } |
@@ -750,8 +751,9 @@ discard block |
||
750 | 751 | function wpinv_checkout_validate_cc_zip( $zip = 0, $country_code = '' ) { |
751 | 752 | $ret = false; |
752 | 753 | |
753 | - if ( empty( $zip ) || empty( $country_code ) ) |
|
754 | - return $ret; |
|
754 | + if ( empty( $zip ) || empty( $country_code ) ) { |
|
755 | + return $ret; |
|
756 | + } |
|
755 | 757 | |
756 | 758 | $country_code = strtoupper( $country_code ); |
757 | 759 | |
@@ -913,8 +915,9 @@ discard block |
||
913 | 915 | "ZM" => "\d{5}" |
914 | 916 | ); |
915 | 917 | |
916 | - if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) |
|
917 | - $ret = true; |
|
918 | + if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) { |
|
919 | + $ret = true; |
|
920 | + } |
|
918 | 921 | |
919 | 922 | return apply_filters( 'wpinv_is_zip_valid', $ret, $zip, $country_code ); |
920 | 923 | } |
@@ -1238,14 +1241,15 @@ discard block |
||
1238 | 1241 | } |
1239 | 1242 | } |
1240 | 1243 | |
1241 | - if ( get_query_var( 'paged' ) ) |
|
1242 | - $args['page'] = get_query_var('paged'); |
|
1243 | - else if ( get_query_var( 'page' ) ) |
|
1244 | - $args['page'] = get_query_var( 'page' ); |
|
1245 | - else if ( !empty( $args[ 'page' ] ) ) |
|
1246 | - $args['page'] = $args[ 'page' ]; |
|
1247 | - else |
|
1248 | - $args['page'] = 1; |
|
1244 | + if ( get_query_var( 'paged' ) ) { |
|
1245 | + $args['page'] = get_query_var('paged'); |
|
1246 | + } else if ( get_query_var( 'page' ) ) { |
|
1247 | + $args['page'] = get_query_var( 'page' ); |
|
1248 | + } else if ( !empty( $args[ 'page' ] ) ) { |
|
1249 | + $args['page'] = $args[ 'page' ]; |
|
1250 | + } else { |
|
1251 | + $args['page'] = 1; |
|
1252 | + } |
|
1249 | 1253 | |
1250 | 1254 | /** |
1251 | 1255 | * Generate WP_Query args. This logic will change if orders are moved to |
@@ -1380,8 +1384,9 @@ discard block |
||
1380 | 1384 | |
1381 | 1385 | $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 ) ); |
1382 | 1386 | |
1383 | - if ( $invoice_id != NULL ) |
|
1384 | - return $invoice_id; |
|
1387 | + if ( $invoice_id != NULL ) { |
|
1388 | + return $invoice_id; |
|
1389 | + } |
|
1385 | 1390 | |
1386 | 1391 | return 0; |
1387 | 1392 | } |