Formatting

This commit is contained in:
Miles Lott 2001-08-13 22:03:26 +00:00
parent 3e8e749624
commit bf10b87e07

View File

@ -3,7 +3,7 @@
// <edd@usefulinc.com> // <edd@usefulinc.com>
// xmlrpc.inc,v 1.18 2001/07/06 18:23:57 edmundd // xmlrpc.inc,v 1.18 2001/07/06 18:23:57 edmundd
// License is granted to use or modify this software ("XML-RPC for PHP") // License is granted to use or modify this software ('XML-RPC for PHP')
// for commercial or non-commercial use provided the copyright of the author // for commercial or non-commercial use provided the copyright of the author
// is preserved in any distributed or derivative work. // is preserved in any distributed or derivative work.
@ -18,12 +18,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* $Id$ */
class xmlrpcmsg class xmlrpcmsg
{ {
var $payload; var $payload;
var $methodname; var $methodname;
var $params = array(); var $params = array();
var $debug=0; var $debug = 1;
function xmlrpcmsg($meth, $pars=0) function xmlrpcmsg($meth, $pars=0)
{ {
@ -51,7 +53,8 @@
{ {
$this->payload = $this->xml_header(); $this->payload = $this->xml_header();
$this->payload .= '<methodName>' . $this->methodname . '</methodName>' . "\n"; $this->payload .= '<methodName>' . $this->methodname . '</methodName>' . "\n";
// if (sizeof($this->params)) { if (sizeof($this->params))
{
$this->payload .= '<params>' . "\n"; $this->payload .= '<params>' . "\n";
for($i=0; $i<sizeof($this->params); $i++) for($i=0; $i<sizeof($this->params); $i++)
{ {
@ -59,7 +62,7 @@
$this->payload .= '<param>' . "\n" . $p->serialize() . '</param>' . "\n"; $this->payload .= '<param>' . "\n" . $p->serialize() . '</param>' . "\n";
} }
$this->payload .= '</params>' . "\n"; $this->payload .= '</params>' . "\n";
// } }
$this->payload .= $this->xml_footer(); $this->payload .= $this->xml_footer();
$this->payload = str_replace("\n", "\r\n", $this->payload); $this->payload = str_replace("\n", "\r\n", $this->payload);
} }
@ -79,9 +82,20 @@
return $this->payload; return $this->payload;
} }
function addParam($par) { $this->params[]=$par; } function addParam($par)
function getParam($i) { return $this->params[$i]; } {
function getNumParams() { return sizeof($this->params); } $this->params[] = $par;
}
function getParam($i)
{
return $this->params[$i];
}
function getNumParams()
{
return sizeof($this->params);
}
function parseResponseFile($fp) function parseResponseFile($fp)
{ {
@ -106,9 +120,9 @@
$GLOBALS['_xh'][$parser]['qt'] = ''; $GLOBALS['_xh'][$parser]['qt'] = '';
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($parser, "xmlrpc_se", "xmlrpc_ee"); xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
xml_set_character_data_handler($parser, "xmlrpc_cd"); xml_set_character_data_handler($parser, 'xmlrpc_cd');
xml_set_default_handler($parser, "xmlrpc_dh"); xml_set_default_handler($parser, 'xmlrpc_dh');
// $xmlrpc_value = CreateObject('phpgwapi.xmlrpcval'); // $xmlrpc_value = CreateObject('phpgwapi.xmlrpcval');
$hdrfnd=0; $hdrfnd=0;
@ -143,7 +157,7 @@
} }
else else
{ {
$errstr = sprintf("XML error: %s at line %d", $errstr = sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($parser)), xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser)); xml_get_current_line_number($parser));
} }
@ -155,9 +169,9 @@
xml_parser_free($parser); xml_parser_free($parser);
if ($this->debug) if ($this->debug)
{ {
print '<PRE>---EVALING---[' . echo '<PRE>---EVALING---['
strlen($GLOBALS['_xh'][$parser]['st']) . ' chars]---'."\n" . . strlen($GLOBALS['_xh'][$parser]['st']) . ' chars]---' . "\n"
htmlspecialchars($GLOBALS['_xh'][$parser]['st']) . ';'."\n".'---END---</PRE>'; . htmlspecialchars($GLOBALS['_xh'][$parser]['st']) . ';' . "\n" . '---END---</PRE>';
} }
if (strlen($GLOBALS['_xh'][$parser]['st']) == 0) if (strlen($GLOBALS['_xh'][$parser]['st']) == 0)
{ {