@@ -37,8 +37,10 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | static function encrypt ($pwd, $data, $ispwdHex = 0) |
| 39 | 39 | { |
| 40 | - if ($ispwdHex) |
|
| 41 | - $pwd = @pack('H*', $pwd); // valid input, please! |
|
| 40 | + if ($ispwdHex) { |
|
| 41 | + $pwd = @pack('H*', $pwd); |
|
| 42 | + } |
|
| 43 | + // valid input, please! |
|
| 42 | 44 | |
| 43 | 45 | $key[] = ''; |
| 44 | 46 | $box[] = ''; |
@@ -269,7 +269,9 @@ |
||
| 269 | 269 | self::$log[] = '<strong>Options:</strong> <pre>'.htmlspecialchars(print_r($options, true)).'</pre>'; |
| 270 | 270 | unset( $form_part_signed ); |
| 271 | 271 | foreach ($options as $option) { |
| 272 | - if( !isset($form_part_signed) ) $form_part_signed = $list[0]; |
|
| 272 | + if( !isset($form_part_signed) ) { |
|
| 273 | + $form_part_signed = $list[0]; |
|
| 274 | + } |
|
| 273 | 275 | $option_signed = preg_replace( |
| 274 | 276 | '%'.preg_quote($option[1]).preg_quote($option[2]).preg_quote($option[1]).'%', |
| 275 | 277 | $option[1].self::fc_hash_value($code, $list[2], $option[2], 'value', FALSE).$option[1], |
@@ -81,13 +81,17 @@ discard block |
||
| 81 | 81 | public static function getCustomer($Member = null) { |
| 82 | 82 | |
| 83 | 83 | // throw error if no $Member Object |
| 84 | - if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR); |
|
| 84 | + if (!isset($Member)) { |
|
| 85 | + trigger_error('No Member set', E_USER_ERROR); |
|
| 86 | + } |
|
| 85 | 87 | |
| 86 | 88 | // grab customer record from API |
| 87 | 89 | |
| 88 | 90 | $foxyData = array(); |
| 89 | 91 | $foxyData["api_action"] = "customer_get"; |
| 90 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 92 | + if ($Member->Customer_ID) { |
|
| 93 | + $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 94 | + } |
|
| 91 | 95 | $foxyData["customer_email"] = $Member->Email; |
| 92 | 96 | |
| 93 | 97 | return self::getAPIRequest($foxyData); |
@@ -102,7 +106,9 @@ discard block |
||
| 102 | 106 | $foxyData = array(); |
| 103 | 107 | $foxyData["api_action"] = "customer_save"; |
| 104 | 108 | // customer_id will be 0 if created in SilverStripe. |
| 105 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 109 | + if ($Member->Customer_ID) { |
|
| 110 | + $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 111 | + } |
|
| 106 | 112 | $foxyData["customer_email"] = $Member->Email; |
| 107 | 113 | $foxyData["customer_password_hash"] = $Member->Password; |
| 108 | 114 | $foxyData["customer_password_salt"] = $Member->Salt; |
@@ -65,7 +65,9 @@ |
||
| 65 | 65 | $groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups()) |
| 66 | 66 | ->setEmptyString('') |
| 67 | 67 | ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>')); |
| 68 | - if (class_exists('QuickAddNewExtension')) $groupField->useAddNew('OptionGroup', $groups, $groupFields); |
|
| 68 | + if (class_exists('QuickAddNewExtension')) { |
|
| 69 | + $groupField->useAddNew('OptionGroup', $groups, $groupFields); |
|
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | $fields->addFieldsToTab('Root.Main', array( |
| 71 | 73 | HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2), |
@@ -110,7 +110,9 @@ discard block |
||
| 110 | 110 | $billingAddress->PostalCode = (string) $order->customer_postal_code; |
| 111 | 111 | $billingAddress->Country = (string) $order->customer_country; |
| 112 | 112 | $billingAddress->Phone = (string) $order->customer_phone; |
| 113 | - if($customer) $billingAddress->CustomerID = $customer->ID; |
|
| 113 | + if($customer) { |
|
| 114 | + $billingAddress->CustomerID = $customer->ID; |
|
| 115 | + } |
|
| 114 | 116 | |
| 115 | 117 | // record billing address |
| 116 | 118 | $billingAddress->write(); |
@@ -129,7 +131,9 @@ discard block |
||
| 129 | 131 | $shippingAddress->PostalCode = (string) $order->shipping_postal_code; |
| 130 | 132 | $shippingAddress->Country = (string) $order->shipping_country; |
| 131 | 133 | $shippingAddress->Phone = (string) $order->shipping_phone; |
| 132 | - if($customer) $shippingAddress->CustomerID = $customer->ID; |
|
| 134 | + if($customer) { |
|
| 135 | + $shippingAddress->CustomerID = $customer->ID; |
|
| 136 | + } |
|
| 133 | 137 | |
| 134 | 138 | // record shipping address |
| 135 | 139 | $shippingAddress->write(); |
@@ -103,11 +103,15 @@ discard block |
||
| 103 | 103 | Settings > FoxyStripe > Categories |
| 104 | 104 | </a>' |
| 105 | 105 | )); |
| 106 | - if (class_exists('QuickAddNewExtension')) $catField->useAddNew('ProductCategory', $source); |
|
| 106 | + if (class_exists('QuickAddNewExtension')) { |
|
| 107 | + $catField->useAddNew('ProductCategory', $source); |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | // Product Images gridfield |
| 109 | 111 | $config = GridFieldConfig_RelationEditor::create(); |
| 110 | - if (class_exists('GridFieldSortableRows')) $config->addComponent(new GridFieldSortableRows('SortOrder')); |
|
| 112 | + if (class_exists('GridFieldSortableRows')) { |
|
| 113 | + $config->addComponent(new GridFieldSortableRows('SortOrder')); |
|
| 114 | + } |
|
| 111 | 115 | if (class_exists('GridFieldBulkImageUpload')) { |
| 112 | 116 | $config->addComponent(new GridFieldBulkUpload()); |
| 113 | 117 | $config->getComponentByType('GridFieldBulkUpload')->setUfConfig('folderName', 'Uploads/ProductImages'); |
@@ -121,11 +125,13 @@ discard block |
||
| 121 | 125 | |
| 122 | 126 | // Product Options field |
| 123 | 127 | $config = GridFieldConfig_RelationEditor::create(); |
| 124 | - if (class_exists('GridFieldBulkManager')) $config->addComponent(new GridFieldBulkManager()); |
|
| 128 | + if (class_exists('GridFieldBulkManager')) { |
|
| 129 | + $config->addComponent(new GridFieldBulkManager()); |
|
| 130 | + } |
|
| 125 | 131 | if (class_exists('GridFieldSortableRows')){ |
| 126 | 132 | $config->addComponent(new GridFieldSortableRows('SortOrder')); |
| 127 | 133 | $products = $this->ProductOptions()->sort('SortOrder'); |
| 128 | - }else{ |
|
| 134 | + } else{ |
|
| 129 | 135 | $products = $this->ProductOptions(); |
| 130 | 136 | } |
| 131 | 137 | $config->removeComponentsByType('GridFieldAddExistingAutocompleter'); |
@@ -396,10 +402,12 @@ discard block |
||
| 396 | 402 | if ($this->DiscountTitle && $this->ProductDiscountTiers()->exists()) { |
| 397 | 403 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'discount_quantity_percentage', $data->getDiscountFieldValue()))->setValue($data->getDiscountFieldValue())); |
| 398 | 404 | } |
| 399 | - if ($this->PreviewImage()->Exists()) $fields->push( |
|
| 405 | + if ($this->PreviewImage()->Exists()) { |
|
| 406 | + $fields->push( |
|
| 400 | 407 | HiddenField::create(ProductPage::getGeneratedValue($code, 'image', $data->PreviewImage()->PaddedImage(80, 80)->absoluteURL)) |
| 401 | 408 | ->setValue($data->PreviewImage()->PaddedImage(80, 80)->absoluteURL) |
| 402 | 409 | ); |
| 410 | + } |
|
| 403 | 411 | |
| 404 | 412 | $options = $data->ProductOptions(); |
| 405 | 413 | $groupedOptions = new GroupedList($options); |
@@ -416,7 +424,9 @@ discard block |
||
| 416 | 424 | $fullOptions = array(); |
| 417 | 425 | foreach($set as $item){ |
| 418 | 426 | $fullOptions[ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value')] = $item->getGeneratedTitle(); |
| 419 | - if(!$item->Availability) array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value')); |
|
| 427 | + if(!$item->Availability) { |
|
| 428 | + array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value')); |
|
| 429 | + } |
|
| 420 | 430 | } |
| 421 | 431 | $optionsSet->push( |
| 422 | 432 | $dropdown = DropdownField::create($name, $title, $fullOptions)->setTitle($title) |
@@ -452,7 +462,7 @@ discard block |
||
| 452 | 462 | $submit->setAttribute('Disabled', true); |
| 453 | 463 | } |
| 454 | 464 | $this->extend('updatePurchaseFormFields', $fields); |
| 455 | - }else{ |
|
| 465 | + } else{ |
|
| 456 | 466 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4); |
| 457 | 467 | $actions = FieldList::create(); |
| 458 | 468 | } |
@@ -47,8 +47,10 @@ discard block |
||
| 47 | 47 | $config->addComponent(new GridFieldSortableRows("SortOrder"), 'GridFieldManyRelationHandler'); |
| 48 | 48 | } |
| 49 | 49 | $config->removeComponentsByType('GridFieldAddExistingAutocompleter'); |
| 50 | - }else{ |
|
| 51 | - if(class_exists('GridFieldSortableRows')) $config->addComponent(new GridFieldSortableRows("SortOrder")); |
|
| 50 | + } else{ |
|
| 51 | + if(class_exists('GridFieldSortableRows')) { |
|
| 52 | + $config->addComponent(new GridFieldSortableRows("SortOrder")); |
|
| 53 | + } |
|
| 52 | 54 | } |
| 53 | 55 | $config->removeComponentsByType($config->getComponentByType('GridFieldAddNewButton')); |
| 54 | 56 | |
@@ -84,7 +86,9 @@ discard block |
||
| 84 | 86 | public function loadDescendantProductGroupIDListInto(&$idList) { |
| 85 | 87 | if ($children = $this->AllChildren()) { |
| 86 | 88 | foreach($children as $child) { |
| 87 | - if(in_array($child->ID, $idList)) continue; |
|
| 89 | + if(in_array($child->ID, $idList)) { |
|
| 90 | + continue; |
|
| 91 | + } |
|
| 88 | 92 | |
| 89 | 93 | if($child instanceof ProductHolder) { |
| 90 | 94 | $idList[] = $child->ID; |
@@ -122,7 +126,7 @@ discard block |
||
| 122 | 126 | |
| 123 | 127 | if($config->MultiGroup){ |
| 124 | 128 | $entries = $this->Products()->sort('SortOrder'); |
| 125 | - }else{ |
|
| 129 | + } else{ |
|
| 126 | 130 | $filter = '"ParentID" = ' . $this->ID; |
| 127 | 131 | |
| 128 | 132 | // Build a list of all IDs for ProductGroups that are children |
@@ -131,7 +135,9 @@ discard block |
||
| 131 | 135 | // If no ProductHolders, no ProductPages. So return false |
| 132 | 136 | if($holderIDs) { |
| 133 | 137 | // Otherwise, do the actual query |
| 134 | - if($filter) $filter .= ' OR '; |
|
| 138 | + if($filter) { |
|
| 139 | + $filter .= ' OR '; |
|
| 140 | + } |
|
| 135 | 141 | $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ")"; |
| 136 | 142 | } |
| 137 | 143 | |