Completed
Push — master ( 800bb7...792d8b )
by Aitor Riba
02:06
created
src/Translation.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -138,53 +138,53 @@
 block discarded – undo
138 138
     /**
139 139
      * Get translation from mymemory API.
140 140
      */
141
-     private function mymemoryTrans()
142
-     {
143
-         // Check if it can be translated from online sources.
144
-
145
-         $host = 'api.mymemory.translated.net';
146
-         if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
147
-
148
-             // Host online
149
-             $urlString = urlencode($this->string);
150
-             $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to";
151
-             $json = file_get_contents($url);
152
-             $data = json_decode($json);
153
-
154
-             // Checking response status
155
-
156
-             if ($data->responseStatus != 200) {
157
-                 if ($this->debug == true) {
158
-                     $details = $data->responseDetails;
159
-                     if ($data->responseStatus == 403) {
160
-                         $details =($data->responseDetails);
161
-                     }
162
-                     $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.": ".$details."</font>";
163
-                 }
141
+        private function mymemoryTrans()
142
+        {
143
+            // Check if it can be translated from online sources.
144
+
145
+            $host = 'api.mymemory.translated.net';
146
+            if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
147
+
148
+                // Host online
149
+                $urlString = urlencode($this->string);
150
+                $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to";
151
+                $json = file_get_contents($url);
152
+                $data = json_decode($json);
153
+
154
+                // Checking response status
155
+
156
+                if ($data->responseStatus != 200) {
157
+                    if ($this->debug == true) {
158
+                        $details = $data->responseDetails;
159
+                        if ($data->responseStatus == 403) {
160
+                            $details =($data->responseDetails);
161
+                        }
162
+                        $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.": ".$details."</font>";
163
+                    }
164 164
 
165
-                 return;
166
-             }
165
+                    return;
166
+                }
167 167
 
168
-             $transObtained = $data->responseData->translatedText;
168
+                $transObtained = $data->responseData->translatedText;
169 169
 
170
-             $this->translation = ucfirst(strtolower(trim($transObtained)));
170
+                $this->translation = ucfirst(strtolower(trim($transObtained)));
171 171
 
172 172
 
173
-             // Checking debug setting to determinate how to output translation
173
+                // Checking debug setting to determinate how to output translation
174 174
 
175
-             if ($this->debug === true) {
176
-                     $this->translation = "<font style='color:#00CC00;'>".$this->translation."</font>";
175
+                if ($this->debug === true) {
176
+                        $this->translation = "<font style='color:#00CC00;'>".$this->translation."</font>";
177 177
             }
178 178
 
179
-             fclose($socket);
180
-             return;
179
+                fclose($socket);
180
+                return;
181 181
 
182
-         } else {
182
+            } else {
183 183
 
184
-             //host offline
185
-             $this->hostDown();
186
-         }
187
-     }
184
+                //host offline
185
+                $this->hostDown();
186
+            }
187
+        }
188 188
 
189 189
     /**
190 190
      * Get translation from apertium API.
Please login to merge, or discard this patch.