35 $this->_tags[] = $tagobj;
38 abstract function render();
50 foreach ($this->_tags as $tag) {
52 if (!$tag->isFault()) {
53 $payload .= $tag->render();
55 return '<?xml version="1.0"?><methodResponse>' . $tag->render() .
'</methodResponse>';
58 return '<?xml version="1.0"?><methodResponse><params><param>' . $payload .
'</param></params></methodResponse>';
81 foreach ($this->_tags as $tag) {
83 $payload .=
'<param>' . $tag->render() .
'</param>';
85 return '<?xml version="1.0"?><methodCall><methodName>' . $this->methodName .
'</methodName><params>' . $payload .
'</params></methodCall>';
102 $text = preg_replace(array(
"/\&([a-z\d\#]+)\;/i",
"/\&/",
"/\#\|\|([a-z\d\#]+)\|\|\#/i"),
103 array(
"#||\\1||#",
"&",
"&\\1;"), str_replace(array(
"<",
">"), array(
"<",
">"),
$text));
113 $this->_fault = (bool)$fault;
128 abstract function render();
150 $this->_code = intval(
$code);
151 $this->_extra = isset($extra) ? trim($extra) :
'';
159 switch ($this->_code) {
161 $string =
'Invalid server URI';
164 $string =
'Parser parse error';
167 $string =
'Module not found';
170 $string =
'User authentication failed';
173 $string =
'Module API not found';
176 $string =
'Method response error';
179 $string =
'Method not supported';
182 $string =
'Invalid parameter';
185 $string =
'Missing parameters';
188 $string =
'Selected blog application does not exist';
191 $string =
'Method permission denied';
194 $string =
'Method response error';
198 return '<fault><value><struct><member><name>faultCode</name><value>' . $this->_code .
'</value></member><member><name>faultString</name><value>' . $this->
encode($string) .
'</value></member></struct></value></fault>';
214 $this->_value = intval($value);
222 return '<value><int>' . $this->_value .
'</int></value>';
238 $this->_value = (float)$value;
246 return '<value><double>' . $this->_value .
'</double></value>';
262 $this->_value = (!empty($value) && $value !=
false) ? 1 : 0;
270 return '<value><boolean>' . $this->_value .
'</boolean></value>';
286 $this->_value = strval($value);
294 return '<value><string>' . $this->
encode($this->_value) .
'</string></value>';
310 if (!is_numeric($value)) {
311 $this->_value = strtotime($value);
313 $this->_value = intval($value);
322 return '<value><dateTime.iso8601>' . gmstrftime(
"%Y%m%dT%H:%M:%S", $this->_value) .
'</dateTime.iso8601></value>';
338 $this->_value = base64_encode($value);
346 return '<value><base64>' . $this->_value .
'</base64></value>';
363 $this->_tags[] = $tagobj;
371 $ret =
'<value><array><data>';
372 foreach ($this->_tags as $tag) {
374 $ret .= $tag->render();
376 $ret .=
'</data></array></value>';
395 $this->_tags[] = array(
'name' =>
$name,
'value' => $tagobj);
400 $ret =
'<value><struct>';
401 foreach ($this->_tags as $tag) {
403 $ret .=
'<member><name>' . $this->
encode($tag[
'name']) .
'</name>' . $tag[
'value']->render() .
'</member>';
405 $ret .=
'</struct></value>';
add($name, XoopsXmlRpcTag &$tagobj)
add(XoopsXmlRpcTag &$tagobj)
add(XoopsXmlRpcTag &$tagobj)
__construct($code, $extra=null)