@@ -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 | } |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | // handle POST from FoxyCart API transaction |
| 40 | 40 | if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) { |
| 41 | 41 | $FoxyData_encrypted = (isset($_POST['FoxyData'])) ? |
| 42 | - urldecode($_POST['FoxyData']) : |
|
| 43 | - urldecode($_POST['FoxySubscriptionData']); |
|
| 42 | + urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']); |
|
| 44 | 43 | $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
| 45 | 44 | |
| 46 | 45 | // parse the response and save the order |
@@ -50,7 +49,7 @@ discard block |
||
| 50 | 49 | $this->extend('addIntegrations', $FoxyData_encrypted); |
| 51 | 50 | |
| 52 | 51 | return 'foxy'; |
| 53 | - } else { |
|
| 52 | + }else { |
|
| 54 | 53 | return 'No FoxyData or FoxySubscriptionData received.'; |
| 55 | 54 | } |
| 56 | 55 | } |
@@ -69,12 +68,11 @@ discard block |
||
| 69 | 68 | foreach ($orders->transactions->transaction as $transaction) { |
| 70 | 69 | // if FoxyCart order id, then parse order |
| 71 | 70 | if (isset($transaction->id)) { |
| 72 | - ($order = Order::get()->filter('Order_ID', (int) $transaction->id)->First()) ? |
|
| 73 | - $order = Order::get()->filter('Order_ID', (int) $transaction->id)->First() : |
|
| 74 | - $order = Order::create(); |
|
| 71 | + ($order = Order::get()->filter('Order_ID', (int)$transaction->id)->First()) ? |
|
| 72 | + $order = Order::get()->filter('Order_ID', (int)$transaction->id)->First() : $order = Order::create(); |
|
| 75 | 73 | |
| 76 | 74 | // save base order info |
| 77 | - $order->Order_ID = (int) $transaction->id; |
|
| 75 | + $order->Order_ID = (int)$transaction->id; |
|
| 78 | 76 | $order->Response = urlencode($encrypted); |
| 79 | 77 | $order->write(); |
| 80 | 78 | } |
@@ -96,7 +94,7 @@ discard block |
||
| 96 | 94 | // to do: consider a login/registration form here if not logged in |
| 97 | 95 | if ($Member = Member::currentUser()) { |
| 98 | 96 | $Member = Member::currentUser(); |
| 99 | - } else { |
|
| 97 | + }else { |
|
| 100 | 98 | $Member = new Member(); |
| 101 | 99 | $Member->Customer_ID = 0; |
| 102 | 100 | } |