switch ($action) {
case 'wrap':
- @include('xmlrpc_wrappers.php');
+ @include('xmlrpc_wrappers.inc');
if (!function_exists('build_remote_method_wrapper_code'))
{
- die('Error: to enable creation of method stubs the xmlrpc_wrappers.php file is needed');
+ die('Error: to enable creation of method stubs the xmlrpc_wrappers.inc file is needed');
}
// fall thru intentionally
case 'describe':
</h3>
<?php
include("xmlrpc.inc");
- include("xmlrpc_wrappers.php");
+ include("xmlrpc_wrappers.inc");
$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
$c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
include("xmlrpc.inc");
include("xmlrpcs.inc");
- include("xmlrpc_wrappers.php");
+ include("xmlrpc_wrappers.inc");
/**
* Used to test usage of object methods in dispatch maps and in wrapper code
include_once(__DIR__.'/../src/Client.php');
include_once(__DIR__.'/../src/Encoder.php');
+
+/* Expose the global variables which used to be defined */
+PhpXmlRpc\PhpXmlRpc::exportGlobals();
+
/* Expose with the old names the classes which have been namespaced */
class xmlrpcval extends PhpXmlRpc\Value
}
break;
case 'object':
- if(is_a($php_val, 'xmlrpcval'))
+ if(is_a($php_val, 'PhpXmlRpc\Value'))
{
$xmlrpc_val = $php_val;
}
public static $xmlrpc_null_apache_encoding = false;
public static $xmlrpc_null_apache_encoding_ns = "http://ws.apache.org/xmlrpc/namespaces/extensions";
+
+ /**
+ * A function to be used for compatibility with legacy code: it creates all global variables which used to be declared,
+ * such as library version etc...
+ */
+ public static function exportGlobals()
+ {
+ $reflection = new \ReflectionClass('PhpXmlRpc\PhpXmlRpc');
+ $staticProperties = $reflection->getStaticProperties();
+ foreach ($staticProperties as $name => $value)
+ {
+ $GLOBALS[$name] = $value;
+ }
+ }
+
+ /**
+ * A function to be used for compatibility with legacy code: it gets the values of all global variables which used
+ * to be declared, such as library version etc... and sets them to php classes.
+ * It should be used by code which changed the values of those global variables to alter the working of the library.
+ * Example code:
+ * 1. include xmlrpc.inc
+ * 2. set the values, e.g. $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
+ * 3. import them: PhpXmlRpc\PhpXmlRpc::importGlobals();
+ * 4. run your own code
+ */
+ public static function importGlobals()
+ {
+ $reflection = new \ReflectionClass('PhpXmlRpc\PhpXmlRpc');
+ $staticProperties = $reflection->getStaticProperties();
+ foreach ($staticProperties as $name => $value)
+ {
+ if(isset($GLOBALS[$name]))
+ self::$$name = $GLOBALS[$name];
+ }
+ }
}
}
else
{
- if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
+ if(!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value'))
{
if (is_string($this->val) && $this->valtyp == 'xml')
{
if (!is_a($r, 'xmlrpcresp'))
{
error_log("XML-RPC: ".__METHOD__.": function $func registered as method handler does not return an xmlrpcresp object");
- if (is_a($r, 'xmlrpcval'))
+ if (is_a($r, 'PhpXmlRpc\Value'))
{
$r = new Response($r);
}
switch($this->mytype)
{
case 1:
- error_log('XML-RPC: '.__METHOD__.': scalar xmlrpcval can have only one value');
+ error_log('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
return 0;
case 3:
- error_log('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpcval');
+ error_log('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
return 0;
case 2:
// we're adding a scalar value to an array here
{
reset($this->me);
list($a,)=each($this->me);
- if($a==static::xmlrpcI4)
+ if($a==static::$xmlrpcI4)
{
- $a=static::xmlrpcInt;
+ $a=static::$xmlrpcInt;
}
return $a;
}