CI_Xmlrpc Class Reference

Inheritance diagram for CI_Xmlrpc:

List of all members.


Public Member Functions

 CI_Xmlrpc ($config=array())
 initialize ($config=array())
 server ($url, $port=80)
 timeout ($seconds=5)
 method ($function)
 request ($incoming)
 set_debug ($flag=TRUE)
 values_parsing ($value, $return=FALSE)
 send_request ()
 display_error ()
 display_response ()
 send_error_message ($number, $message)
 send_response ($response)

Public Attributes

 $debug = FALSE
 $xmlrpcI4 = 'i4'
 $xmlrpcInt = 'int'
 $xmlrpcBoolean = 'boolean'
 $xmlrpcDouble = 'double'
 $xmlrpcString = 'string'
 $xmlrpcDateTime = 'datetime.iso8601'
 $xmlrpcBase64 = 'base64'
 $xmlrpcArray = 'array'
 $xmlrpcStruct = 'struct'
 $xmlrpcTypes = array()
 $valid_parents = array()
 $xmlrpcerr = array()
 $xmlrpcstr = array()
 $xmlrpc_defencoding = 'UTF-8'
 $xmlrpcName = 'XML-RPC for CodeIgniter'
 $xmlrpcVersion = '1.1'
 $xmlrpcerruser = 800
 $xmlrpcerrxml = 100
 $xmlrpc_backslash = ''
 $client
 $method
 $data
 $message = ''
 $error = ''
 $result
 $response = array()

Detailed Description

Definition at line 33 of file Xmlrpc.php.


Member Function Documentation

CI_Xmlrpc::CI_Xmlrpc ( config = array()  ) 

Definition at line 71 of file Xmlrpc.php.

References $config, initialize(), and log_message().

Referenced by CI_Xmlrpcs::CI_Xmlrpcs(), XML_RPC_Client::XML_RPC_Client(), XML_RPC_Message::XML_RPC_Message(), and XML_RPC_Values::XML_RPC_Values().

00072         {
00073                 $this->xmlrpcName               = $this->xmlrpcName;
00074                 $this->xmlrpc_backslash = chr(92).chr(92);
00075                 
00076                 // Types for info sent back and forth
00077                 $this->xmlrpcTypes = array(
00078                         $this->xmlrpcI4    => '1',
00079                         $this->xmlrpcInt          => '1',
00080                         $this->xmlrpcBoolean  => '1',
00081                         $this->xmlrpcString   => '1',
00082                         $this->xmlrpcDouble   => '1',
00083                         $this->xmlrpcDateTime => '1',
00084                         $this->xmlrpcBase64   => '1',
00085                         $this->xmlrpcArray      => '2',
00086                         $this->xmlrpcStruct   => '3'
00087                         );
00088                         
00089                 // Array of Valid Parents for Various XML-RPC elements
00090                 $this->valid_parents = array('BOOLEAN'                  => array('VALUE'),
00091                                                                          'I4'                           => array('VALUE'),
00092                                                                          'INT'                          => array('VALUE'),
00093                                                                          'STRING'                       => array('VALUE'),
00094                                                                          'DOUBLE'                       => array('VALUE'),
00095                                                                          'DATETIME.ISO8601'     => array('VALUE'),
00096                                                                          'BASE64'                       => array('VALUE'),
00097                                                                          'ARRAY'                        => array('VALUE'),
00098                                                                          'STRUCT'                       => array('VALUE'),
00099                                                                          'PARAM'                        => array('PARAMS'),
00100                                                                          'METHODNAME'           => array('METHODCALL'),
00101                                                                          'PARAMS'                       => array('METHODCALL', 'METHODRESPONSE'),
00102                                                                          'MEMBER'                       => array('STRUCT'),
00103                                                                          'NAME'                         => array('MEMBER'),
00104                                                                          'DATA'                         => array('ARRAY'),
00105                                                                          'FAULT'                        => array('METHODRESPONSE'),
00106                                                                          'VALUE'                        => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
00107                                                                          );
00108                         
00109                         
00110                 // XML-RPC Responses
00111                 $this->xmlrpcerr['unknown_method'] = '1';
00112                 $this->xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server';
00113                 $this->xmlrpcerr['invalid_return'] = '2';
00114                 $this->xmlrpcstr['invalid_return'] = 'The XML data receieved was either invalid or not in the correct form for XML-RPC.  Turn on debugging to examine the XML data further.';
00115                 $this->xmlrpcerr['incorrect_params'] = '3';
00116                 $this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method';
00117                 $this->xmlrpcerr['introspect_unknown'] = '4';
00118                 $this->xmlrpcstr['introspect_unknown'] = "Cannot inspect signature for request: method unknown";
00119                 $this->xmlrpcerr['http_error'] = '5';
00120                 $this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server.";
00121                 $this->xmlrpcerr['no_data'] = '6';
00122                 $this->xmlrpcstr['no_data'] ='No data received from server.';
00123                 
00124                 $this->initialize($config);
00125                 
00126                 log_message('debug', "XML-RPC Class Initialized");
00127         }

