@@ -5,41 +5,41 @@ |
||
5 | 5 | class MymemoryTrans extends Translation |
6 | 6 | { |
7 | 7 | /** |
8 | - * Get translation from mymemory API. |
|
9 | - */ |
|
10 | - public function main() |
|
11 | - { |
|
12 | - $host = 'api.mymemory.translated.net'; |
|
13 | - |
|
14 | - // Check if host is online. |
|
15 | - if ($this->checkHost($host)) { |
|
16 | - |
|
17 | - // Host online |
|
18 | - $urlString = urlencode($this->string); |
|
19 | - $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
20 | - $json = file_get_contents($url); |
|
21 | - $data = json_decode($json); |
|
22 | - |
|
23 | - // Checking response status |
|
24 | - if ($data->responseStatus != 200) { |
|
25 | - if ($this->debug == true) { |
|
26 | - $details = $data->responseDetails; |
|
27 | - if ($data->responseStatus == 403) { |
|
28 | - $details = ($data->responseDetails); |
|
29 | - } |
|
30 | - $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
31 | - } |
|
32 | - |
|
33 | - return; |
|
34 | - } |
|
35 | - |
|
36 | - $transObtained = $data->responseData->translatedText; |
|
37 | - |
|
38 | - $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
39 | - |
|
40 | - $this->checkSave(); |
|
41 | - |
|
42 | - return; |
|
43 | - } |
|
44 | - } |
|
8 | + * Get translation from mymemory API. |
|
9 | + */ |
|
10 | + public function main() |
|
11 | + { |
|
12 | + $host = 'api.mymemory.translated.net'; |
|
13 | + |
|
14 | + // Check if host is online. |
|
15 | + if ($this->checkHost($host)) { |
|
16 | + |
|
17 | + // Host online |
|
18 | + $urlString = urlencode($this->string); |
|
19 | + $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
20 | + $json = file_get_contents($url); |
|
21 | + $data = json_decode($json); |
|
22 | + |
|
23 | + // Checking response status |
|
24 | + if ($data->responseStatus != 200) { |
|
25 | + if ($this->debug == true) { |
|
26 | + $details = $data->responseDetails; |
|
27 | + if ($data->responseStatus == 403) { |
|
28 | + $details = ($data->responseDetails); |
|
29 | + } |
|
30 | + $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
31 | + } |
|
32 | + |
|
33 | + return; |
|
34 | + } |
|
35 | + |
|
36 | + $transObtained = $data->responseData->translatedText; |
|
37 | + |
|
38 | + $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
39 | + |
|
40 | + $this->checkSave(); |
|
41 | + |
|
42 | + return; |
|
43 | + } |
|
44 | + } |
|
45 | 45 | } |