XML_RPC_Response Class Reference

List of all members.


Public Member Functions

 XML_RPC_Response ($val, $code=0, $fstr= '')
 faultCode ()
 faultString ()
 value ()
 prepare_response ()
 decode ($array=FALSE)
 xmlrpc_decoder ($xmlrpc_val)
 iso8601_decode ($time, $utc=0)

Public Attributes

 $val = 0
 $errno = 0
 $errstr = ''
 $headers = array()

Detailed Description

Definition at line 430 of file Xmlrpc.php.


Member Function Documentation

XML_RPC_Response::decode ( array = FALSE  ) 

Definition at line 502 of file Xmlrpc.php.

References $CI, get_instance(), and xmlrpc_decoder().

00503         {
00504                 $CI =& get_instance();
00505 
00506                 if ($array !== FALSE && is_array($array))
00507                 {
00508                         while (list($key) = each($array))
00509                         {
00510                                 if (is_array($array[$key]))
00511                                 {
00512                                         $array[$key] = $this->decode($array[$key]);
00513                                 }
00514                                 else
00515                                 {
00516                                         $array[$key] = $CI->input->xss_clean($array[$key]);
00517                                 }
00518                         }
00519                         
00520                         $result = $array;
00521                 }
00522                 else
00523                 {
00524                         $result = $this->xmlrpc_decoder($this->val);
00525                         
00526                         if (is_array($result))
00527                         {
00528                                 $result = $this->decode($result);
00529                         }
00530                         else
00531                         {
00532                                 $result = $CI->input->xss_clean($result);
00533                         }
00534                 }
00535                 
00536                 return $result;
00537         }

Here is the call graph for this function:

XML_RPC_Response::faultCode (  ) 

Definition at line 457 of file Xmlrpc.php.

00458         {
00459                 return $this->errno;
00460         }

XML_RPC_Response::faultString (  ) 

Definition at line 462 of file Xmlrpc.php.

00463         {
00464                 return $this->errstr;
00465         }

XML_RPC_Response::iso8601_decode ( time,
utc = 0 
)

Definition at line 585 of file Xmlrpc.php.

00586         {
00587                 // return a timet in the localtime, or UTC
00588                 $t = 0;
00589                 if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $time, $regs))
00590                 {
00591                         if ($utc == 1)
00592                                 $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
00593                         else
00594                                 $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
00595                 }
00596                 return $t;
00597         }

XML_RPC_Response::prepare_response (  ) 

Definition at line 472 of file Xmlrpc.php.

00473         {
00474                 $result = "<methodResponse>\n";
00475                 if ($this->errno)
00476                 {
00477                         $result .= '<fault>
00478         <value>
00479                 <struct>
00480                         <member>
00481                                 <name>faultCode</name>
00482                                 <value><int>' . $this->errno . '</int></value>
00483                         </member>
00484                         <member>
00485                                 <name>faultString</name>
00486                                 <value><string>' . $this->errstr . '</string></value>
00487                         </member>
00488                 </struct>
00489         </value>
00490 </fault>';
00491                 }
00492                 else
00493                 {
00494                         $result .= "<params>\n<param>\n" .
00495                                         $this->val->serialize_class() .
00496                                         "</param>\n</params>";
00497                 }
00498                 $result .= "\n</methodResponse>";
00499                 return $result;
00500         }

XML_RPC_Response::value (  ) 

Definition at line 467 of file Xmlrpc.php.

00468         {
00469                 return $this->val;
00470         }

XML_RPC_Response::XML_RPC_Response ( val,
code = 0,
fstr = '' 
)

Definition at line 437 of file Xmlrpc.php.

References $val.

00438         {       
00439                 if ($code != 0)
00440                 {
00441                         // error
00442                         $this->errno = $code;
00443                         $this->errstr = htmlentities($fstr);
00444                 }
00445                 else if ( ! is_object($val))
00446                 {
00447                         // programmer error, not an object
00448                         error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response.  Defaulting to empty value.");
00449                         $this->val = new XML_RPC_Values();
00450                 }
00451                 else
00452                 {
00453                         $this->val = $val;
00454                 }
00455         }

XML_RPC_Response::xmlrpc_decoder ( xmlrpc_val  ) 

Definition at line 545 of file Xmlrpc.php.

Referenced by decode().

00546         {
00547                 $kind = $xmlrpc_val->kindOf();
00548 
00549                 if($kind == 'scalar')
00550                 {
00551                         return $xmlrpc_val->scalarval();
00552                 }
00553                 elseif($kind == 'array')
00554                 {
00555                         reset($xmlrpc_val->me);
00556                         list($a,$b) = each($xmlrpc_val->me);
00557                         $size = sizeof($b);
00558                         
00559                         $arr = array();
00560 
00561                         for($i = 0; $i < $size; $i++)
00562                         {
00563                                 $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]);
00564                         }
00565                         return $arr;
00566                 }
00567                 elseif($kind == 'struct')
00568                 {
00569                         reset($xmlrpc_val->me['struct']);
00570                         $arr = array();
00571 
00572                         while(list($key,$value) = each($xmlrpc_val->me['struct']))
00573                         {
00574                                 $arr[$key] = $this->xmlrpc_decoder($value);
00575                         }
00576                         return $arr;
00577                 }
00578         }

Here is the caller graph for this function:


Member Data Documentation

XML_RPC_Response::$errno = 0

Definition at line 433 of file Xmlrpc.php.

XML_RPC_Response::$errstr = ''

Definition at line 434 of file Xmlrpc.php.

XML_RPC_Response::$headers = array()

Definition at line 435 of file Xmlrpc.php.

XML_RPC_Response::$val = 0

Definition at line 432 of file Xmlrpc.php.

Referenced by XML_RPC_Response().


The documentation for this class was generated from the following file: