X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FPhpXmlRpc.php;h=9beba9d854a76198bf932dc1cf9821a50565e05c;hb=ae1ecdc2858c57e7ebf62b4cabf7e4d69dd303f0;hp=dff3896701b0b599ffc5921f0decb54f5a6f90fc;hpb=35d2340eea9a168983b8f20d54c399422790f816;p=plcapi.git diff --git a/src/PhpXmlRpc.php b/src/PhpXmlRpc.php index dff3896..9beba9d 100644 --- a/src/PhpXmlRpc.php +++ b/src/PhpXmlRpc.php @@ -2,6 +2,9 @@ namespace PhpXmlRpc; +/** + * Manages global configuration for operation of the library. + */ class PhpXmlRpc { static public $xmlrpcerr = array( @@ -60,16 +63,23 @@ class PhpXmlRpc // The charset encoding used by the server for received requests and // by the client for received responses when received charset cannot be determined - // or is not supported + // and mbstring extension is not enabled public static $xmlrpc_defencoding = "UTF-8"; + // The list of encodings used by the server for requests and by the client for responses + // to detect the charset of the received payload when + // - the charset cannot be determined by looking at http headers, xml declaration or BOM + // - mbstring extension is enabled + public static $xmlrpc_detectencodings = array(); + // The encoding used internally by PHP. // String values received as xml will be converted to this, and php strings will be converted to xml - // as if having been coded with this - public static $xmlrpc_internalencoding = "ISO-8859-1"; // TODO: maybe this would be better as UTF-8, or atleast configurable? + // as if having been coded with this. + // Valid also when defining names of xmlrpc methods + public static $xmlrpc_internalencoding = "UTF-8"; public static $xmlrpcName = "XML-RPC for PHP"; - public static $xmlrpcVersion = "4.0.0.beta"; + public static $xmlrpcVersion = "4.2.1"; // let user errors start at 800 public static $xmlrpcerruser = 800; @@ -95,10 +105,25 @@ class PhpXmlRpc $GLOBALS[$name] = $value; } + // NB: all the variables exported into the global namespace below here do NOT guarantee 100% + // compatibility, as they are NOT reimported back during calls to importGlobals() + $reflection = new \ReflectionClass('PhpXmlRpc\Value'); foreach ($reflection->getStaticProperties() as $name => $value) { $GLOBALS[$name] = $value; } + + $parser = new Helper\XMLParser(); + $reflection = new \ReflectionClass('PhpXmlRpc\Helper\XMLParser'); + foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $name => $value) { + if (in_array($value->getName(), array('xmlrpc_valid_parents'))) + { + $GLOBALS[$value->getName()] = $value->getValue($parser); + } + } + + $charset = Helper\Charset::instance(); + $GLOBALS['xml_iso88591_Entities'] = $charset->getEntities('iso88591'); } /** @@ -121,4 +146,5 @@ class PhpXmlRpc } } } + }