Here is the call graph for this function:

Here is the caller graph for this function:

CI_Xmlrpc::display_error (  ) 

Definition at line 299 of file Xmlrpc.php.

00300         {
00301                 return $this->error;
00302         }

CI_Xmlrpc::display_response (  ) 

Definition at line 309 of file Xmlrpc.php.

00310         {
00311                 return $this->response;
00312         }

CI_Xmlrpc::initialize ( config = array()  ) 

Reimplemented in CI_Xmlrpcs.

Definition at line 134 of file Xmlrpc.php.

References $config.

Referenced by CI_Xmlrpc().

00135         {
00136                 if (sizeof($config) > 0)
00137                 {
00138                         foreach ($config as $key => $val)
00139                         {
00140                                 if (isset($this->$key))
00141                                 {
00142                                         $this->$key = $val;                     
00143                                 }
00144                         }
00145                 }
00146         }

Here is the caller graph for this function:

CI_Xmlrpc::method ( function  ) 

Definition at line 190 of file Xmlrpc.php.

Referenced by send_request().

00191         {
00192                 $this->method = $function;
00193         }

Here is the caller graph for this function:

CI_Xmlrpc::request ( incoming  ) 

Definition at line 200 of file Xmlrpc.php.

References values_parsing().

00201         {
00202                 if ( ! is_array($incoming))
00203                 {
00204                         // Send Error
00205                 }
00206                 
00207                 $this->data = array();
00208                 
00209                 foreach($incoming as $key => $value)
00210                 {
00211                         $this->data[$key] = $this->values_parsing($value);
00212                 }
00213         }

Here is the call graph for this function:

CI_Xmlrpc::send_error_message ( number,
message 
)

Definition at line 319 of file Xmlrpc.php.

References $message.

00320         {
00321                 return new XML_RPC_Response('0',$number, $message);
00322         }

CI_Xmlrpc::send_request (  ) 

Definition at line 273 of file Xmlrpc.php.

References method().

00274         {
00275                 $this->message = new XML_RPC_Message($this->method,$this->data);
00276                 $this->message->debug = $this->debug;
00277         
00278                 if ( ! $this->result = $this->client->send($this->message))
00279                 {
00280                         $this->error = $this->result->errstr;
00281                         return FALSE;
00282                 }
00283                 elseif( ! is_object($this->result->val))
00284                 {
00285                         $this->error = $this->result->errstr;
00286                         return FALSE;
00287                 }
00288                 
00289                 $this->response = $this->result->decode();
00290                 
00291                 return TRUE;
00292         }

Here is the call graph for this function:

CI_Xmlrpc::send_response ( response  ) 

Definition at line 330 of file Xmlrpc.php.

References $response, and values_parsing().

00331         {
00332                 // $response should be array of values, which will be parsed
00333                 // based on their data and type into a valid group of XML-RPC values
00334                 
00335                 $response = $this->values_parsing($response);
00336         
00337                 return new XML_RPC_Response($response);
00338         }

Here is the call graph for this function:

CI_Xmlrpc::server ( url,
port = 80 
)

Definition at line 153 of file Xmlrpc.php.

Referenced by XML_RPC_Client::sendPayload(), and XML_RPC_Client::XML_RPC_Client().

