Passed
Push — master ( f76276...ca99e2 )
by Stiofan
03:29
created
gateways/authorizenet/anet_php_sdk/lib/shared/AuthorizeNetXMLResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             $this->xml = @simplexml_load_string($response);
30 30
             
31 31
             // Remove namespaces for use with XPath.
32
-            $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/','',$response));
32
+            $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/', '', $response));
33 33
         }
34 34
     }
35 35
     
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $start = "<$elementName>";
118 118
         $end = "</$elementName>";
119
-        if (strpos($this->response,$start) === false || strpos($this->response,$end) === false) {
119
+        if (strpos($this->response, $start) === false || strpos($this->response, $end) === false) {
120 120
             return false;
121 121
         } else {
122
-            $start_position = strpos($this->response, $start)+strlen($start);
122
+            $start_position = strpos($this->response, $start) + strlen($start);
123 123
             $end_position = strpos($this->response, $end);
124
-            return substr($this->response, $start_position, $end_position-$start_position);
124
+            return substr($this->response, $start_position, $end_position - $start_position);
125 125
         }
126 126
     }
127 127
 
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetSIM.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
         $string = "";
183 183
         foreach ($array as $key => $value) {
184 184
             if ($value) {
185
-                $string .= '<input type="hidden" name="'.$key.'" value="'.$value.'">';
185
+                $string .= '<input type="hidden" name="' . $key . '" value="' . $value . '">';
186 186
             }
187 187
         }
188 188
         return $string;
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetARB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
      */
117 117
     protected function _setPostString()
