@@ -117,12 +117,10 @@ discard block |
||
| 117 | 117 | $this->setSiteConfig($siteConfig); |
| 118 | 118 | |
| 119 | 119 | $fields = ($fields != null && $fields->exists()) ? |
| 120 | - $this->getProductFields($fields) : |
|
| 121 | - $this->getProductFields(FieldList::create()); |
|
| 120 | + $this->getProductFields($fields) : $this->getProductFields(FieldList::create()); |
|
| 122 | 121 | |
| 123 | 122 | $actions = ($actions != null && $actions->exists()) ? |
| 124 | - $this->getProductActions($actions) : |
|
| 125 | - $this->getProductActions(FieldList::create()); |
|
| 123 | + $this->getProductActions($actions) : $this->getProductActions(FieldList::create()); |
|
| 126 | 124 | $validator = (!empty($validator) || $validator != null) ? $validator : RequiredFields::create(); |
| 127 | 125 | |
| 128 | 126 | parent::__construct($controller, $name, $fields, $actions, $validator); |
@@ -131,7 +129,7 @@ discard block |
||
| 131 | 129 | $this->setAttribute('action', FoxyCart::FormActionURL()); |
| 132 | 130 | $this->disableSecurityToken(); |
| 133 | 131 | |
| 134 | - $this->setHTMLID($this->getTemplateHelper()->generateFormID($this) . "_{$product->ID}"); |
|
| 132 | + $this->setHTMLID($this->getTemplateHelper()->generateFormID($this)."_{$product->ID}"); |
|
| 135 | 133 | } |
| 136 | 134 | |
| 137 | 135 | /** |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | { |
| 144 | 142 | //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js'); |
| 145 | 143 | $hiddenTitle = ($this->product->ReceiptTitle) ? |
| 146 | - htmlspecialchars($this->product->ReceiptTitle) : |
|
| 147 | - htmlspecialchars($this->product->Title); |
|
| 144 | + htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title); |
|
| 148 | 145 | $code = $this->product->Code; |
| 149 | 146 | |
| 150 | 147 | if ($this->product->Available) { |
@@ -172,7 +169,7 @@ discard block |
||
| 172 | 169 | $code, |
| 173 | 170 | 'price', |
| 174 | 171 | $this->product->Price |
| 175 | - ))->setValue($this->product->Price));//can't override id |
|
| 172 | + ))->setValue($this->product->Price)); //can't override id |
|
| 176 | 173 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue( |
| 177 | 174 | $code, |
| 178 | 175 | 'weight', |
@@ -212,7 +209,7 @@ discard block |
||
| 212 | 209 | ); |
| 213 | 210 | |
| 214 | 211 | $fields->push( |
| 215 | - HeaderField::create('submitPrice', '$' . $this->product->Price, 4) |
|
| 212 | + HeaderField::create('submitPrice', '$'.$this->product->Price, 4) |
|
| 216 | 213 | ->addExtraClass('submit-price') |
| 217 | 214 | ); |
| 218 | 215 | $fields->push( |
@@ -221,7 +218,7 @@ discard block |
||
| 221 | 218 | ); |
| 222 | 219 | |
| 223 | 220 | $this->extend('updatePurchaseFormFields', $fields); |
| 224 | - } else { |
|
| 221 | + }else { |
|
| 225 | 222 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock', 4)); |
| 226 | 223 | } |
| 227 | 224 | |
@@ -267,7 +264,7 @@ discard block |
||
| 267 | 264 | */ |
| 268 | 265 | protected function getProductOptionSet() |
| 269 | 266 | { |
| 270 | - $assignAvailable = function ($self) { |
|
| 267 | + $assignAvailable = function($self) { |
|
| 271 | 268 | /** @var OptionItem $self */ |
| 272 | 269 | $this->extend('updateFoxyStripePurchaseForm', $form); |
| 273 | 270 | $self->Available = ($self->getAvailability()) ? true : false; |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function getCMSFields() |
| 228 | 228 | { |
| 229 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 229 | + $this->beforeUpdateCMSFields(function(FieldList $fields) { |
|
| 230 | 230 | // Cateogry Dropdown field w/ add new |
| 231 | - $source = function () { |
|
| 231 | + $source = function() { |
|
| 232 | 232 | return ProductCategory::get()->map()->toArray(); |
| 233 | 233 | }; |
| 234 | 234 | $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source()) |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $product = self::get()->byID($this->ID); |
| 369 | 369 | if (isset($product->ParentID)) { |
| 370 | 370 | $origParent = $product->ParentID; |
| 371 | - } else { |
|
| 371 | + }else { |
|
| 372 | 372 | $origParent = null; |
| 373 | 373 | } |
| 374 | 374 | $currentParent = $this->ParentID; |
@@ -448,8 +448,7 @@ discard block |
||
| 448 | 448 | $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName; |
| 449 | 449 | |
| 450 | 450 | return (FoxyStripeSetting::current_foxystripe_setting()->CartValidation) |
| 451 | - ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : |
|
| 452 | - $optionValue; |
|
| 451 | + ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue; |
|
| 453 | 452 | } |
| 454 | 453 | |
| 455 | 454 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $rules = Director::config()->get('rules'); |
| 37 | 37 | $rule = array_search(FoxyStripeController::class, $rules); |
| 38 | - $myURL = Director::absoluteBaseURL() . explode('//', $rule)[0]; |
|
| 38 | + $myURL = Director::absoluteBaseURL().explode('//', $rule)[0]; |
|
| 39 | 39 | $myKey = FoxyCart::getStoreKey(); |
| 40 | 40 | |
| 41 | 41 | $this->updateConfig(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $email = $emails[count($emails) - 1]; |
| 123 | 123 | return preg_replace_callback( |
| 124 | 124 | "|(\d+)|", |
| 125 | - function ($mathces) { |
|
| 125 | + function($mathces) { |
|
| 126 | 126 | return ++$mathces[1]; |
| 127 | 127 | }, |
| 128 | 128 | |
@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | // handle POST from FoxyCart API transaction |
| 46 | 46 | if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) { |
| 47 | 47 | $FoxyData_encrypted = (isset($_POST['FoxyData'])) ? |
| 48 | - urldecode($_POST['FoxyData']) : |
|
| 49 | - urldecode($_POST['FoxySubscriptionData']); |
|
| 48 | + urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']); |
|
| 50 | 49 | $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
| 51 | 50 | |
| 52 | 51 | // parse the response and save the order |
@@ -56,7 +55,7 @@ discard block |
||
| 56 | 55 | $this->extend('addIntegrations', $FoxyData_encrypted); |
| 57 | 56 | |
| 58 | 57 | return 'foxy'; |
| 59 | - } else { |
|
| 58 | + }else { |
|
| 60 | 59 | return 'No FoxyData or FoxySubscriptionData received.'; |
| 61 | 60 | } |
| 62 | 61 | } |
@@ -149,7 +148,7 @@ discard block |
||
| 149 | 148 | /* todo: make sure local password is updated if changed on FoxyCart |
| 150 | 149 | $this->updatePasswordFromData($customer, $order); |
| 151 | 150 | */ |
| 152 | - } else { |
|
| 151 | + }else { |
|
| 153 | 152 | // create new Member, set password info from FoxyCart |
| 154 | 153 | $customer = Member::create(); |
| 155 | 154 | $customer->Customer_ID = (int)$order->customer_id; |
@@ -322,22 +321,22 @@ discard block |
||
| 322 | 321 | // to do: consider a login/registration form here if not logged in |
| 323 | 322 | if ($Member = Security::getCurrentUser()) { |
| 324 | 323 | $Member = Security::getCurrentUser(); |
| 325 | - } else { |
|
| 324 | + }else { |
|
| 326 | 325 | $Member = new Member(); |
| 327 | 326 | $Member->Customer_ID = 0; |
| 328 | 327 | } |
| 329 | 328 | |
| 330 | - $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey()); |
|
| 329 | + $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey()); |
|
| 331 | 330 | |
| 332 | 331 | $config = FoxyStripeSetting::current_foxystripe_setting(); |
| 333 | 332 | if ($config->CustomSSL) { |
| 334 | 333 | $link = FoxyCart::getFoxyCartStoreName(); |
| 335 | - } else { |
|
| 336 | - $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com'; |
|
| 334 | + }else { |
|
| 335 | + $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
| 337 | 336 | } |
| 338 | 337 | |
| 339 | - $redirect_complete = 'https://' . $link . '/checkout?fc_auth_token=' . $auth_token . '&fcsid=' . $fcsid . |
|
| 340 | - '&fc_customer_id=' . $Member->Customer_ID . '×tamp=' . $timestampNew; |
|
| 338 | + $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token.'&fcsid='.$fcsid. |
|
| 339 | + '&fc_customer_id='.$Member->Customer_ID.'×tamp='.$timestampNew; |
|
| 341 | 340 | |
| 342 | 341 | $this->redirect($redirect_complete); |
| 343 | 342 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | if (count($errors)) { |
| 154 | - Injector::inst()->get(LoggerInterface::class)->error('setCurrentStore errors - ' . json_encode($errors)); |
|
| 154 | + Injector::inst()->get(LoggerInterface::class)->error('setCurrentStore errors - '.json_encode($errors)); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $errors = array_merge($errors, $client->getErrors($result)); |
| 190 | 190 | if (count($errors)) { |
| 191 | - Injector::inst()->get(LoggerInterface::class)->error('updateStore errors - ' . json_encode($errors)); |
|
| 191 | + Injector::inst()->get(LoggerInterface::class)->error('updateStore errors - '.json_encode($errors)); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $errors = array_merge($errors, $client->getErrors($result)); |
| 219 | 219 | if (count($errors)) { |
| 220 | 220 | Injector::inst() |
| 221 | - ->get(LoggerInterface::class)->error('setItemCategoriesURL errors - ' . json_encode($errors)); |
|
| 221 | + ->get(LoggerInterface::class)->error('setItemCategoriesURL errors - '.json_encode($errors)); |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $errors = array_merge($errors, $client->getErrors($result)); |
| 248 | 248 | if (count($errors)) { |
| 249 | 249 | Injector::inst() |
| 250 | - ->get(LoggerInterface::class)->error('setItemCategories errors - ' . json_encode($errors)); |
|
| 250 | + ->get(LoggerInterface::class)->error('setItemCategories errors - '.json_encode($errors)); |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | $errors = array_merge($errors, $client->getErrors($result)); |
| 277 | 277 | if (count($errors)) { |
| 278 | - Injector::inst()->get(LoggerInterface::class)->error('getCategory errors - ' . json_encode($errors)); |
|
| 278 | + Injector::inst()->get(LoggerInterface::class)->error('getCategory errors - '.json_encode($errors)); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -296,12 +296,12 @@ discard block |
||
| 296 | 296 | if ($client) { |
| 297 | 297 | if ($category = $this->getCategory($data['code'])) { |
| 298 | 298 | $result = $client->patch($category, $data); |
| 299 | - } else { |
|
| 299 | + }else { |
|
| 300 | 300 | $result = $client->post($this->getItemCategoriesURL(), $data); |
| 301 | 301 | } |
| 302 | 302 | $errors = array_merge($errors, $client->getErrors($result)); |
| 303 | 303 | if (count($errors)) { |
| 304 | - Injector::inst()->get(LoggerInterface::class)->error('putCategory errors - ' . json_encode($errors)); |
|
| 304 | + Injector::inst()->get(LoggerInterface::class)->error('putCategory errors - '.json_encode($errors)); |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $errors = array_merge($errors, $client->getErrors($result)); |
| 323 | 323 | if (count($errors)) { |
| 324 | - Injector::inst()->get(LoggerInterface::class)->error('deleteCategory errors - ' . json_encode($errors)); |
|
| 324 | + Injector::inst()->get(LoggerInterface::class)->error('deleteCategory errors - '.json_encode($errors)); |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | |
| 100 | 100 | if (!$this->getCustomer()->Customer_ID) { |
| 101 | 101 | $response = $client->post($this->getNewCustomerAPIURI(), $this->getSendData()); |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | $response = $client->patch($this->getAPIURI(true), $this->getSendData()); |
| 104 | 104 | } |
| 105 | 105 | |