@@ -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 | /** |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | // handle POST from FoxyCart API transaction |
| 44 | 44 | if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) { |
| 45 | 45 | $FoxyData_encrypted = (isset($_POST['FoxyData'])) ? |
| 46 | - urldecode($_POST['FoxyData']) : |
|
| 47 | - urldecode($_POST['FoxySubscriptionData']); |
|
| 46 | + urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']); |
|
| 48 | 47 | $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
| 49 | 48 | |
| 50 | 49 | // parse the response and save the order |
@@ -54,7 +53,7 @@ discard block |
||
| 54 | 53 | $this->extend('addIntegrations', $FoxyData_encrypted); |
| 55 | 54 | |
| 56 | 55 | return 'foxy'; |
| 57 | - } else { |
|
| 56 | + }else { |
|
| 58 | 57 | return 'No FoxyData or FoxySubscriptionData received.'; |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -137,7 +136,7 @@ discard block |
||
| 137 | 136 | /* todo: make sure local password is updated if changed on FoxyCart |
| 138 | 137 | $this->updatePasswordFromData($customer, $order); |
| 139 | 138 | */ |
| 140 | - } else { |
|
| 139 | + }else { |
|
| 141 | 140 | // create new Member, set password info from FoxyCart |
| 142 | 141 | $customer = Member::create(); |
| 143 | 142 | $customer->Customer_ID = (int)$order->customer_id; |
@@ -164,11 +163,11 @@ discard block |
||
| 164 | 163 | Security::config()->update('password_encryption_algorithm', 'none'); |
| 165 | 164 | |
| 166 | 165 | $customer->PasswordEncryption = 'none'; |
| 167 | - $customer->Password = (string) $order->customer_password; |
|
| 166 | + $customer->Password = (string)$order->customer_password; |
|
| 168 | 167 | $customer->write(); |
| 169 | 168 | |
| 170 | - $customer->PasswordEncryption = $this->getEncryption((string) $order->customer_password_hash_type); |
|
| 171 | - $customer->Salt = (string) $order->customer_password_salt; |
|
| 169 | + $customer->PasswordEncryption = $this->getEncryption((string)$order->customer_password_hash_type); |
|
| 170 | + $customer->Salt = (string)$order->customer_password_salt; |
|
| 172 | 171 | |
| 173 | 172 | Security::config()->update('password_encryption_algorithm', $password_encryption_algorithm); |
| 174 | 173 | } |
@@ -259,7 +258,7 @@ discard block |
||
| 259 | 258 | } |
| 260 | 259 | |
| 261 | 260 | return ProductPage::get() |
| 262 | - ->filter('ID', (int) $productOptions->product_option_value) |
|
| 261 | + ->filter('ID', (int)$productOptions->product_option_value) |
|
| 263 | 262 | ->First(); |
| 264 | 263 | } |
| 265 | 264 | } |
@@ -309,18 +308,18 @@ discard block |
||
| 309 | 308 | // to do: consider a login/registration form here if not logged in |
| 310 | 309 | if ($Member = Security::getCurrentUser()) { |
| 311 | 310 | $Member = Security::getCurrentUser(); |
| 312 | - } else { |
|
| 311 | + }else { |
|
| 313 | 312 | $Member = new Member(); |
| 314 | 313 | $Member->Customer_ID = 0; |
| 315 | 314 | } |
| 316 | 315 | |
| 317 | - $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey()); |
|
| 316 | + $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey()); |
|
| 318 | 317 | |
| 319 | 318 | $config = FoxyStripeSetting::current_foxystripe_setting(); |
| 320 | 319 | if ($config->CustomSSL) { |
| 321 | 320 | $link = FoxyCart::getFoxyCartStoreName(); |
| 322 | - } else { |
|
| 323 | - $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com'; |
|
| 321 | + }else { |
|
| 322 | + $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
| 324 | 323 | } |
| 325 | 324 | |
| 326 | 325 | $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token.'&fcsid='.$fcsid. |
@@ -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 | |
@@ -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) { |
@@ -178,7 +175,7 @@ discard block |
||
| 178 | 175 | ->setValue( |
| 179 | 176 | ProductPage::getGeneratedValue($code, 'price', $this->product->Price, 'value') |
| 180 | 177 | ) |
| 181 | - );//can't override id |
|
| 178 | + ); //can't override id |
|
| 182 | 179 | if ($this->product->Weight > 0) { |
| 183 | 180 | $fields->push( |
| 184 | 181 | HiddenField::create('weight') |
@@ -221,7 +218,7 @@ discard block |
||
| 221 | 218 | ); |
| 222 | 219 | |
| 223 | 220 | $fields->push( |
| 224 | - HeaderField::create('submitPrice', '$' . $this->product->Price, 4) |
|
| 221 | + HeaderField::create('submitPrice', '$'.$this->product->Price, 4) |
|
| 225 | 222 | ->addExtraClass('submit-price') |
| 226 | 223 | ); |
| 227 | 224 | $fields->push( |
@@ -230,7 +227,7 @@ discard block |
||
| 230 | 227 | ); |
| 231 | 228 | |
| 232 | 229 | $this->extend('updatePurchaseFormFields', $fields); |
| 233 | - } else { |
|
| 230 | + }else { |
|
| 234 | 231 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock', 4)); |
| 235 | 232 | } |
| 236 | 233 | |
@@ -276,7 +273,7 @@ discard block |
||
| 276 | 273 | */ |
| 277 | 274 | protected function getProductOptionSet() |
| 278 | 275 | { |
| 279 | - $assignAvailable = function ($self) { |
|
| 276 | + $assignAvailable = function($self) { |
|
| 280 | 277 | /** @var OptionItem $self */ |
| 281 | 278 | $this->extend('updateFoxyStripePurchaseForm', $form); |
| 282 | 279 | $self->Available = ($self->getAvailability()) ? true : false; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getCMSFields() |
| 71 | 71 | { |
| 72 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 72 | + $this->beforeUpdateCMSFields(function(FieldList $fields) { |
|
| 73 | 73 | if (FoxyStripeSetting::current_foxystripe_setting()->MultiGroup) { |
| 74 | 74 | $config = GridFieldConfig_RelationEditor::create(); |
| 75 | 75 | $config->addComponent(new GridFieldOrderableRows('SortOrder')); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | if ($config->MultiGroup) { |
| 152 | 152 | $entries = $this->Products()->sort('SortOrder'); |
| 153 | - } else { |
|
| 154 | - $filter = '"ParentID" = ' . $this->ID; |
|
| 153 | + }else { |
|
| 154 | + $filter = '"ParentID" = '.$this->ID; |
|
| 155 | 155 | |
| 156 | 156 | // Build a list of all IDs for ProductGroups that are children |
| 157 | 157 | $holderIDs = $this->ProductGroupIDs(); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if ($filter) { |
| 163 | 163 | $filter .= ' OR '; |
| 164 | 164 | } |
| 165 | - $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ')'; |
|
| 165 | + $filter .= '"ParentID" IN ('.implode(',', $holderIDs).')'; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $order = '"SiteTree"."Title" ASC'; |