XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
SoapClient.class.php
1<?php
9 // TODO prevent path disclosure, gigamaster
10 error_reporting(0);
11
12if (!XC_CLASS_EXISTS('XCube_AbstractServiceClient')) {
13 exit();
14}
15
17{
18 public $mClient = null;
19
20 public function __construct(&$service)
21 {
22 parent::__construct($service);
23 $this->mClient =new soap_client($service, true);
24 $this->mClient->decodeUTF8(false);
25 }
26
27 public function call($operation, $args)
28 {
29 $root =& XCube_Root::getSingleton();
30
31 $args = $this->_encodeUTF8($args, $root->mLanguageManager);
32
33 $retValue = $this->mClient->call($operation, $args);
34
35 if (is_array($retValue)) {
36 $retValue = $this->_decodeUTF8($retValue, $root->mLanguageManager);
37 } else {
38 $retValue = $root->mLanguageManager->decodeUTF8($retValue);
39 }
40
41 return $retValue;
42 }
43
44 public function _encodeUTF8($arr, &$languageManager)
45 {
46 foreach (array_keys($arr) as $key) {
47 if (is_array($arr[$key])) {
48 $arr[$key] = $this->_encodeUTF8($arr[$key], $languageManager);
49 } else {
50 $arr[$key] = $languageManager->encodeUTF8($arr[$key]);
51 }
52 }
53
54 return $arr;
55 }
56
57 public function _decodeUTF8($arr, &$languageManager)
58 {
59 foreach (array_keys($arr) as $key) {
60 if (is_array($arr[$key])) {
61 $arr[$key] = $this->_decodeUTF8($arr[$key], $languageManager);
62 } else {
63 $arr[$key] = $languageManager->decodeUTF8($arr[$key]);
64 }
65 }
66
67 return $arr;
68 }
69}
[Experiment Class] The adapter for a service class.