Completed
Push — master ( 9862b6...800bb7 )
by Aitor Riba
02:26
created
src/Translation.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -138,55 +138,55 @@
 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>";
177
-                 } else {
178
-                     $this->translation = "<font style='color:orange;'>Unknoun words: ".substr($errors, 0, -2)."</font>";
175
+                if ($this->debug === true) {
176
+                        $this->translation = "<font style='color:#00CC00;'>".$this->translation."</font>";
177
+                    } else {
178
+                        $this->translation = "<font style='color:orange;'>Unknoun words: ".substr($errors, 0, -2)."</font>";
179 179
             }
180 180
 
181
-             fclose($socket);
182
-             return;
181
+                fclose($socket);
182
+                return;
183 183
 
184
-         } else {
184
+            } else {
185 185
 
186
-             //host offline
187
-             $this->hostDown();
188
-         }
189
-     }
186
+                //host offline
187
+                $this->hostDown();
188
+            }
189
+        }
190 190
 
191 191
     /**
192 192
      * Get translation from apertium API.
Please login to merge, or discard this patch.