

Public Member Functions | |
| XML_RPC_Values ($val=-1, $type='') | |
| addScalar ($val, $type='string') | |
| addArray ($vals) | |
| addStruct ($vals) | |
| kindOf () | |
| serializedata ($typ, $val) | |
| serialize_class () | |
| serializeval ($o) | |
| scalarval () | |
| iso8601_encode ($time, $utc=0) | |
Public Attributes | |
| $me = array() | |
| $mytype = 0 | |
Definition at line 1207 of file Xmlrpc.php.
| XML_RPC_Values::addArray | ( | $ | vals | ) |
Definition at line 1279 of file Xmlrpc.php.
References kindOf().
Referenced by XML_RPC_Values().
01280 { 01281 if ($this->mytype != 0) 01282 { 01283 echo '<strong>XML_RPC_Values</strong>: already initialized as a [' . $this->kindOf() . ']<br />'; 01284 return 0; 01285 } 01286 01287 $this->mytype = $this->xmlrpcTypes['array']; 01288 $this->me['array'] = $vals; 01289 return 1; 01290 }


| XML_RPC_Values::addScalar | ( | $ | val, | |
| $ | type = 'string' | |||
| ) |
Definition at line 1235 of file Xmlrpc.php.
References XML_RPC_Values().
Referenced by XML_RPC_Values().
01236 { 01237 $typeof = $this->xmlrpcTypes[$type]; 01238 01239 if ($this->mytype==1) 01240 { 01241 echo '<strong>XML_RPC_Values</strong>: scalar can have only one value<br />'; 01242 return 0; 01243 } 01244 01245 if ($typeof != 1) 01246 { 01247 echo '<strong>XML_RPC_Values</strong>: not a scalar type (${typeof})<br />'; 01248 return 0; 01249 } 01250 01251 if ($type == $this->xmlrpcBoolean) 01252 { 01253 if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false'))) 01254 { 01255 $val = 1; 01256 } 01257 else 01258 { 01259 $val=0; 01260 } 01261 } 01262 01263 if ($this->mytype == 2) 01264 { 01265 // adding to an array here 01266 $ar = $this->me['array']; 01267 $ar[] = new XML_RPC_Values($val, $type); 01268 $this->me['array'] = $ar; 01269 } 01270 else 01271 { 01272 // a scalar, so set the value and remember we're scalar 01273 $this->me[$type] = $val; 01274 $this->mytype = $typeof; 01275 } 01276 return 1; 01277 }


| XML_RPC_Values::addStruct | ( | $ | vals | ) |
Definition at line 1292 of file Xmlrpc.php.
References kindOf().
Referenced by XML_RPC_Values().
01293 { 01294 if ($this->mytype != 0) 01295 { 01296 echo '<strong>XML_RPC_Values</strong>: already initialized as a [' . $this->kindOf() . ']<br />'; 01297 return 0; 01298 } 01299 $this->mytype = $this->xmlrpcTypes['struct']; 01300 $this->me['struct'] = $vals; 01301 return 1; 01302 }


| XML_RPC_Values::iso8601_encode | ( | $ | time, | |
| $ | utc = 0 | |||
| ) |
Definition at line 1401 of file Xmlrpc.php.
01402 { 01403 if ($utc == 1) 01404 { 01405 $t = strftime("%Y%m%dT%H:%M:%S", $time); 01406 } 01407 else 01408 { 01409 if (function_exists('gmstrftime')) 01410 $t = gmstrftime("%Y%m%dT%H:%M:%S", $time); 01411 else 01412 $t = strftime("%Y%m%dT%H:%M:%S", $time - date('Z')); 01413 } 01414 return $t; 01415 }
| XML_RPC_Values::kindOf | ( | ) |
Definition at line 1304 of file Xmlrpc.php.
Referenced by addArray(), and addStruct().
01305 { 01306 switch($this->mytype) 01307 { 01308 case 3: 01309 return 'struct'; 01310 break; 01311 case 2: 01312 return 'array'; 01313 break; 01314 case 1: 01315 return 'scalar'; 01316 break; 01317 default: 01318 return 'undef'; 01319 } 01320 }

| XML_RPC_Values::scalarval | ( | ) |
| XML_RPC_Values::serialize_class | ( | ) |
Definition at line 1372 of file Xmlrpc.php.
References serializeval().
01373 { 01374 return $this->serializeval($this); 01375 }

| XML_RPC_Values::serializedata | ( | $ | typ, | |
| $ | val | |||
| ) |
Definition at line 1322 of file Xmlrpc.php.
References serializeval().
01323 { 01324 $rs = ''; 01325 01326 switch($this->xmlrpcTypes[$typ]) 01327 { 01328 case 3: 01329 // struct 01330 $rs .= "<struct>\n"; 01331 reset($val); 01332 while(list($key2, $val2) = each($val)) 01333 { 01334 $rs .= "<member>\n<name>{$key2}</name>\n"; 01335 $rs .= $this->serializeval($val2); 01336 $rs .= "</member>\n"; 01337 } 01338 $rs .= '</struct>'; 01339 break; 01340 case 2: 01341 // array 01342 $rs .= "<array>\n<data>\n"; 01343 for($i=0; $i < sizeof($val); $i++) 01344 { 01345 $rs .= $this->serializeval($val[$i]); 01346 } 01347 $rs.="</data>\n</array>\n"; 01348 break; 01349 case 1: 01350 // others 01351 switch ($typ) 01352 { 01353 case $this->xmlrpcBase64: 01354 $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>\n"; 01355 break; 01356 case $this->xmlrpcBoolean: 01357 $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>\n"; 01358 break; 01359 case $this->xmlrpcString: 01360 $rs .= "<{$typ}>" . htmlspecialchars($val). "</{$typ}>\n"; 01361 break; 01362 default: 01363 $rs .= "<{$typ}>{$val}</{$typ}>\n"; 01364 break; 01365 } 01366 default: 01367 break; 01368 } 01369 return $rs; 01370 }

| XML_RPC_Values::serializeval | ( | $ | o | ) |
Definition at line 1377 of file Xmlrpc.php.
Referenced by serialize_class(), and serializedata().
01378 { 01379 $ar = $o->me; 01380 reset($ar); 01381 01382 list($typ, $val) = each($ar); 01383 $rs = "<value>\n".$this->serializedata($typ, $val)."</value>\n"; 01384 return $rs; 01385 }

| XML_RPC_Values::XML_RPC_Values | ( | $ | val = -1, |
|
| $ | type = '' | |||
| ) |
Definition at line 1212 of file Xmlrpc.php.
References addArray(), addScalar(), addStruct(), and CI_Xmlrpc::CI_Xmlrpc().
Referenced by addScalar().
01213 { 01214 parent::CI_Xmlrpc(); 01215 01216 if ($val != -1 OR $type != '') 01217 { 01218 $type = $type == '' ? 'string' : $type; 01219 01220 if ($this->xmlrpcTypes[$type] == 1) 01221 { 01222 $this->addScalar($val,$type); 01223 } 01224 elseif ($this->xmlrpcTypes[$type] == 2) 01225 { 01226 $this->addArray($val); 01227 } 01228 elseif ($this->xmlrpcTypes[$type] == 3) 01229 { 01230 $this->addStruct($val); 01231 } 01232 } 01233 }


| XML_RPC_Values::$me = array() |
Definition at line 1209 of file Xmlrpc.php.
| XML_RPC_Values::$mytype = 0 |
Definition at line 1210 of file Xmlrpc.php.