Completed
Push — 2 ( 3c1312...4bdd9a )
by Jason
09:11
created
code/model/FoxyCart.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@  discard block
 block discarded – undo
9 9
 
10 10
 	private static $keyPrefix = 'dYnm1c';
11 11
 
12
-	public static function setStoreKey($length = 54, $count = 0){
12
+	public static function setStoreKey($length = 54, $count = 0) {
13 13
 		$charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.strtotime('now');
14 14
 		$strLength = strlen($charset);
15 15
 		$str = '';
16
-		while($count < $length){
17
-			$str .= $charset[mt_rand(0, $strLength-1)];
16
+		while ($count < $length) {
17
+			$str .= $charset[mt_rand(0, $strLength - 1)];
18 18
 			$count++;
19 19
 		}
20
-		return self::getKeyPrefix().substr(base64_encode($str),0,$length);
20
+		return self::getKeyPrefix().substr(base64_encode($str), 0, $length);
21 21
 	}
22 22
 
23
-	public static function getStoreKey(){
23
+	public static function getStoreKey() {
24 24
 		$config = SiteConfig::current_site_config();
25
-		if($config->StoreKey){
25
+		if ($config->StoreKey) {
26 26
 			return $config->StoreKey;
27 27
 		}
28 28
 		return null;
29 29
 	}
30 30
 
31
-	public static function store_name_warning(){
31
+	public static function store_name_warning() {
32 32
 		$warning = null;
33
-		if(self::getFoxyCartStoreName()===null){
33
+		if (self::getFoxyCartStoreName() === null) {
34 34
 			$warning = 'Must define FoxyCart Store Name or Store Remote Domain in your site settings in the cms';
35 35
 		}
36 36
 		return $warning;
37 37
 	}
38 38
 
39
-	public static function getFoxyCartStoreName(){
39
+	public static function getFoxyCartStoreName() {
40 40
 		$config = SiteConfig::current_site_config();
41 41
 		if ($config->CustomSSL) {
42 42
 		    if ($config->RemoteDomain) {
43 43
 		        return $config->RemoteDomain;
44 44
             }
45
-        } else {
46
-            if ($config->StoreName){
45
+        }else {
46
+            if ($config->StoreName) {
47 47
                 return $config->StoreName;
48 48
             }
49 49
         }
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         $config = SiteConfig::current_site_config();
56 56
 
57 57
         if ($config->CustomSSL) {
58
-            return sprintf('https://%s/cart', self::getFoxyCartStoreName() );
59
-        } else {
58
+            return sprintf('https://%s/cart', self::getFoxyCartStoreName());
59
+        }else {
60 60
             return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName());
61 61
         }
62 62
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $foxyData["api_token"] = FoxyCart::getStoreKey();
73 73
 
74 74
         $ch = curl_init();
75
-        curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api");
75
+        curl_setopt($ch, CURLOPT_URL, "https://".$foxy_domain."/api");
76 76
         curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData);
77 77
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
78 78
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         // The following if block will print any CURL errors you might have
85 85
         if ($response == false) {
86 86
             //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR);
87
-            SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR);
87
+            SS_Log::log("Could not connect to FoxyCart API: ".$response, SS_Log::ERR);
88 88
         }
89 89
         curl_close($ch);
90 90
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public static function putCustomer($Member = null) {
111 111
         // throw error if no $Member Object
112
-        if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR);
112
+        if (!isset($Member)); //trigger_error('No Member set', E_USER_ERROR);
113 113
 
114 114
         // send updated customer record from API
115 115
         $foxyData = array();
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         return self::getAPIRequest($foxyData);
126 126
     }
127 127
 
128
-	public static function getKeyPrefix(){
128
+	public static function getKeyPrefix() {
129 129
 		return self::$keyPrefix;
130 130
 	}
131 131
 
Please login to merge, or discard this patch.