Showing
2 changed files
with
22 additions
and
10 deletions
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | - $english = mysql_escape_string($_REQUEST['translate']); | 3 | +// $english = mysql_escape_string($_REQUEST['translate']); |
4 | // Der Service ist zur Zeit leider deaktiviert.... | 4 | // Der Service ist zur Zeit leider deaktiviert.... |
5 | // $trans = new SoapClient( | 5 | // $trans = new SoapClient( |
6 | // "http://www.xmethods.net/sd/2001/BabelFishService.wsdl"); | 6 | // "http://www.xmethods.net/sd/2001/BabelFishService.wsdl"); |
@@ -18,6 +18,22 @@ | @@ -18,6 +18,22 @@ | ||
18 | $french = "not found"; | 18 | $french = "not found"; |
19 | } | 19 | } |
20 | */ | 20 | */ |
21 | + class dummy | ||
22 | + { | ||
23 | + // nur public member werden via json verschickt. | ||
24 | + public $german; | ||
25 | + public $english; | ||
26 | + public $french; | ||
27 | + | ||
28 | + function __construct ($english, $german, $french) | ||
29 | + { | ||
30 | + $this->german = $german; | ||
31 | + $this->english = $english; | ||
32 | + $this->french["val1"] = $french; | ||
33 | + $this->french["val2"] = "jokus"; | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
21 | $encoding = FALSE; | 37 | $encoding = FALSE; |
22 | if (isset ($_SERVER['HTTP_ACCEPT_ENCODING']) && | 38 | if (isset ($_SERVER['HTTP_ACCEPT_ENCODING']) && |
23 | strpos ($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== FALSE) | 39 | strpos ($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== FALSE) |
@@ -30,10 +46,8 @@ | @@ -30,10 +46,8 @@ | ||
30 | 46 | ||
31 | $result = FALSE; | 47 | $result = FALSE; |
32 | if ($encoding !== FALSE) | 48 | if ($encoding !== FALSE) |
33 | - $result = gzcompress (json_encode (array( | ||
34 | - "english" => 'doing gzip', | ||
35 | - "german" => 'gezipedte Daten', | ||
36 | - "french" => 'la zippo'))); | 49 | + $result = gzcompress (json_encode (new dummy ( |
50 | + 'doing gzip', 'gezipedte Daten', 'la zippo'))); | ||
37 | 51 | ||
38 | if ($result !== FALSE) | 52 | if ($result !== FALSE) |
39 | { | 53 | { |
@@ -44,10 +58,8 @@ | @@ -44,10 +58,8 @@ | ||
44 | } | 58 | } |
45 | else | 59 | else |
46 | { | 60 | { |
47 | - $result = json_encode (array( | ||
48 | - "english" => 'doing no gzip', | ||
49 | - "german" => 'nicht gezipedte Daten', | ||
50 | - "french" => 'no la zippo')); | 61 | + $result = json_encode (new dummy ( |
62 | + 'doing no gzip', 'nicht gezipedte Daten', 'no la zippo')); | ||
51 | 63 | ||
52 | print ($result); | 64 | print ($result); |
53 | } | 65 | } |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | 25 | ||
26 | // schreiben des ergebnisses | 26 | // schreiben des ergebnisses |
27 | german_field.value = translation.german; | 27 | german_field.value = translation.german; |
28 | - french_field.value = translation.french; | 28 | + french_field.value = translation.french.val1; |
29 | } | 29 | } |
30 | break; | 30 | break; |
31 | 31 |
Please
register
or
login
to post a comment