@@ -46,7 +46,7 @@ |
||
46 | 46 | // Grab customer_id record from FoxyCart response, store in Member |
47 | 47 | if ($response) { |
48 | 48 | $foxyResponse = new \SimpleXMLElement($response); |
49 | - $this->owner->Customer_ID = (int) $foxyResponse->customer_id; |
|
49 | + $this->owner->Customer_ID = (int)$foxyResponse->customer_id; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | if (Security::getCurrentUser()) { |
22 | 22 | return true; |
23 | - } else { |
|
23 | + }else { |
|
24 | 24 | return Security::permissionFailure($this, _t( |
25 | 25 | 'AccountPage.CANNOTCONFIRMLOGGEDIN', |
26 | 26 | 'Please login to view this page.' |
@@ -262,7 +262,7 @@ |
||
262 | 262 | if ($client) { |
263 | 263 | if ($category = $this->getCategory($data['code'])) { |
264 | 264 | $result = $client->patch($category, $data); |
265 | - } else { |
|
265 | + }else { |
|
266 | 266 | $result = $client->post($this->getItemCategoriesURL(), $data); |
267 | 267 | } |
268 | 268 | $errors = array_merge($errors, $client->getErrors($result)); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | if (SiteConfig::current_site_config()->CartValidation) { |
45 | 45 | Requirements::javascript('framework/thirdparty/jquery-validate/jquery.validate.js'); |
46 | 46 | Requirements::javascriptTemplate('foxystripe/javascript/donationProduct.js', [ |
47 | - 'Trigger' => (string) $currencyField->getAttribute('id'), |
|
47 | + 'Trigger' => (string)$currencyField->getAttribute('id'), |
|
48 | 48 | 'UpdateURL' => Director::absoluteURL($this->Link('updatevalue')), |
49 | 49 | ]); |
50 | 50 | } |
@@ -146,7 +146,7 @@ |
||
146 | 146 | |
147 | 147 | if ($config->MultiGroup) { |
148 | 148 | $entries = $this->Products()->sort('SortOrder'); |
149 | - } else { |
|
149 | + }else { |
|
150 | 150 | $filter = '"ParentID" = '.$this->ID; |
151 | 151 | |
152 | 152 | // Build a list of all IDs for ProductGroups that are children |
@@ -105,12 +105,10 @@ discard block |
||
105 | 105 | $this->setSiteConfig($siteConfig); |
106 | 106 | |
107 | 107 | $fields = ($fields != null && $fields->exists()) ? |
108 | - $this->getProductFields($fields) : |
|
109 | - $this->getProductFields(FieldList::create()); |
|
108 | + $this->getProductFields($fields) : $this->getProductFields(FieldList::create()); |
|
110 | 109 | |
111 | 110 | $actions = ($actions != null && $actions->exists()) ? |
112 | - $this->getProductActions($actions) : |
|
113 | - $this->getProductActions(FieldList::create()); |
|
111 | + $this->getProductActions($actions) : $this->getProductActions(FieldList::create()); |
|
114 | 112 | $validator = (!empty($validator) || $validator != null) ? $validator : RequiredFields::create(); |
115 | 113 | |
116 | 114 | parent::__construct($controller, $name, $fields, $actions, $validator); |
@@ -128,8 +126,7 @@ discard block |
||
128 | 126 | protected function getProductFields(FieldList $fields) |
129 | 127 | { |
130 | 128 | $hiddenTitle = ($this->product->ReceiptTitle) ? |
131 | - htmlspecialchars($this->product->ReceiptTitle) : |
|
132 | - htmlspecialchars($this->product->Title); |
|
129 | + htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title); |
|
133 | 130 | $code = $this->product->Code; |
134 | 131 | |
135 | 132 | if ($this->product->Available) { |
@@ -157,7 +154,7 @@ discard block |
||
157 | 154 | $code, |
158 | 155 | 'price', |
159 | 156 | $this->product->Price |
160 | - ))->setValue($this->product->Price));//can't override id |
|
157 | + ))->setValue($this->product->Price)); //can't override id |
|
161 | 158 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue( |
162 | 159 | $code, |
163 | 160 | 'weight', |
@@ -200,7 +197,7 @@ discard block |
||
200 | 197 | ->addExtraClass('hidden unavailable-text')); |
201 | 198 | |
202 | 199 | $this->extend('updatePurchaseFormFields', $fields); |
203 | - } else { |
|
200 | + }else { |
|
204 | 201 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4); |
205 | 202 | } |
206 | 203 | |
@@ -246,7 +243,7 @@ discard block |
||
246 | 243 | */ |
247 | 244 | protected function getProductOptionSet() |
248 | 245 | { |
249 | - $assignAvailable = function ($self) { |
|
246 | + $assignAvailable = function($self) { |
|
250 | 247 | $this->extend('updateFoxyStripePurchaseForm', $form); |
251 | 248 | $self->Available = ($self->getAvailability()) ? true : false; |
252 | 249 | }; |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | .'$1', $input); |
330 | 330 | } |
331 | 331 | self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
332 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]). |
|
333 | - '</strong> :: Value: <strong>'.htmlspecialchars($value[2]). |
|
334 | - '</strong><br />Initial input: '.htmlspecialchars($input). |
|
335 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>'; |
|
332 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]). |
|
333 | + '</strong> :: Value: <strong>'.htmlspecialchars($value[2]). |
|
334 | + '</strong><br />Initial input: '.htmlspecialchars($input). |
|
335 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>'; |
|
336 | 336 | $form = str_replace($input, $input_signed, $form); |
337 | 337 | } |
338 | 338 | } |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | ); |
374 | 374 | $form_part_signed = str_replace($option[0], $option_signed, $form_part_signed); |
375 | 375 | self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
376 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]). |
|
377 | - '</strong> :: Value: <strong>'.htmlspecialchars($option[2]). |
|
378 | - '</strong><br />Initial option: '.htmlspecialchars($option[0]). |
|
379 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>'; |
|
376 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]). |
|
377 | + '</strong> :: Value: <strong>'.htmlspecialchars($option[2]). |
|
378 | + '</strong><br />Initial option: '.htmlspecialchars($option[0]). |
|
379 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>'; |
|
380 | 380 | } |
381 | 381 | $form = str_replace($list[0], $form_part_signed, $form); |
382 | 382 | } |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | ); |
408 | 408 | $form = str_replace($textarea[0], $textarea_signed, $form); |
409 | 409 | self::$log[] = '<strong>TEXTAREA:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
410 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]). |
|
411 | - '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]). |
|
412 | - '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]). |
|
413 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>'; |
|
410 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]). |
|
411 | + '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]). |
|
412 | + '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]). |
|
413 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>'; |
|
414 | 414 | } |
415 | 415 | self::$log[] = '<strong>FORM after TEXTAREAS:</strong> <pre>'.htmlspecialchars($form).'</pre>'; |
416 | 416 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | if ($output) { |
161 | 161 | echo self::$cart_url.'?'.$qs; |
162 | - } else { |
|
162 | + }else { |
|
163 | 163 | return self::$cart_url.'?'.$qs; |
164 | 164 | } |
165 | 165 | } |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | if ($option_value == '--OPEN--') { |
184 | 184 | $hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret()); |
185 | 185 | $value = ($urlencode) ? urlencode($option_name).'||'.$hash.'||open' : $option_name.'||'.$hash.'||open'; |
186 | - } else { |
|
186 | + }else { |
|
187 | 187 | $hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret()); |
188 | 188 | if ($method == 'name') { |
189 | 189 | $value = ($urlencode) ? urlencode($option_name).'||'.$hash : $option_name.'||'.$hash; |
190 | - } else { |
|
190 | + }else { |
|
191 | 191 | $value = ($urlencode) ? urlencode($option_value).'||'.$hash : $option_value.'||'.$hash; |
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | 195 | if ($output) { |
196 | 196 | echo $value; |
197 | - } else { |
|
197 | + }else { |
|
198 | 198 | return $value; |
199 | 199 | } |
200 | 200 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | .preg_quote($value[2]).'\1%', '${1}' |
323 | 323 | .self::fc_hash_value($code, $name[2], $value[2], 'value', false) |
324 | 324 | .'$1', $input); |
325 | - } else { |
|
325 | + }else { |
|
326 | 326 | $input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2]) |
327 | 327 | .'\1%', '${1}'.$prefix |
328 | 328 | .self::fc_hash_value($code, $name[2], $value[2], 'name', false) |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $parentCode = $product->Code; |
111 | 111 | |
112 | 112 | // ProductOptionGroup Dropdown field w/ add new |
113 | - $groups = function () { |
|
113 | + $groups = function() { |
|
114 | 114 | return OptionGroup::get()->map()->toArray(); |
115 | 115 | }; |
116 | 116 | $groupFields = singleton(OptionGroup::class)->getCMSFields(); |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function getGeneratedValue() |
322 | 322 | { |
323 | - $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0'; |
|
323 | + $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0'; |
|
324 | 324 | $modPriceWithSymbol = self::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice; |
325 | - $modWeight = ($this->WeightModifier) ? (string) $this->WeightModifier : '0'; |
|
325 | + $modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0'; |
|
326 | 326 | $modWeight = self::getOptionModifierActionSymbol($this->WeightModifierAction).$modWeight; |
327 | 327 | $modCode = self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier; |
328 | 328 | |
@@ -334,14 +334,13 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function getGeneratedTitle() |
336 | 336 | { |
337 | - $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0'; |
|
337 | + $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0'; |
|
338 | 338 | $title = $this->Title; |
339 | 339 | $title .= ($this->PriceModifier != 0) ? |
340 | 340 | ': ('.self::getOptionModifierActionSymbol( |
341 | 341 | $this->PriceModifierAction, |
342 | 342 | $returnWithOnlyPlusMinus = true |
343 | - ).'$'.$modPrice.')' : |
|
344 | - ''; |
|
343 | + ).'$'.$modPrice.')' : ''; |
|
345 | 344 | |
346 | 345 | return $title; |
347 | 346 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->parseOrderDetails($response); |
190 | 190 | |
191 | 191 | return true; |
192 | - } else { |
|
192 | + }else { |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | } |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | { |
202 | 202 | foreach ($response->transactions->transaction as $transaction) { |
203 | 203 | // Record transaction data from FoxyCart Datafeed: |
204 | - $this->Store_ID = (int) $transaction->store_id; |
|
205 | - $this->TransactionDate = (string) $transaction->transaction_date; |
|
206 | - $this->ProductTotal = (float) $transaction->product_total; |
|
207 | - $this->TaxTotal = (float) $transaction->tax_total; |
|
208 | - $this->ShippingTotal = (float) $transaction->shipping_total; |
|
209 | - $this->OrderTotal = (float) $transaction->order_total; |
|
210 | - $this->ReceiptURL = (string) $transaction->receipt_url; |
|
211 | - $this->OrderStatus = (string) $transaction->status; |
|
204 | + $this->Store_ID = (int)$transaction->store_id; |
|
205 | + $this->TransactionDate = (string)$transaction->transaction_date; |
|
206 | + $this->ProductTotal = (float)$transaction->product_total; |
|
207 | + $this->TaxTotal = (float)$transaction->tax_total; |
|
208 | + $this->ShippingTotal = (float)$transaction->shipping_total; |
|
209 | + $this->OrderTotal = (float)$transaction->order_total; |
|
210 | + $this->ReceiptURL = (string)$transaction->receipt_url; |
|
211 | + $this->OrderStatus = (string)$transaction->status; |
|
212 | 212 | |
213 | 213 | $this->extend('handleOrderInfo', $order, $response); |
214 | 214 | } |
@@ -227,18 +227,18 @@ discard block |
||
227 | 227 | if (Member::get()->filter('Email', $transaction->customer_email)->First()) { |
228 | 228 | $customer = Member::get()->filter('Email', $transaction->customer_email)->First(); |
229 | 229 | // if new customer, create account with data from FoxyCart |
230 | - } else { |
|
230 | + }else { |
|
231 | 231 | // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again |
232 | 232 | Config::inst()->update('Security', 'password_encryption_algorithm', 'none'); |
233 | 233 | |
234 | 234 | // create new Member, set password info from FoxyCart |
235 | 235 | $customer = Member::create(); |
236 | - $customer->Customer_ID = (int) $transaction->customer_id; |
|
237 | - $customer->FirstName = (string) $transaction->customer_first_name; |
|
238 | - $customer->Surname = (string) $transaction->customer_last_name; |
|
239 | - $customer->Email = (string) $transaction->customer_email; |
|
240 | - $customer->Password = (string) $transaction->customer_password; |
|
241 | - $customer->Salt = (string) $transaction->customer_password_salt; |
|
236 | + $customer->Customer_ID = (int)$transaction->customer_id; |
|
237 | + $customer->FirstName = (string)$transaction->customer_first_name; |
|
238 | + $customer->Surname = (string)$transaction->customer_last_name; |
|
239 | + $customer->Email = (string)$transaction->customer_email; |
|
240 | + $customer->Password = (string)$transaction->customer_password; |
|
241 | + $customer->Salt = (string)$transaction->customer_password_salt; |
|
242 | 242 | $customer->PasswordEncryption = 'none'; |
243 | 243 | |
244 | 244 | // record member record |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | foreach ($transaction->transaction_details->transaction_detail as $detail) { |
275 | 275 | $OrderDetail = OrderDetail::create(); |
276 | 276 | |
277 | - $OrderDetail->Quantity = (int) $detail->product_quantity; |
|
278 | - $OrderDetail->ProductName = (string) $detail->product_name; |
|
279 | - $OrderDetail->ProductCode = (string) $detail->product_code; |
|
280 | - $OrderDetail->ProductImage = (string) $detail->image; |
|
281 | - $OrderDetail->ProductCategory = (string) $detail->category_code; |
|
277 | + $OrderDetail->Quantity = (int)$detail->product_quantity; |
|
278 | + $OrderDetail->ProductName = (string)$detail->product_name; |
|
279 | + $OrderDetail->ProductCode = (string)$detail->product_code; |
|
280 | + $OrderDetail->ProductImage = (string)$detail->image; |
|
281 | + $OrderDetail->ProductCategory = (string)$detail->category_code; |
|
282 | 282 | $priceModifier = 0; |
283 | 283 | |
284 | 284 | // parse OrderOptions |
@@ -286,14 +286,14 @@ discard block |
||
286 | 286 | // Find product via product_id custom variable |
287 | 287 | if ($option->product_option_name == 'product_id') { |
288 | 288 | // if product is found, set relation to OrderDetail |
289 | - $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value); |
|
289 | + $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value); |
|
290 | 290 | if ($OrderProduct) { |
291 | 291 | $OrderDetail->ProductID = $OrderProduct->ID; |
292 | 292 | } |
293 | - } else { |
|
293 | + }else { |
|
294 | 294 | $OrderOption = OrderOption::create(); |
295 | - $OrderOption->Name = (string) $option->product_option_name; |
|
296 | - $OrderOption->Value = (string) $option->product_option_value; |
|
295 | + $OrderOption->Name = (string)$option->product_option_name; |
|
296 | + $OrderOption->Value = (string)$option->product_option_value; |
|
297 | 297 | $OrderOption->write(); |
298 | 298 | $OrderDetail->OrderOptions()->add($OrderOption); |
299 | 299 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | - $OrderDetail->Price = (float) $detail->product_price + (float) $priceModifier; |
|
304 | + $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier; |
|
305 | 305 | |
306 | 306 | // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart |
307 | 307 | $this->extend('handleOrderItem', $order, $response, $OrderDetail); |