| 1 |
lars |
1 |
<?php
|
|
|
2 |
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
|
|
|
3 |
|
|
|
4 |
// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{
|
|
|
5 |
|
|
|
6 |
/**
|
|
|
7 |
* +-----------------------------------------------------------------------------+
|
|
|
8 |
* | Copyright (c) 2004-2006 Sergio Gonalves Carvalho |
|
|
|
9 |
* +-----------------------------------------------------------------------------+
|
|
|
10 |
* | This file is part of XML_RPC2. |
|
|
|
11 |
* | |
|
|
|
12 |
* | XML_RPC2 is free software; you can redistribute it and/or modify |
|
|
|
13 |
* | it under the terms of the GNU Lesser General Public License as published by |
|
|
|
14 |
* | the Free Software Foundation; either version 2.1 of the License, or |
|
|
|
15 |
* | (at your option) any later version. |
|
|
|
16 |
* | |
|
|
|
17 |
* | XML_RPC2 is distributed in the hope that it will be useful, |
|
|
|
18 |
* | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
19 |
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
20 |
* | GNU Lesser General Public License for more details. |
|
|
|
21 |
* | |
|
|
|
22 |
* | You should have received a copy of the GNU Lesser General Public License |
|
|
|
23 |
* | along with XML_RPC2; if not, write to the Free Software |
|
|
|
24 |
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
|
|
25 |
* | 02111-1307 USA |
|
|
|
26 |
* +-----------------------------------------------------------------------------+
|
|
|
27 |
* | Author: Sergio Carvalho <sergio.carvalho@portugalmail.com> |
|
|
|
28 |
* +-----------------------------------------------------------------------------+
|
|
|
29 |
*
|
|
|
30 |
* @category XML
|
|
|
31 |
* @package XML_RPC2
|
|
|
32 |
* @author Sergio Carvalho <sergio.carvalho@portugalmail.com>
|
|
|
33 |
* @copyright 2004-2006 Sergio Carvalho
|
|
|
34 |
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
|
|
|
35 |
* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $
|
|
|
36 |
* @link http://pear.php.net/package/XML_RPC2
|
|
|
37 |
*/
|
|
|
38 |
|
|
|
39 |
// }}}
|
|
|
40 |
|
|
|
41 |
// Dependencies {{{
|
|
|
42 |
require_once('XML/RPC2/Server/Input.php');
|
|
|
43 |
// }}}
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Class that feeds XML_RPC2 with input originating from php://input
|
|
|
47 |
*
|
|
|
48 |
* @category XML
|
|
|
49 |
* @package XML_RPC2
|
|
|
50 |
* @author Sergio Carvalho <sergio.carvalho@portugalmail.com>
|
|
|
51 |
* @copyright 2011 Sergio Carvalho
|
|
|
52 |
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
|
|
|
53 |
* @link http://pear.php.net/package/XML_RPC2
|
|
|
54 |
*/
|
|
|
55 |
class XML_RPC2_Server_Input_PhpInput implements XML_RPC2_Server_Input
|
|
|
56 |
{
|
|
|
57 |
protected $input;
|
|
|
58 |
/**
|
|
|
59 |
* Return true if there is no input (input is empty)
|
|
|
60 |
*
|
|
|
61 |
* @return boolean True iff there is no input
|
|
|
62 |
*/
|
|
|
63 |
public function isEmpty()
|
|
|
64 |
{
|
|
|
65 |
if (!isset($this->input)) $this->readRequest();
|
|
|
66 |
return empty($this->input);
|
|
|
67 |
}
|
|
|
68 |
/**
|
|
|
69 |
* Return the input as a string
|
|
|
70 |
*
|
|
|
71 |
* @return string The Input
|
|
|
72 |
*/
|
|
|
73 |
public function readRequest()
|
|
|
74 |
{
|
|
|
75 |
if (!isset($this->input)) {
|
|
|
76 |
$this->input = file_get_contents('php://input');
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
return $this->input;
|
|
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
|