WIP fix bugs after introduction of namespaces, found trying to run the testsuite
[plcapi.git] / lib / xmlrpc.inc
1 <?php
2 // by Edd Dumbill (C) 1999-2002
3 // <edd@usefulinc.com>
4
5 // Copyright (c) 1999,2000,2002 Edd Dumbill.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 //    * Redistributions of source code must retain the above copyright
13 //      notice, this list of conditions and the following disclaimer.
14 //
15 //    * Redistributions in binary form must reproduce the above
16 //      copyright notice, this list of conditions and the following
17 //      disclaimer in the documentation and/or other materials provided
18 //      with the distribution.
19 //
20 //    * Neither the name of the "XML-RPC for PHP" nor the names of its
21 //      contributors may be used to endorse or promote products derived
22 //      from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 // REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35 // OF THE POSSIBILITY OF SUCH DAMAGE.
36
37 /******************************************************************************
38  *
39  *** DEPRECATED ***
40  *
41  * This file is only used to insure backwards compatibility
42  * with the API of the library <= rev. 3
43  *****************************************************************************/
44
45 include_once(__DIR__.'/../src/PhpXmlRpc.php');
46 include_once(__DIR__.'/../src/Value.php');
47 include_once(__DIR__.'/../src/Request.php');
48 include_once(__DIR__.'/../src/Response.php');
49 include_once(__DIR__.'/../src/Client.php');
50 include_once(__DIR__.'/../src/Encoder.php');
51
52
53 /* Expose the global variables which used to be defined */
54 PhpXmlRpc\PhpXmlRpc::exportGlobals();
55
56 /* Expose with the old names the classes which have been namespaced */
57
58 class xmlrpcval extends PhpXmlRpc\Value
59 {
60 }
61
62 class xmlrpcmsg extends PhpXmlRpc\Request
63 {
64 }
65
66 class xmlrpcresp extends PhpXmlRpc\Response
67 {
68 }
69
70 class xmlrpc_client extends PhpXmlRpc\Client
71 {
72 }
73
74 /* Expose as global functions the ones which are now class methods */
75
76 function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='')
77 {
78     return PhpXmlRpc\Helper\Charset::instance()->encode_entitites($data, $srcEncoding, $destEncoding);
79 }
80
81 function iso8601_encode($timeT, $utc=0)
82 {
83     return PhpXmlRpc\Helper\Date::iso8601_encode($timeT, $utc);
84 }
85
86 function iso8601_decode($iDate, $utc=0)
87 {
88     return PhpXmlRpc\Helper\Date::iso8601_decode($iDate, $utc);
89 }
90
91 function decode_chunked($buffer)
92 {
93     return PhpXmlRpc\Helper\Http::decode_chunked($buffer);
94 }
95
96 function php_xmlrpc_decode($xmlrpcVal, $options=array())
97 {
98     $encoder = new PhpXmlRpc\Encoder();
99     return $encoder->decode($xmlrpcVal, $options);
100 }
101
102 function php_xmlrpc_encode($phpVal, $options=array())
103 {
104     $encoder = new PhpXmlRpc\Encoder();
105     return $encoder->encode($phpVal, $options);
106 }
107
108 function php_xmlrpc_decode_xml($xmlVal, $options=array())
109 {
110     $encoder = new PhpXmlRpc\Encoder();
111     return $encoder->decode_xml($xmlVal, $options);
112 }
113
114 function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null)
115 {
116 }
117
118 function is_valid_charset($encoding, $validList)
119 {
120     return PhpXmlRpc\Helper\Charset::instance()->is_valid_charset($encoding, $validList);
121 }