Passed
Push — master ( 4ebc9d...305f3a )
by Nicolaas
02:38
created
code/control/CountryPrice_Page_Controller_Extension.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
         //provided by stealth ...
29 29
         $param = Config::inst()->get('CountryPrice_Translation', 'locale_get_parameter');
30 30
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
31
-        if($countryObject && $countryObject->Code) {
31
+        if ($countryObject && $countryObject->Code) {
32 32
             $oldCountryCode = strtoupper($countryObject->Code);
33 33
         } else {
34 34
             $oldCountryCode = 'XX';
35 35
         }
36 36
         if (isset($_GET[$param])) {
37 37
             $urlCountryCode = preg_replace("/[^A-Z]+/", "", strtoupper(Convert::raw2sql($_GET[$param])));
38
-            if($countryCode) {
38
+            if ($countryCode) {
39 39
                 if ($oldCountryCode !== $urlCountryCode) {
40 40
                     $countryObject = DataObject::get_one('EcommerceCountry', ['Code' => $urlCountryCode]);
41
-                    if($countryObject) {
41
+                    if ($countryObject) {
42 42
                         //change country Object
43 43
                         //reset everything ...
44 44
                         CountryPrices_ChangeCountryController::set_new_country($urlCountryCode);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 }
49 49
             }
50 50
         }
51
-        if($countryObject) {
51
+        if ($countryObject) {
52 52
 
53 53
             //check if a redirect is required ...
54 54
             $this->checkForOffsiteRedirects($countryObject);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $oldURL = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
115 115
 
116 116
         $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($oldURL);
117
-        if($hasCountrySegment){
117
+        if ($hasCountrySegment) {
118 118
             $newURL = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($countryCode, $oldURL);
119 119
         }
120 120
         else {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function AlternativeHrefLangLinksCachingKey()
170 170
     {
171 171
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
172
-        if($countryObject && $countryObject->Code) {
172
+        if ($countryObject && $countryObject->Code) {
173 173
             return 'AlternativeHrefLangLinksCachingKey-'.$countryObject->Code.'-'.$this->owner->dataRecord->ID.'-'.strtotime($this->owner->dataRecord->LastEdited);
174 174
         }
175 175
         return 'AlternativeHrefLangLinksCachingKey'.$this->owner->dataRecord->ID.'-'.$this->owner->dataRecord->ID.'-'.strtotime($this->owner->dataRecord->LastEdited);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     public function UpdateCanonicalLink(&$link)
183 183
     {
184 184
         $obj = $this->owner->dataRecord->CanonicalObject();
185
-        if($obj) {
185
+        if ($obj) {
186 186
             $link = $obj->Link();
187 187
         } else {
188 188
             $link = $this->owner->dataRecord->AbsoluteLink();
Please login to merge, or discard this patch.
code/control/CountryPrice_ChangeCountryController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
         //redirect now
86 86
         $param = Config::inst()->get('CountryPrice_Translation', 'locale_get_parameter');
87
-        if(isset($_GET['force']) && $_GET['force']) {
87
+        if (isset($_GET['force']) && $_GET['force']) {
88 88
 
89
-            return $this->redirect(self::$url_segment . '/changeto/' .$newCountryCode . '/'. '?force-back-home');
89
+            return $this->redirect(self::$url_segment.'/changeto/'.$newCountryCode.'/'.'?force-back-home');
90 90
         }
91
-        if(isset($_GET['force-back-home']) || $_GET['force-back-home']) {
91
+        if (isset($_GET['force-back-home']) || $_GET['force-back-home']) {
92 92
 
93 93
             return $this->redirect('/');
94 94
         }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 
150 150
             $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
151 151
 
152
-            $query = !empty($query) ? '?'. http_build_query($query) : '';
152
+            $query = !empty($query) ? '?'.http_build_query($query) : '';
153 153
 
154 154
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($url);
155
-            if($hasCountrySegment){
155
+            if ($hasCountrySegment) {
156 156
                 $url = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($newCountryCode, $url);
157 157
             }
158 158
             else {
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_SiteTreeExtensions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
     public function CanonicalObject()
49 49
     {
50 50
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
51
-        if($countryObject && $countryObject->Code) {
51
+        if ($countryObject && $countryObject->Code) {
52 52
             $object = $this->owner->CountryPriceTranslations()
53 53
                 ->innerJoin('EcommerceCountry', '"EcommerceCountry"."ID" = "CountryPrice_Translation"."EcommerceCountryID"')
54 54
                 ->filter(array('EcommerceCountry.Code' => $countryObject->Code))
55 55
                 ->first();
56
-            if($object && $object->exists()) {
56
+            if ($object && $object->exists()) {
57 57
                 return $object;
58 58
             }
59 59
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function loadTranslatedValues($countryID = 0, $variableOrMethod = '')
64 64
     {
65 65
         $translation = null;
66
-        if (! $countryID) {
66
+        if (!$countryID) {
67 67
             $countryObject = CountryPrice_EcommerceCountry::get_real_country();
68 68
             if ($countryObject) {
69 69
                 $countryID = $countryObject->ID;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
             $fieldsToReplace = $translation->FieldsToReplace();
83 83
             foreach ($fieldsToReplace as $replaceFields) {
84 84
                 $pageField = $replaceFields->PageField;
85
-                $pageFieldTranslated = $pageField . 'Translated';
85
+                $pageFieldTranslated = $pageField.'Translated';
86 86
                 $translationField = $replaceFields->TranslationField;
87
-                if (! $variableOrMethod || $variableOrMethod === $pageField) {
87
+                if (!$variableOrMethod || $variableOrMethod === $pageField) {
88 88
                     if ($translation->hasMethod($translationField)) {
89 89
                         $this->owner->$pageField = $translation->$translationField();
90 90
                         $this->owner->$pageFieldTranslated = $translation->$translationField();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function getEcommerceTranslation($countryID)
149 149
     {
150
-        if(!isset($this->_translations_all_cache[$countryID])) {
150
+        if (!isset($this->_translations_all_cache[$countryID])) {
151 151
             $this->_translations_all_cache[$countryID] = $this->owner
152 152
                 ->CountryPriceTranslations()
153 153
                 ->filter(
Please login to merge, or discard this patch.