Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
4
 
5
// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{
6
 
7
/**
8
* +-----------------------------------------------------------------------------+
9
* | Copyright (c) 2004-2006 Sergio Goncalves Carvalho                                |
10
* +-----------------------------------------------------------------------------+
11
* | This file is part of XML_RPC2.                                              |
12
* |                                                                             |
13
* | XML_RPC2 is free software; you can redistribute it and/or modify            |
14
* | it under the terms of the GNU Lesser General Public License as published by |
15
* | the Free Software Foundation; either version 2.1 of the License, or         |
16
* | (at your option) any later version.                                         |
17
* |                                                                             |
18
* | XML_RPC2 is distributed in the hope that it will be useful,                 |
19
* | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
20
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
21
* | GNU Lesser General Public License for more details.                         |
22
* |                                                                             |
23
* | You should have received a copy of the GNU Lesser General Public License    |
24
* | along with XML_RPC2; if not, write to the Free Software                     |
25
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
26
* | 02111-1307 USA                                                              |
27
* +-----------------------------------------------------------------------------+
28
* | Author: Sergio Carvalho <sergio.carvalho@portugalmail.com>                  |
29
* +-----------------------------------------------------------------------------+
30
*
31
* @category   XML
32
* @package    XML_RPC2
33
* @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>
34
* @copyright  2004-2006 Sergio Carvalho
35
* @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
36
* @version    CVS: $Id: Client.php 308640 2011-02-24 20:46:30Z sergiosgc $
37
* @link       http://pear.php.net/package/XML_RPC2
38
*/
39
 
40
// }}}
41
 
42
// dependencies {{{
43
require_once 'XML/RPC2/Exception.php';
44
require_once 'XML/RPC2/Backend.php';
45
// }}}
46
 
47
/**
48
 * XML_RPC2 client helper class.
49
 *
50
 * XML_RPC2_Client must maintain a function namespace as clean as possible. As such
51
 * whenever possible, methods that may be usefull to subclasses but shouldn't be defined
52
 * in XML_RPC2 because of namespace pollution are defined here.
53
 *
54
 * @category   XML
55
 * @package    XML_RPC2
56
 * @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>
57
 * @copyright  2004-2006 Sergio Carvalho
58
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
59
 * @link       http://pear.php.net/package/XML_RPC2
60
 */
61
class XML_RPC2_ClientHelper
62
{
63
    // {{{ printPreParseDebugInfo()
64
 
65
    /**
66
     * Display debug informations
67
     *
68
     * @param string $request XML client request
69
     * @param string $body XML server response
70
     */
71
    public static function printPreParseDebugInfo($request, $body)
72
    {
73
        print '<pre>';
74
        print "***** Request *****\n";
75
        print htmlspecialchars($request);
76
        print "***** End Of request *****\n\n";
77
        print "***** Server response *****\n";
78
        print htmlspecialchars($body);
79
        print "\n***** End of server response *****\n\n";
80
    }
81
 
82
    // }}}
83
    // {{{ printPostRequestDebugInformation()
84
 
85
    /**
86
     * Display debug informations (part 2)
87
     *
88
     * @param mixed $result decoded server response
89
     */
90
    public static function printPostRequestDebugInformation($result)
91
    {
92
        print "***** Decoded result *****\n";
93
        print_r($result);
94
        print "\n***** End of decoded result *****";
95
        print '</pre>';
96
    }
97
 
98
    // }}}
99
    // {{{ testMethodName___()
100
 
101
    /**
102
     * Return true is the given method name is ok with XML/RPC spec.
103
     *
104
     * NB : The '___' at the end of the method name is to avoid collisions with
105
     * XMLRPC __call()
106
     *
107
     * @param string $methodName method name
108
     * @return boolean true if ok
109
     */
110
    public static function testMethodName($methodName)
111
    {
112
        return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName));
113
    }
114
 
115
    // }}}
116
 
117
}
118