00154         {
00155                 if (substr($url, 0, 4) != "http")
00156                 {
00157                         $url = "http://".$url;
00158                 }
00159                 
00160                 $parts = parse_url($url);
00161                 
00162                 $path = ( ! isset($parts['path'])) ? '/' : $parts['path'];
00163                 
00164                 if (isset($parts['query']) && $parts['query'] != '')
00165                 {
00166                         $path .= '?'.$parts['query'];
00167                 }       
00168                 
00169                 $this->client = new XML_RPC_Client($path, $parts['host'], $port);
00170         }

Here is the caller graph for this function:

CI_Xmlrpc::set_debug ( flag = TRUE  ) 

Definition at line 221 of file Xmlrpc.php.

00222         {
00223                 $this->debug = ($flag == TRUE) ? TRUE : FALSE;
00224         }

CI_Xmlrpc::timeout ( seconds = 5  ) 

Definition at line 177 of file Xmlrpc.php.

Referenced by XML_RPC_Client::sendPayload().

00178         {
00179                 if ( ! is_null($this->client) && is_int($seconds))
00180                 {
00181                         $this->client->timeout = $seconds;
00182                 }
00183         }

Here is the caller graph for this function:

CI_Xmlrpc::values_parsing ( value,
return = FALSE 
)

Definition at line 230 of file Xmlrpc.php.

Referenced by request(), and send_response().

00231         {
00232                 if (is_array($value) && isset($value['0']))
00233                 {
00234                         if ( ! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])]))
00235                         {
00236                                 if (is_array($value[0]))
00237                                 {
00238                                         $temp = new XML_RPC_Values($value['0'], 'array');
00239                                 }
00240                                 else
00241                                 {
00242                                         $temp = new XML_RPC_Values($value['0'], 'string');
00243                                 }
00244                         }
00245                         elseif(is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array'))
00246                         {
00247                                 while (list($k) = each($value['0']))
00248                                 {
00249                                         $value['0'][$k] = $this->values_parsing($value['0'][$k], TRUE);
00250                                 }
00251                                 
00252                                 $temp = new XML_RPC_Values($value['0'], $value['1']);
00253                         }
00254                         else
00255                         {
00256                                 $temp = new XML_RPC_Values($value['0'], $value['1']);
00257                         }
00258                 }
00259                 else
00260                 {
00261                         $temp = new XML_RPC_Values($value, 'string');
00262                 }
00263 
00264                 return $temp;
00265         }

Here is the caller graph for this function:


Member Data Documentation

CI_Xmlrpc::$client

Definition at line 58 of file Xmlrpc.php.

CI_Xmlrpc::$data

CI_Xmlrpc::$debug = FALSE

Definition at line 35 of file Xmlrpc.php.

CI_Xmlrpc::$error = ''

Definition at line 62 of file Xmlrpc.php.

CI_Xmlrpc::$message = ''

Definition at line 61 of file Xmlrpc.php.

Referenced by send_error_message().

CI_Xmlrpc::$method

Definition at line 59 of file Xmlrpc.php.

Referenced by XML_RPC_Message::XML_RPC_Message().

CI_Xmlrpc::$response = array()

Definition at line 64 of file Xmlrpc.php.

Referenced by send_response().

CI_Xmlrpc::$result

Definition at line 63 of file Xmlrpc.php.

Referenced by CI_Xmlrpcs::do_multicall(), and CI_Xmlrpcs::multicall().

CI_Xmlrpc::$valid_parents = array()

Definition at line 47 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpc_backslash = ''

Definition at line 56 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpc_defencoding = 'UTF-8'

Definition at line 51 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcArray = 'array'

Definition at line 43 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcBase64 = 'base64'

Definition at line 42 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcBoolean = 'boolean'

Definition at line 38 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcDateTime = 'datetime.iso8601'

Definition at line 41 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcDouble = 'double'

Definition at line 39 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcerr = array()

Definition at line 48 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcerruser = 800

Definition at line 54 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcerrxml = 100

Definition at line 55 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcI4 = 'i4'

Definition at line 36 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcInt = 'int'

Definition at line 37 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcName = 'XML-RPC for CodeIgniter'

Definition at line 52 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcstr = array()

Definition at line 49 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcString = 'string'

Definition at line 40 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcStruct = 'struct'

Definition at line 44 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcTypes = array()

Definition at line 46 of file Xmlrpc.php.

CI_Xmlrpc::$xmlrpcVersion = '1.1'

Definition at line 53 of file Xmlrpc.php.


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