Passed
Push — master ( e3fcf4...82e94b )
by
unknown
02:37
created
code/forms/CountryPrice_OrderFormAddressExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         if ($allowedCountries->count()) {
13 13
             $allowedCountryCodes = $allowedCountries->column('Code');
14 14
             foreach ($newSource as $key => $value) {
15
-                if (! in_array($key, $allowedCountryCodes)) {
15
+                if (!in_array($key, $allowedCountryCodes)) {
16 16
                     unset($newSource[$key]);
17 17
                 }
18 18
             }
Please login to merge, or discard this patch.
code/model/Distributor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         //secondary for another country
112 112
         $fields->removeByName('Versions');
113 113
         if ($listOfCountriesCovered && $listOfCountriesCovered->count()) {
114
-            $countryArray =  array(" -- please select --") + $listOfCountriesCovered->toArray();
114
+            $countryArray = array(" -- please select --") + $listOfCountriesCovered->toArray();
115 115
             $fields->addFieldToTab("Root.CountryDetails", DropdownField::create("PrimaryCountryID", "Primary Country", $countryArray));
116 116
         } else {
117 117
             $fields->removeByName('PrimaryCountryID');
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         'IsDefault' => 'Default',
144 144
                         'Email' => 'Email'
145 145
                     );
146
-                    $table = '<table class="versions"><thead><tr><th>' . implode('</th><th>', $columns) . '</th></tr></thead><tbody>';
146
+                    $table = '<table class="versions"><thead><tr><th>'.implode('</th><th>', $columns).'</th></tr></thead><tbody>';
147 147
                     $version = $this->Version - 1;
148 148
                     while ($version > 0) {
149 149
                         $versionDO = Versioned::get_version('Distributor', $this->ID, $version--);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                         foreach ($columns as $column => $title) {
152 152
                             $values[] = $versionDO->$column;
153 153
                         }
154
-                        $table .= '<tr><td>' . implode('</td><td>', $values) . '</td></tr>';
154
+                        $table .= '<tr><td>'.implode('</td><td>', $values).'</td></tr>';
155 155
                     }
156 156
                     $table .= '</tbody></table>';
157 157
                     $table .= "<style type=\"text/css\">
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         }
235 235
         if ($this->PrimaryCountryID > 0 && EcommerceCountry::get()->byID(intval($this->PrimaryCountryID))) {
236 236
             $primaryCountry = $this->PrimaryCountry();
237
-            if (! $this->Countries()->byID($this->PrimaryCountryID)) {
237
+            if (!$this->Countries()->byID($this->PrimaryCountryID)) {
238 238
                 $this->Countries()->add($primaryCountry);
239 239
             }
240 240
         } else {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     public function onAfterWrite()
254 254
     {
255 255
         parent::onAfterWrite();
256
-        if (! self::$_ran_after_write) {
256
+        if (!self::$_ran_after_write) {
257 257
             self::$_ran_after_write = true;
258 258
             $this->setupUser();
259 259
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $member = Member::create($filter);
372 372
                 //$thisMember->SetPassword = substr(session_id, 0, 8);
373 373
             }
374
-            $member->FirstName = trim(_t('Distributor.SINGULAR_NAME', 'Distributor') . _t('Distributor.FOR', ' for '));
374
+            $member->FirstName = trim(_t('Distributor.SINGULAR_NAME', 'Distributor')._t('Distributor.FOR', ' for '));
375 375
             $member->Surname = $this->Name;
376 376
             $member->DistributorID = $this->ID;
377 377
             $member->write();
Please login to merge, or discard this patch.
code/model/buyables/CountryPrice_CopyPrices.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
             } else {
26 26
                 $fromCountriesArray = array();
27 27
             }
28
-            $allCountries =  EcommerceCountry::get();
28
+            $allCountries = EcommerceCountry::get();
29 29
             $toCountries = array();
30 30
             foreach ($allCountries as $country) {
31 31
                 $country = CountryPrice_EcommerceCountry::get_real_country($country);
32
-                $toCountries[$country->Code] = $country->Name . ($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
32
+                $toCountries[$country->Code] = $country->Name.($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
33 33
             }
34 34
             $countryCurrencies = CountryPrice_EcommerceCurrency::get_currency_per_country();
35 35
             $link = CountryPrice_CopyPrices_Controller::get_link($this->owner);
Please login to merge, or discard this patch.
model/process/extensions/CountryPrice_OrderStatusLog_AND_OrderAtribute.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     }
9 9
     public function canView($member = null)
10 10
     {
11
-        if (! $this->owner->ID) {
11
+        if (!$this->owner->ID) {
12 12
             return true;
13 13
         } elseif ($member && $member->DistributorID) {
14 14
             if ($order = $this->owner->Order()) {
Please login to merge, or discard this patch.
code/control/cms/CountryPrice_TestController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function init()
17 17
     {
18 18
         parent::init();
19
-        if (! Permission::check('ADMIN')) {
19
+        if (!Permission::check('ADMIN')) {
20 20
             return Security::permissionFailure($this, 'This page is secured and you need administrator rights to access it. You can also save the page in the CMS to get 15 minutes access without being logged in.');
21 21
         }
22 22
     }
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
             "MyCountryCode" => "This is the key function",
182 182
             "MyCountryTitle" => "",
183 183
             "MyCurrency" => "Based on the currency set in the order.",
184
-            "MyDistributor" => "You have to set the ". _t('Distributor.SINGULAR_NAME', 'Distributor') . "'s countries in order to work out someone's ". _t('Distributor.SINGULAR_NAME', 'Distributor') . ".",
184
+            "MyDistributor" => "You have to set the "._t('Distributor.SINGULAR_NAME', 'Distributor')."'s countries in order to work out someone's "._t('Distributor.SINGULAR_NAME', 'Distributor').".",
185 185
             "MyDistributorCountry" => "This is the country that is being used for the sale.  For dodgy countries, we use the backup country.",
186
-            "MyDeliveryCostNote" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
187
-            "MyShippingDeliveryInfo" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
188
-            "MyShippingReturnInfo" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
189
-            "MyProductNotAvailableNote" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . ", default country, AND the Ecommerce Config.",
186
+            "MyDeliveryCostNote" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
187
+            "MyShippingDeliveryInfo" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
188
+            "MyShippingReturnInfo" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
189
+            "MyProductNotAvailableNote" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor').", default country, AND the Ecommerce Config.",
190 190
             "MyStockistSearchPage" => "",
191 191
             "MyStockistCountryPage" => "The stockist page that is related to the visitor's country",
192 192
             "MyCountryFAQPage" => "",
193 193
             "MyBackupCountryCode" => "This country is used if the information for the selected country is not available.",
194
-            "MyDefaultDistributor" => "You can set one default ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " (head office) with a tickbox for any ". _t('Distributor.SINGULAR_NAME', 'Distributor') ,
194
+            "MyDefaultDistributor" => "You can set one default "._t('Distributor.SINGULAR_NAME', 'Distributor')." (head office) with a tickbox for any "._t('Distributor.SINGULAR_NAME', 'Distributor'),
195 195
 
196 196
         );
197 197
         $array = array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             "MyDefaultDistributor" => "Object",
212 212
         );
213 213
         echo "<h1>Current Settings</h1>";
214
-        echo "<p>Most of these settings can be adjusted in the country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and generic e-commerce settings.</p>";
214
+        echo "<p>Most of these settings can be adjusted in the country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and generic e-commerce settings.</p>";
215 215
         foreach ($array as $name => $type) {
216 216
             $style = "created";
217 217
             $notSet = false;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     }
246 246
                 }
247 247
             }
248
-            if (! $string) {
248
+            if (!$string) {
249 249
                 $string = "NOT SET";
250 250
                 $style = "deleted";
251 251
             }
Please login to merge, or discard this patch.
code/control/cms/CountryPrice_DistributorManagementTool.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         return $this->redirect(CountryPrices_ChangeCountryController::new_country_link($distributorPrimaryCountryCode));
70 70
                     }
71 71
                 } else {
72
-                    die("ERROR: No primary country has been set for this ".  _t('Distributor.SINGULAR_NAME', 'Distributor') .".");
72
+                    die("ERROR: No primary country has been set for this "._t('Distributor.SINGULAR_NAME', 'Distributor').".");
73 73
                 }
74 74
             }
75 75
             if ($countries && $countries->count()) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
         if (!$canViewAndEdit) {
80
-            Security::permissionFailure($this, 'Please log in first or log in as a '. _t('Distributor.SINGULAR_NAME', 'Distributor'). '.');
80
+            Security::permissionFailure($this, 'Please log in first or log in as a '._t('Distributor.SINGULAR_NAME', 'Distributor').'.');
81 81
         }
82 82
     }
83 83
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $fields['Price'] = 'Price';
107 107
 
108 108
         foreach ($fields as $field) {
109
-            if (! isset($_REQUEST[$field])) {
109
+            if (!isset($_REQUEST[$field])) {
110 110
                 return "$field value missing";
111 111
             }
112 112
         }
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
                 $valid = true;
122 122
             }
123 123
         }
124
-        if (! $valid) {
124
+        if (!$valid) {
125 125
             return 'ObjectClass value incorrect';
126 126
         }
127 127
 
128 128
         $objectID = intval($_REQUEST['ObjectID']);
129 129
         $object = $objectClass::get()->byID($objectID);
130
-        if (! $object) {
130
+        if (!$object) {
131 131
             return 'ObjectID value incorrect';
132 132
         }
133 133
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
             $valid = true;
144 144
             if ($this->distributor) {
145 145
                 $countries = $this->distributor->Countries()->map('Code', 'Code')->toArray();
146
-                if (! in_array($countryCode, $countries)) {
146
+                if (!in_array($countryCode, $countries)) {
147 147
                     $valid = false;
148 148
                 }
149 149
             }
150 150
         }
151
-        if (! $valid) {
151
+        if (!$valid) {
152 152
             return 'Country value incorrect';
153 153
         }
154 154
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         $price = $_REQUEST['Price'];
161
-        if (! is_numeric($price)) {
161
+        if (!is_numeric($price)) {
162 162
             return 'Price value incorrect';
163 163
         }
164 164
 
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function setobjectfield()
181 181
     {
182
-        if (isset($_REQUEST["F"]) && $_REQUEST["F"]== "TESTONLY") {
182
+        if (isset($_REQUEST["F"]) && $_REQUEST["F"] == "TESTONLY") {
183 183
             return "THIS IS FOR TESTING ONLY";
184 184
         }
185 185
         // 1) Check that all parameters have been specified
186 186
 
187 187
         foreach (array('T', 'I', 'F', 'V') as $field) {
188
-            if (! isset($_REQUEST[$field])) {
188
+            if (!isset($_REQUEST[$field])) {
189 189
                 return "$field value missing";
190 190
             }
191 191
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $result = 1; // Updated
196 196
 
197 197
         $objectClass = $_REQUEST['T'];
198
-        if (! class_exists($objectClass)) {
198
+        if (!class_exists($objectClass)) {
199 199
             return 'ObjectClass value incorrect';
200 200
         }
201 201
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         } elseif (intval($objectID)) {
208 208
             $objectID = intval($objectID);
209 209
             $object = $objectClass::get()->byID($objectID);
210
-            if (! $object) {
210
+            if (!$object) {
211 211
                 return 'ObjectID (ID: $objectID, Class Name: $objectClass) value incorrect';
212 212
             }
213 213
         } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $fieldName = Convert::raw2sql($_REQUEST['F']);
222 222
         $value = $_REQUEST['V'];
223 223
 
224
-        if ($fieldName == 'Price' && (! is_numeric($value) || $value < 0)) {
224
+        if ($fieldName == 'Price' && (!is_numeric($value) || $value < 0)) {
225 225
             return 'Price value incorrect';
226 226
         }
227 227
         if ($value == '0') {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 }
334 334
                 if (Permission::check("ADMIN")) {
335 335
                     $html .= $this->createEditNode(
336
-                        "Default " . _t('Distributor.SINGULAR_NAME', 'Distributor'),
336
+                        "Default "._t('Distributor.SINGULAR_NAME', 'Distributor'),
337 337
                         $distributor->IsDefault ? "YES" : "NO"
338 338
                     );
339 339
                 }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                 $countryList = array();
343 343
                 $countries = $distributor->Countries();
344 344
                 foreach ($countries as $country) {
345
-                    $countryList[] = $country->Name . ($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
345
+                    $countryList[] = $country->Name.($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
346 346
                 }
347 347
                 $html .= $this->createEditNode(
348 348
                     'Countries',
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
                 $data = array('T' => 'EcommerceCountry', 'I' => $country->ID);
425 425
                 $distributorName = $country->Distributor()->Name;
426 426
                 if (!$distributorName) {
427
-                    $distributorName = "<p class=\"message bad\">No ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." has been assigned to this country.</p>";
427
+                    $distributorName = "<p class=\"message bad\">No "._t('Distributor.SINGULAR_NAME', 'Distributor')." has been assigned to this country.</p>";
428 428
                 }
429 429
                 $html .= $this->createTreeNode($country->Code." - ".$country->Name, $country->Code, array($country));
430 430
                 $distributorTitlePlural = _t('Distributor.PLURAL_NAME', 'Distributor');
431 431
                 $distributorTitleSingluar = _t('Distributor.SINGULAR_NAME', 'Distributor');
432 432
                 $html .= $this->createEditNode($distributorTitleSingluar, $distributorName);
433 433
                 $html .= $this->createEditNode("FAQ Content", "", $country->FAQContent, $data + array("F" => "FAQContent"), "textarea");
434
-                $html .= $this->createEditNode("Top Bar Message", "",  $country->TopBarMessage, $data + array("F" => "TopBarMessage"), "");
434
+                $html .= $this->createEditNode("Top Bar Message", "", $country->TopBarMessage, $data + array("F" => "TopBarMessage"), "");
435 435
                 $html .= $this->createEditNode("Country Specific Messages", $countrySpecificMessages);
436 436
                 $html .= $this->createEditNode("Delivery Options", $deliveryOptions);
437 437
                 $html .= $this->createEditNode("Taxes", $taxes);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
                 $html .= $this->closeTreeNode();
442 442
             }
443 443
         }
444
-        $countries =  EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 0));
444
+        $countries = EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 0));
445 445
         if ($countries && $countries->count()) {
446 446
             $list = implode(", ", $countries->map("ID", "Code")->toArray());
447
-            $html .= $this->createEditNode("Countries without a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." that allow sales", $list);
447
+            $html .= $this->createEditNode("Countries without a "._t('Distributor.SINGULAR_NAME', 'Distributor')." that allow sales", $list);
448 448
         }
449
-        $countries =  EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 1));
449
+        $countries = EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 1));
450 450
         if ($countries && $countries->count()) {
451 451
             $list = implode(", ", $countries->map("ID", "Code")->toArray());
452
-            $html .= $this->createEditNode("Countries without a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." that do not allow sales", $list);
452
+            $html .= $this->createEditNode("Countries without a "._t('Distributor.SINGULAR_NAME', 'Distributor')." that do not allow sales", $list);
453 453
         }
454 454
         return $html;
455 455
     }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
         $defaultPriceText = ' (N.B. This is default for new variations ONLY - set actual prices under variations)';
471 471
         if ($products && $products->count()) {
472 472
             foreach ($products as $product) {
473
-                $withDefaultPrices = Permission::check('ADMIN') || (! $product->hasVariations());
473
+                $withDefaultPrices = Permission::check('ADMIN') || (!$product->hasVariations());
474 474
                 $html .= $this->createTreeNode($product->FullName, "pricing", array($product));
475 475
 
476 476
                 //country exceptions
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     //only show default price for ShopAdmin
493 493
                     if ($withDefaultPrices) {
494 494
                         $html .= $this->createEditNode(
495
-                            'Default Price' . ($product->hasVariations() ? $defaultPriceText : ''),
495
+                            'Default Price'.($product->hasVariations() ? $defaultPriceText : ''),
496 496
                             EcommercePayment::site_currency(),
497 497
                             $product->Price,
498 498
                             array(
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 $outstandingCountries = $this->countryArray;
509 509
                 if ($withDefaultPrices) {
510 510
                     $html .= $this->createTreeNode(
511
-                        'Country Prices' . ($product->hasVariations() ? $defaultPriceText : ''),
511
+                        'Country Prices'.($product->hasVariations() ? $defaultPriceText : ''),
512 512
                         " pricing countryPrices"
513 513
                     );
514 514
                 }
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                             $countryName = EcommerceCountry::find_title($countryPricesObject->Country);
533 533
                             if ($withDefaultPrices) {
534 534
                                 $html .= $this->createEditNode(
535
-                                    $countryPricesObject->Country . ' - '. $countryName,
535
+                                    $countryPricesObject->Country.' - '.$countryName,
536 536
                                     $countryPricesObject->Currency,
537 537
                                     $countryPricesObject->Price,
538 538
                                     $data,
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                         $countryName = EcommerceCountry::find_title($countryCode);
567 567
                         if ($withDefaultPrices) {
568 568
                             $html .= $this->createEditNode(
569
-                                $countryCode . ' - '. $countryName,
569
+                                $countryCode.' - '.$countryName,
570 570
                                 $currencyObject->Code,
571 571
                                 $addText,
572 572
                                 $data,
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
                                                 "F" => "Price"
620 620
                                             );
621 621
                                             $countryName = EcommerceCountry::find_title($countryPricesObject->Country);
622
-                                            $html .=  $this->createEditNode(
623
-                                                $countryPricesObject->Country . ' - '. $countryName,
622
+                                            $html .= $this->createEditNode(
623
+                                                $countryPricesObject->Country.' - '.$countryName,
624 624
                                                 $countryPricesObject->Currency,
625 625
                                                 $countryPricesObject->Price,
626 626
                                                 $data,
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                                         );
667 667
                                         $countryName = EcommerceCountry::find_title($countryCode);
668 668
                                         $html .= $this->createEditNode(
669
-                                            $countryCode . ' - '. $countryName,
669
+                                            $countryCode.' - '.$countryName,
670 670
                                             $currency->Code,
671 671
                                             $addText,
672 672
                                             $data,
Please login to merge, or discard this patch.
code/model/CountryPrice.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function Buyable()
67 67
     {
68
-        if(! $this->_myBuyable) {
68
+        if (!$this->_myBuyable) {
69 69
             $className = $this->ObjectClass;
70
-            if ( class_exists($this->ObjectClass) ) {
70
+            if (class_exists($this->ObjectClass)) {
71 71
                 $this->_myBuyable = $className::get()->byID($this->ObjectID);
72 72
             }
73 73
         }
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function CountryObject()
89 89
     {
90
-        if(! $this->_myCountryObject) {
90
+        if (!$this->_myCountryObject) {
91 91
             if ($this->Country) {
92
-                $this->_myCountryObject =  EcommerceCountry::get()
92
+                $this->_myCountryObject = EcommerceCountry::get()
93 93
                     ->filter(array("Code" => $this->Country))
94 94
                     ->First();
95 95
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getFullPrice()
148 148
     {
149
-        return "$this->Price $this->Currency" . ($this->isObsolete() ? ' (obsolete!)' : '');
149
+        return "$this->Price $this->Currency".($this->isObsolete() ? ' (obsolete!)' : '');
150 150
     }
151 151
 
152 152
     public function getCMSFields()
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     public function canEdit($member = null)
219 219
     {
220 220
         $canEdit = parent::canEdit();
221
-        if (! $canEdit) {
221
+        if (!$canEdit) {
222 222
             $member = Member::currentUser();
223 223
             $distributor = $member->Distributor();
224 224
             if ($distributor->exists()) {
@@ -236,16 +236,16 @@  discard block
 block discarded – undo
236 236
     protected function validate()
237 237
     {
238 238
         $result = parent::validate();
239
-        if (! $this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
239
+        if (!$this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
240 240
             if (class_exists($_REQUEST["MyObjectClass"])) {
241 241
                 $this->ObjectClass = Convert::raw2sql($_REQUEST["MyObjectClass"]);
242 242
             }
243 243
         }
244
-        if (! $this->ObjectID && isset($_REQUEST["MyObjectID"])) {
244
+        if (!$this->ObjectID && isset($_REQUEST["MyObjectID"])) {
245 245
             $this->ObjectID = intval($_REQUEST["MyObjectID"]);
246 246
         }
247 247
         //check for duplicates in case it has not been created yet...
248
-        if (! $this->ObjectClass || ! $this->ObjectID) {
248
+        if (!$this->ObjectClass || !$this->ObjectID) {
249 249
             $result->error('Object could not be created. Please contact your developer.');
250 250
             return $result;
251 251
         }
Please login to merge, or discard this patch.
code/api/CountryURLProvider.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@
 block discarded – undo
10 10
 
11 11
 class CountryURLProvider extends Object implements CountryURLProviderInterface
12 12
 {
13
-    private static $country_segments  = array('nz', 'au', 'gb', 'eu', 'jp', 'us', 'zz');
13
+    private static $country_segments = array('nz', 'au', 'gb', 'eu', 'jp', 'us', 'zz');
14 14
 
15
-    public function hasCountrySegment($url = ''){
15
+    public function hasCountrySegment($url = '') {
16 16
         $url = $this->getDefaultURL($url);
17 17
         $parsedUrl = parse_url($url);
18 18
         $pathSegments = explode("/", $parsedUrl['path']);
19 19
         $firstSegment = '';
20
-        $countries =  Config::inst()->get('CountryURLProvider', 'country_segments');
21
-        foreach ($pathSegments as $position => $segment){
22
-            if($segment){
20
+        $countries = Config::inst()->get('CountryURLProvider', 'country_segments');
21
+        foreach ($pathSegments as $position => $segment) {
22
+            if ($segment) {
23 23
                 $firstSegment = $segment;
24 24
                 break;
25 25
             }
26 26
         }
27
-        if(in_array($firstSegment, $countries)){
27
+        if (in_array($firstSegment, $countries)) {
28 28
             return true;
29 29
         }
30 30
         return false;
31 31
     }
32 32
 
33
-    public function replaceCountryCodeInUrl($countryCode, $url = ''){
33
+    public function replaceCountryCodeInUrl($countryCode, $url = '') {
34 34
         $url = $this->getDefaultURL($url);
35 35
         $parsedUrl = parse_url($url);
36 36
         $pathParts = explode('/', $parsedUrl['path']);
37
-        $countries =  Config::inst()->get('CountryURLProvider', 'country_segments');
38
-        foreach($pathParts as $pathPartsKey => $pathPart) {
37
+        $countries = Config::inst()->get('CountryURLProvider', 'country_segments');
38
+        foreach ($pathParts as $pathPartsKey => $pathPart) {
39 39
             //check for first match
40
-            if(in_array($pathPart, $countries)) {
40
+            if (in_array($pathPart, $countries)) {
41 41
                 $pathParts[$pathPartsKey] = strtolower($countryCode);
42 42
                 break;
43 43
             }
44 44
         }
45 45
         $parsedUrl['path'] = implode('/', $pathParts);
46
-        $url = $parsedUrl['scheme']. '://'. $parsedUrl['host']. $parsedUrl['path'];
47
-        if(isset($parsedUrl['query'])){
48
-            $url = $url . $parsedUrl['query'];
46
+        $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$parsedUrl['path'];
47
+        if (isset($parsedUrl['query'])) {
48
+            $url = $url.$parsedUrl['query'];
49 49
         }
50 50
         return $url;
51 51
     }
52 52
 
53
-    public function addCountryCodeToUrl($countryCode, $url = ''){
53
+    public function addCountryCodeToUrl($countryCode, $url = '') {
54 54
         $url = $this->getDefaultURL($url);
55 55
         $parsedUrl = parse_url($url);
56
-        $url = $parsedUrl['scheme']. '://'. $parsedUrl['host']. '/'. strtolower($countryCode) . $parsedUrl['path'];
57
-        if(isset($parsedUrl['query'])){
58
-            $url = $url . $parsedUrl['query'];
56
+        $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].'/'.strtolower($countryCode).$parsedUrl['path'];
57
+        if (isset($parsedUrl['query'])) {
58
+            $url = $url.$parsedUrl['query'];
59 59
         }
60 60
         return $url;
61 61
     }
62 62
 
63 63
     private function getDefaultURL($url = '')
64 64
     {
65
-        if($url) {
65
+        if ($url) {
66 66
             return Director::absoluteURL($url);
67 67
         }
68
-        return (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
68
+        return (isset($_SERVER['HTTPS']) ? "https" : "http")."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
69 69
     }
70 70
 
71 71
 }
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_Translation.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
         $countryDropdownField = DropdownField::create(
100 100
             'EcommerceCountryID',
101 101
             $fields->dataFieldByName('EcommerceCountryID')->Title(),
102
-            array('' => '-- make sure to select a country --')+$countries
102
+            array('' => '-- make sure to select a country --') + $countries
103 103
         );
104 104
 
105 105
         // //$fields->removeFieldFromTab("Root.Main", 'ParentID');
106
-        if($this->WithoutTranslation) {
106
+        if ($this->WithoutTranslation) {
107 107
             return FieldList::create(
108 108
                 array(
109 109
                     $countryDropdownField,
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
             );
124 124
         }
125 125
         $dbFields = $this->inheritedDatabaseFields();
126
-        foreach($dbFields as $dbField => $fieldType) {
126
+        foreach ($dbFields as $dbField => $fieldType) {
127 127
             $useField = 'UseOriginal'.$dbField;
128
-            if(!empty($this->$useField)) {
128
+            if (!empty($this->$useField)) {
129 129
                 $fields->replaceField(
130 130
                     $dbField,
131 131
                     $fields->dataFieldByName($dbField)->performReadonlyTransformation()
132 132
                 );
133 133
             }
134
-            if($fields->dataFieldByName($useField)){
135
-                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ') . $dbField);
134
+            if ($fields->dataFieldByName($useField)) {
135
+                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ').$dbField);
136 136
             }
137 137
         }
138
-        if($this->exists() && $this->ParentID) {
138
+        if ($this->exists() && $this->ParentID) {
139 139
             $fields->addFieldToTab(
140 140
                 'Root.ParentPage',
141 141
                 CMSEditLinkField::create(
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
             )
211 211
         );
212 212
         $this->extend('updateFieldsToReplace', $al);
213
-        foreach($al as $fieldToReplace) {
214
-            $ignoreField = 'UseOriginal' . $fieldToReplace->PageField;
215
-            if(!empty($this->owner->$ignoreField)) {
213
+        foreach ($al as $fieldToReplace) {
214
+            $ignoreField = 'UseOriginal'.$fieldToReplace->PageField;
215
+            if (!empty($this->owner->$ignoreField)) {
216 216
                 $al->remove($fieldToReplace);
217 217
             }
218 218
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $link = $this->Parent()->Link();
236 236
         if ($this->EcommerceCountryID) {
237 237
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($link);
238
-            if($hasCountrySegment){
238
+            if ($hasCountrySegment) {
239 239
                 $link = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($this->EcommerceCountry()->Code, $link);
240 240
             }
241 241
             else {
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
         parent::requireDefaultRecords();
251 251
         //get rid of rogue entries:
252 252
         DB::query('DELETE FROM CountryPrice_Translation WHERE EcommerceCountryID = 0 OR ParentID = 0');
253
-        if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
253
+        if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
254 254
             $prices = CountryPrice::get();
255 255
             $ecommerceCountries = array();
256
-            foreach($prices as $price) {
257
-                if($countryObject = $price->CountryObject()) {
258
-                    if($buyable = $price->Buyable()) {
259
-                        if($buyable instanceof Product) {
260
-                            if($buyable->ID && $countryObject->ID) {
256
+            foreach ($prices as $price) {
257
+                if ($countryObject = $price->CountryObject()) {
258
+                    if ($buyable = $price->Buyable()) {
259
+                        if ($buyable instanceof Product) {
260
+                            if ($buyable->ID && $countryObject->ID) {
261 261
                                 $filter = array(
262 262
                                     'EcommerceCountryID' => $countryObject->ID,
263 263
                                     'ParentID' => $buyable->ID
264 264
                                 );
265 265
                                 $ecommerceCountries[$countryObject->ID] = $countryObject;
266
-                                if(! CountryPrice_Translation::get()->filter($filter)->first()) {
266
+                                if (!CountryPrice_Translation::get()->filter($filter)->first()) {
267 267
                                     DB::alteration_message(
268 268
                                         'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code,
269 269
                                         'created'
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
                     }
278 278
                 }
279 279
             }
280
-            if(count($ecommerceCountries)) {
281
-                foreach(ProductGroup::get() as $productGroup) {
282
-                    foreach($ecommerceCountries as $countryID => $countryObject) {
280
+            if (count($ecommerceCountries)) {
281
+                foreach (ProductGroup::get() as $productGroup) {
282
+                    foreach ($ecommerceCountries as $countryID => $countryObject) {
283 283
                         $filter = array(
284 284
                             'EcommerceCountryID' => $countryObject->ID,
285 285
                             'ParentID' => $productGroup->ID
286 286
                         );
287
-                        if(! CountryPrice_Translation::get()->filter($filter)->first()) {
287
+                        if (!CountryPrice_Translation::get()->filter($filter)->first()) {
288 288
                             DB::alteration_message(
289 289
                                 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code,
290 290
                                 'created'
Please login to merge, or discard this patch.