MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
class.phpwsdlparam.php
Ir para a documentação deste ficheiro.
1
<?php
2
3
/*
4
PhpWsdl - Generate WSDL from PHP
5
Copyright (C) 2011 Andreas Zimmermann, wan24.de
6
7
This program is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free Software
9
Foundation; either version 3 of the License, or (at your option) any later
10
version.
11
12
This program is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License along with
17
this program; if not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
if
(basename($_SERVER[
'SCRIPT_FILENAME'
])==basename(__FILE__))
21
exit;
22
23
PhpWsdl::RegisterHook
(
'InterpretKeywordparamHook'
,
'internal'
,
'PhpWsdlParam::InterpretParam'
);
24
PhpWsdl::RegisterHook
(
'InterpretKeywordreturnHook'
,
'internal'
,
'PhpWsdlParam::InterpretReturn'
);
25
31
class
PhpWsdlParam
extends
PhpWsdlObject
{
37
public
$Type
;
43
public
$Docs
=
null
;
50
public
static
$DefaultReturnName
=
'return'
;
51
59
public
function
PhpWsdlParam
($name,$type=
'string'
,$settings=
null
){
60
self::__construct
($name, $type, $settings);
61
}
62
63
public
function
__construct
($name,$type=
'string'
,$settings=
null
){
64
PhpWsdl::Debug
(
'New parameter '
.$name);
65
parent::__construct($name,$settings);
66
$this->Type=$type;
67
}
68
75
public
function
CreatePart
($pw){
76
PhpWsdl::Debug
(
'Create WSDL definition for parameter part '
.$this->Name);
77
$res=
'<wsdl:part name="'
.$this->Name.
'" type="'
;
78
$res.=
PhpWsdl::TranslateType
($this->Type).
'"'
;
79
if
($pw->IncludeDocs&&!$pw->Optimize&&!is_null($this->Docs)){
80
$res.=
'>'
.
"\n"
;
81
$res.=
'<s:documentation><![CDATA['
.$this->Docs.
']]></s:documentation>'
.
"\n"
;
82
$res.=
'</wsdl:part>'
;
83
}
else
{
84
$res.=
' />'
;
85
}
86
return
$res;
87
}
88
94
public
function
CreateParamHtml
($data){
95
PhpWsdl::Debug
(
'CreateParamHtml for '
.$data[
'param'
]->Name);
96
$res=&$data[
'res'
];
97
$p=&$data[
'param'
];
98
if
(is_null($p->Docs))
99
return
;
100
if
(in_array($p->Type,
PhpWsdl::$BasicTypes
)){
101
$res[]=
'<li class="pre"><span class="blue">'
.$p->Type.
'</span> <span class="bold">'
.$p->Name.
'</span>'
;
102
}
else
{
103
$res[]=
'<li class="pre"><a href="#'
.$p->Type.
'"><span class="lightBlue">'
.$p->Type.
'</span></a> <span class="bold">'
.$p->Name.
'</span>'
;
104
}
105
$res[
sizeof
($res)-1].=
'<br><span class="normal">'
.nl2br(htmlentities($p->Docs)).
'</span></li>'
;
106
PhpWsdl::CallHook
(
107
'CreateParameterHtmlHook'
,
108
$data
109
);
110
}
111
117
public
function
CreateReturnHtml
($data){
118
PhpWsdl::Debug
(
'CreateReturnHtml for '
.$data[
'method'
]->Return->Name);
119
$res=&$data[
'res'
];
120
$m=&$data[
'method'
];
121
$res[]=
'<p>Return value <span class="pre">'
;
122
$o=
sizeof
($res)-1;
123
$type=$m->Return->Type;
124
if
(in_array($type,
PhpWsdl::$BasicTypes
)){
125
$res[$o].=
'<span class="blue">'
.$type.
'</span>'
;
126
}
else
{
127
$res[$o].=
'<a href="#'
.$type.
'"><span class="lightBlue">'
.$type.
'</span></a>'
;
128
}
129
$res[$o].=
'</span>'
.((!is_null($m->Return->Docs))?
': '
.nl2br(htmlentities($m->Return->Docs)):
''
).
'</p>'
;
130
PhpWsdl::CallHook
(
131
'CreateReturnHtmlHook'
,
132
$data
133
);
134
}
135
142
public
static
function
InterpretParam
($data){
143
if
($data[
'method'
]==
''
)
144
return
true
;
145
$info=explode(
' '
,$data[
'keyword'
][1],3);
146
if
(
sizeof
($info)<2)
147
return
true
;
148
$name=substr($info[1],1);
149
if
(substr($name,strlen($name)-1,1)==
';'
)
150
$name=substr($name,0,strlen($name)-1);
151
PhpWsdl::Debug
(
'Interpret parameter '
.$name);
152
if
($data[
'server'
]->ParseDocs)
153
if
(
sizeof
($info)>2)
154
$data[
'settings'
][
'docs'
]=trim($info[2]);
155
$data[
'param'
][]=
new
PhpWsdlParam
($name,$info[0],$data[
'settings'
]);
156
$data[
'settings'
]=Array();
157
return
false
;
158
}
159
166
public
static
function
InterpretReturn
($data){
167
if
($data[
'method'
]==
''
)
168
return
true
;
169
$info=explode(
' '
,$data[
'keyword'
][1],2);
170
if
(
sizeof
($info)<1)
171
return
true
;
172
PhpWsdl::Debug
(
'Interpret return'
);
173
if
($data[
'server'
]->ParseDocs)
174
if
(
sizeof
($info)>1)
175
$data[
'settings'
][
'docs'
]=trim($info[1]);
176
$data[
'return'
]=
new
PhpWsdlParam
(str_replace(
'%method%'
,$data[
'method'
],self::$DefaultReturnName),$info[0],$data[
'settings'
]);
177
$data[
'settings'
]=Array();
178
return
false
;
179
}
180
}
PhpWsdlObject
Definição
class.phpwsdlobject.php:28
PhpWsdlParam
Definição
class.phpwsdlparam.php:31
PhpWsdlParam\__construct
__construct($name, $type='string', $settings=null)
Definição
class.phpwsdlparam.php:63
PhpWsdlParam\PhpWsdlParam
PhpWsdlParam($name, $type='string', $settings=null)
Definição
class.phpwsdlparam.php:59
PhpWsdlParam\InterpretParam
static InterpretParam($data)
Definição
class.phpwsdlparam.php:142
PhpWsdlParam\InterpretReturn
static InterpretReturn($data)
Definição
class.phpwsdlparam.php:166
PhpWsdlParam\$Type
$Type
Definição
class.phpwsdlparam.php:37
PhpWsdlParam\CreateParamHtml
CreateParamHtml($data)
Definição
class.phpwsdlparam.php:94
PhpWsdlParam\$DefaultReturnName
static $DefaultReturnName
Definição
class.phpwsdlparam.php:50
PhpWsdlParam\$Docs
$Docs
Definição
class.phpwsdlparam.php:43
PhpWsdlParam\CreateReturnHtml
CreateReturnHtml($data)
Definição
class.phpwsdlparam.php:117
PhpWsdlParam\CreatePart
CreatePart($pw)
Definição
class.phpwsdlparam.php:75
PhpWsdl\Debug
static Debug($str)
Definição
class.phpwsdl.php:2399
PhpWsdl\RegisterHook
static RegisterHook($hook, $name, $data)
Definição
class.phpwsdl.php:2344
PhpWsdl\TranslateType
static TranslateType($type)
Definição
class.phpwsdl.php:2301
PhpWsdl\$BasicTypes
static $BasicTypes
Definição
class.phpwsdl.php:193
PhpWsdl\CallHook
static CallHook($name, $data=null)
Definição
class.phpwsdl.php:2320
classes
contrib
phpWsdl
class.phpwsdlparam.php
Gerado por
1.10.0