118 118
     {
119
-        $this->_post_string =<<<XML
119
+        $this->_post_string = <<<XML
120 120
 <?xml version="1.0" encoding="utf-8"?>
121 121
 <ARB{$this->_request_type} xmlns= "AnetApi/xml/v1/schema/AnetApiSchema.xsd">
122 122
     <merchantAuthentication>
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetCIM.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
     {
310 310
         $this->_validationMode = $validationMode;
311 311
         $this->_constructXml("validateCustomerPaymentProfileRequest");
312
-        $this->_xml->addChild("customerProfileId",$customerProfileId);
313
-        $this->_xml->addChild("customerPaymentProfileId",$customerPaymentProfileId);
314
-        $this->_xml->addChild("customerShippingAddressId",$customerShippingAddressId);
315
-        $this->_xml->addChild("cardCode",$cardCode);
312
+        $this->_xml->addChild("customerProfileId", $customerProfileId);
313
+        $this->_xml->addChild("customerPaymentProfileId", $customerPaymentProfileId);
314
+        $this->_xml->addChild("customerShippingAddressId", $customerShippingAddressId);
315
+        $this->_xml->addChild("cardCode", $cardCode);
316 316
         return $this->_sendRequest();
317 317
     }
318 318
     
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
      */
342 342
     protected function _setPostString()
343 343
     {
344
-        ($this->_validationMode != "none" ? $this->_xml->addChild('validationMode',$this->_validationMode) : "");
344
+        ($this->_validationMode != "none" ? $this->_xml->addChild('validationMode', $this->_validationMode) : "");
345 345
         $this->_post_string = $this->_xml->asXML();
346 346
         
347 347
         // Add extraOptions CDATA
348 348
         if ($this->_extraOptions) {
349 349
             $this->_xml->addChild("extraOptions");
350
-            $this->_post_string = str_replace("<extraOptions></extraOptions>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML());
350
+            $this->_post_string = str_replace("<extraOptions></extraOptions>", '<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML());
351 351
             $this->_extraOptions = false;
352 352
         }
353 353
         // Blank out our validation mode, so that we don't include it in calls that
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
      */
363 363
     private function _constructXml($request_type)
364 364
     {
365
-        $string = '<?xml version="1.0" encoding="utf-8"?><'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></'.$request_type.'>';
365
+        $string = '<?xml version="1.0" encoding="utf-8"?><' . $request_type . ' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></' . $request_type . '>';
366 366
         $this->_xml = @new SimpleXMLElement($string);
367 367
         $merchant = $this->_xml->addChild('merchantAuthentication');
368
-        $merchant->addChild('name',$this->_api_login);
369
-        $merchant->addChild('transactionKey',$this->_transaction_key);
370
-        ($this->_refId ? $this->_xml->addChild('refId',$this->_refId) : "");
368
+        $merchant->addChild('name', $this->_api_login);
369
+        $merchant->addChild('transactionKey', $this->_transaction_key);
370
+        ($this->_refId ? $this->_xml->addChild('refId', $this->_refId) : "");
371 371
     }
372 372
     
373 373
     /**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                         $this->_addObject($items, $item);
388 388
                     }
389 389
                 } else {
390
-                    $destination->addChild($key,$value);
390
+                    $destination->addChild($key, $value);
391 391
                 }
392 392
             } elseif (is_object($value) && self::_notEmpty($value)) {
393 393
                 $dest = $destination->addChild($key);
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetCP.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 
117 117
                 $this->xml = @simplexml_load_string($response);
118 118
                 // Set all fields
119
-                $this->version              = array_pop(array_slice(explode('"', $response), 1,1));
119
+                $this->version              = array_pop(array_slice(explode('"', $response), 1, 1));
120 120
                 $this->response_code        = (string)$this->xml->ResponseCode;
121 121
                 
122 122
                 if ($this->response_code == 1) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 // Split Array
145 145
                 $this->response = $response;
146 146
                 if ($encap_char) {
147
-                    $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
147
+                    $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
148 148
                 } else {
149 149
                     $this->_response_array = explode($delimiter, $response);
150 150
                 }
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
             
191 191
             if ($this->error) {
192 192
                 $this->error_message = "AuthorizeNet Error:
193
-                Response Code: ".$this->response_code."
194
-                Response Reason Code: ".$this->response_reason_code."
195
-                Response Reason Text: ".$this->response_reason_text."
193
+                Response Code: ".$this->response_code . "
194
+                Response Reason Code: ".$this->response_reason_code . "
195
+                Response Reason Text: ".$this->response_reason_text . "
196 196
                 ";
197 197
             }
198 198
             
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetTD.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $month = ($month ? $month : date('m'));
66 66
         $year = ($year ? $year : date('Y'));
67
-        $firstSettlementDate = substr(date('c',mktime(0, 0, 0, $month, 1, $year)),0,-6);
68
-        $lastSettlementDate  = substr(date('c',mktime(0, 0, 0, $month+1, 0, $year)),0,-6);
67
+        $firstSettlementDate = substr(date('c', mktime(0, 0, 0, $month, 1, $year)), 0, -6);
68
+        $lastSettlementDate  = substr(date('c', mktime(0, 0, 0, $month + 1, 0, $year)), 0, -6);
69 69
         return $this->getSettledBatchList(true, $firstSettlementDate, $lastSettlementDate);
70 70
     }
71 71
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
         $month = ($month ? $month : date('m'));
99 99
         $day = ($day ? $day : date('d'));
100 100
         $year = ($year ? $year : date('Y'));
101
-        $firstSettlementDate = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6);
102
-        $lastSettlementDate  = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6);
101
+        $firstSettlementDate = substr(date('c', mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)), 0, -6);
102
+        $lastSettlementDate  = substr(date('c', mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)), 0, -6);
103 103
         $response = $this->getSettledBatchList(true, $firstSettlementDate, $lastSettlementDate);
104 104
         $batches = $response->xpath("batchList/batch");
105 105
         foreach ($batches as $batch) {
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
      */
188 188
     private function _constructXml($request_type)
189 189
     {
190
-        $string = '<?xml version="1.0" encoding="utf-8"?><'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></'.$request_type.'>';
190
+        $string = '<?xml version="1.0" encoding="utf-8"?><' . $request_type . ' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></' . $request_type . '>';
191 191
         $this->_xml = @new SimpleXMLElement($string);
192 192
         $merchant = $this->_xml->addChild('merchantAuthentication');
193
-        $merchant->addChild('name',$this->_api_login);
194
-        $merchant->addChild('transactionKey',$this->_transaction_key);
193
+        $merchant->addChild('name', $this->_api_login);
194
+        $merchant->addChild('transactionKey', $this->_transaction_key);
195 195
     }
196 196
     
197 197
 }
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetSOAP.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
         $string = "";
52 52
         $types = $this->__getTypes();
53 53
         foreach ($types as $type) {
54
-            if (preg_match("/struct /",$type)) {
55
-                $type = preg_replace("/struct /","class ",$type);
56
-                $type = preg_replace("/ (\w+) (\w+);/","    // $1\n    public \$$2;",$type);
57
-                $string .= $type ."\n";
54
+            if (preg_match("/struct /", $type)) {
55
+                $type = preg_replace("/struct /", "class ", $type);
56
+                $type = preg_replace("/ (\w+) (\w+);/", "    // $1\n    public \$$2;", $type);
57
+                $string .= $type . "\n";
58 58
             }
59 59
         }
60 60
         return $string;
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function saveSoapDocumentation($path)
86 86
     {
87
-        $string =  "<?php\n";
87
+        $string = "<?php\n";
88 88
         $string .= "/**\n";
89 89
         $string .= " * Auto generated documentation for the AuthorizeNetSOAP API.\n";
90 90
         $string .= " * Generated " . date("m/d/Y") . "\n";
91 91
         $string .= " */\n";
92 92
         $string .= "class AuthorizeNetSOAP\n";
93
-        $string .= "{\n" . $this->getSoapMethods() . "\n}\n\n" . $this->getSoapTypes() ."\n\n ?>";
93
+        $string .= "{\n" . $this->getSoapMethods() . "\n}\n\n" . $this->getSoapTypes() . "\n\n ?>";
94 94
         return file_put_contents($path, $string);
95 95
     }
96 96
     
Please login to merge, or discard this patch.
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetDPM.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 else
58 58
                 {
59 59
                     // Redirect to error page.
60
-                    $redirect_url = $url . '?response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text;
60
+                    $redirect_url = $url . '?response_code=' . $response->response_code . '&response_reason_text=' . $response->response_reason_text;
61 61
                 }
62 62
                 // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
63 63
                 echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
@@ -179,54 +179,54 @@  discard block
 block discarded – undo
179 179
             -moz-box-shadow: inset 3px -3px 3px rgba(0,0,0,.5), inset 0 3px 3px rgba(255,255,255,.5), inset -3px 0 3px rgba(255,255,255,.75);
180 180
             box-shadow: inset 3px -3px 3px rgba(0,0,0,.5), inset 0 3px 3px rgba(255,255,255,.5), inset -3px 0 3px rgba(255,255,255,.75); }
181 181
         </style>
182
-        <form method="post" action="'.$post_url.'">
183
-                '.$hidden_fields.'
182
+        <form method="post" action="'.$post_url . '">
183
+                '.$hidden_fields . '
184 184
             <fieldset>
185 185
                 <div>
186 186
                     <label>Credit Card Number</label>
187
-                    <input type="text" class="text" size="15" name="x_card_num" value="'.($prefill ? '6011000000000012' : '').'"></input>
187
+                    <input type="text" class="text" size="15" name="x_card_num" value="'.($prefill ? '6011000000000012' : '') . '"></input>
188 188
                 </div>
189 189
                 <div>
190 190
                     <label>Exp.</label>
191
-                    <input type="text" class="text" size="4" name="x_exp_date" value="'.($prefill ? '04/17' : '').'"></input>
191
+                    <input type="text" class="text" size="4" name="x_exp_date" value="'.($prefill ? '04/17' : '') . '"></input>
192 192
                 </div>
193 193
                 <div>
194 194
                     <label>CCV</label>
195
-                    <input type="text" class="text" size="4" name="x_card_code" value="'.($prefill ? '782' : '').'"></input>
195
+                    <input type="text" class="text" size="4" name="x_card_code" value="'.($prefill ? '782' : '') . '"></input>
196 196
                 </div>
197 197
             </fieldset>
198 198
             <fieldset>
199 199
                 <div>
200 200
                     <label>First Name</label>
201
-                    <input type="text" class="text" size="15" name="x_first_name" value="'.($prefill ? 'John' : '').'"></input>
201
+                    <input type="text" class="text" size="15" name="x_first_name" value="'.($prefill ? 'John' : '') . '"></input>
202 202
                 </div>
203 203
                 <div>
204 204
                     <label>Last Name</label>
205
-                    <input type="text" class="text" size="14" name="x_last_name" value="'.($prefill ? 'Doe' : '').'"></input>
205
+                    <input type="text" class="text" size="14" name="x_last_name" value="'.($prefill ? 'Doe' : '') . '"></input>
206 206
                 </div>
207 207
             </fieldset>
208 208
             <fieldset>
209 209
                 <div>
210 210
                     <label>Address</label>
211
-                    <input type="text" class="text" size="26" name="x_address" value="'.($prefill ? '123 Main Street' : '').'"></input>
211
+                    <input type="text" class="text" size="26" name="x_address" value="'.($prefill ? '123 Main Street' : '') . '"></input>
212 212
                 </div>
213 213
                 <div>
214 214
                     <label>City</label>
215
-                    <input type="text" class="text" size="15" name="x_city" value="'.($prefill ? 'Boston' : '').'"></input>
215
+                    <input type="text" class="text" size="15" name="x_city" value="'.($prefill ? 'Boston' : '') . '"></input>
216 216
                 </div>
217 217
             </fieldset>
218 218
             <fieldset>
219 219
                 <div>
220 220
                     <label>State</label>
221
-                    <input type="text" class="text" size="4" name="x_state" value="'.($prefill ? 'MA' : '').'"></input>
221
+                    <input type="text" class="text" size="4" name="x_state" value="'.($prefill ? 'MA' : '') . '"></input>
222 222
                 </div>
223 223
                 <div>
224 224
                     <label>Zip Code</label>
225
-                    <input type="text" class="text" size="9" name="x_zip" value="'.($prefill ? '02142' : '').'"></input>
225
+                    <input type="text" class="text" size="9" name="x_zip" value="'.($prefill ? '02142' : '') . '"></input>
226 226
                 </div>
227 227
                 <div>
228 228
                     <label>Country</label>
229
-                    <input type="text" class="text" size="22" name="x_country" value="'.($prefill ? 'US' : '').'"></input>
229
+                    <input type="text" class="text" size="22" name="x_country" value="'.($prefill ? 'US' : '') . '"></input>
230 230
                 </div>
231 231
             </fieldset>
232 232
             <input type="submit" value="BUY" class="submit buy">
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5
-add_action( 'wpinv_manual_cc_form', '__return_false' );
5
+add_action('wpinv_manual_cc_form', '__return_false');
6 6
 
7
-function wpinv_process_manual_payment( $purchase_data ) {
8
-    if( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'wpi-gateway' ) ) {
9
-        wp_die( __( 'Nonce verification has failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
7
+function wpinv_process_manual_payment($purchase_data) {
8
+    if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'wpi-gateway')) {
9
+        wp_die(__('Nonce verification has failed', 'invoicing'), __('Error', 'invoicing'), array('response' => 403));
10 10
     }
11 11
 
12 12
     /*
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
     );
42 42
 
43 43
     // Record the pending payment
44
-    $invoice = wpinv_get_invoice( $purchase_data['invoice_id'] );
44
+    $invoice = wpinv_get_invoice($purchase_data['invoice_id']);
45 45
     
46
-    if ( !empty( $invoice ) ) {        
47
-        wpinv_set_payment_transaction_id( $invoice->ID, $invoice->generate_key() );
48
-        wpinv_update_payment_status( $invoice, 'publish' );
46
+    if (!empty($invoice)) {        
47
+        wpinv_set_payment_transaction_id($invoice->ID, $invoice->generate_key());
48
+        wpinv_update_payment_status($invoice, 'publish');
49 49
         
50 50
         // Empty the shopping cart
51 51
         wpinv_empty_cart();
52 52
         
53
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
53
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
54 54
     } else {
55
-        wpinv_record_gateway_error( __( 'Payment Error', 'invoicing' ), sprintf( __( 'Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing' ), json_encode( $payment_data ) ), $invoice );
55
+        wpinv_record_gateway_error(__('Payment Error', 'invoicing'), sprintf(__('Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing'), json_encode($payment_data)), $invoice);
56 56
         // If errors are present, send the user back to the purchase page so they can be corrected
57
-        wpinv_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['wpi-gateway'] );
57
+        wpinv_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['wpi-gateway']);
58 58
     }
59 59
 }
60
-add_action( 'wpinv_gateway_manual', 'wpinv_process_manual_payment' );
61 60
\ No newline at end of file
61
+add_action('wpinv_gateway_manual', 'wpinv_process_manual_payment');
62 62
\ No newline at end of file
Please login to merge, or discard this patch.