42 function add(&$tagobj)
44 $this->_tags[] =& $tagobj;
57 $count = count($this->_tags);
59 for (
$i = 0;
$i < $count;
$i++) {
60 if (!$this->_tags[
$i]->isFault()) {
63 return '<?xml version="1.0"?><methodResponse>'.$this->_tags[
$i]->render().
'</methodResponse>';
66 return '<?xml version="1.0"?><methodResponse><params><param>'.$payload.
'</param></params></methodResponse>';
82 $count = count($this->_tags);
84 for (
$i = 0;
$i < $count;
$i++) {
85 $payload .=
'<param>'.$this->_tags[
$i]->render().
'</param>';
87 return '<?xml version="1.0"?><methodCall><methodName>'.$this->methodName.
'</methodName><params>'.
$payload.
'</params></methodCall>';
103 $text = preg_replace(array(
"/\&([a-z\d\#]+)\;/i",
"/\&/",
"/\#\|\|([a-z\d\#]+)\|\|\#/i"), array(
"#||\\1||#",
"&",
"&\\1;"), str_replace(array(
"<",
">"), array(
"<",
">"), $text));
108 $this->_fault = (intval($fault) > 0) ?
true :
false;
130 $this->_code = intval($code);
131 $this->_extra = isset($extra) ? trim($extra) :
'';
136 switch ($this->_code) {
138 $string =
'Invalid server URI';
141 $string =
'Parser parse error';
144 $string =
'Module not found';
147 $string =
'User authentication failed';
150 $string =
'Module API not found';
153 $string =
'Method response error';
156 $string =
'Method not supported';
159 $string =
'Invalid parameter';
162 $string =
'Missing parameters';
165 $string =
'Selected blog application does not exist';
168 $string =
'Method permission denied';
171 $string =
'Method response error';
174 $string .=
"\n".$this->_extra;
175 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>';
186 $this->_value = intval($value);
191 return '<value><int>'.$this->_value.
'</int></value>';
202 $this->_value = (float)$value;
207 return '<value><double>'.$this->_value.
'</double></value>';
218 $this->_value = (!empty($value) && $value !=
false) ? 1 : 0;
223 return '<value><boolean>'.$this->_value.
'</boolean></value>';
234 $this->_value = strval($value);
239 return '<value><string>'.$this->encode($this->_value).
'</string></value>';
250 if (!is_numeric($value)) {
251 $this->_value = strtotime($value);
253 $this->_value = intval($value);
259 return '<value><dateTime.iso8601>'.gmstrftime(
"%Y%m%dT%H:%M:%S", $this->_value).
'</dateTime.iso8601></value>';
270 $this->_value = base64_encode($value);
275 return '<value><base64>'.$this->_value.
'</base64></value>';
290 $this->_tags[] =& $tagobj;
295 $count = count($this->_tags);
296 $ret =
'<value><array><data>';
297 for (
$i = 0;
$i < $count;
$i++) {
298 $ret .= $this->_tags[
$i]->render();
300 $ret .=
'</data></array></value>';
312 function add($name, &$tagobj){
313 $this->_tags[] = array(
'name' => $name,
'value' => $tagobj);
317 $count = count($this->_tags);
318 $ret =
'<value><struct>';
319 for (
$i = 0;
$i < $count;
$i++) {
320 $ret .=
'<member><name>'.$this->encode($this->_tags[
$i][
'name']).
'</name>'.$this->_tags[
$i][
'value']->render().
'</member>';
322 $ret .=
'</struct></value>';