MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
class.phpwsdlelement.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
(
'InterpretKeywordpw_elementHook'
,
'internal'
,
'PhpWsdlElement::InterpretElement'
);
24
30
class
PhpWsdlElement
extends
PhpWsdlParam
{
36
public
$NillAble
=
true
;
42
public
$MinOccurs
=1;
48
public
$MaxOccurs
=1;
49
57
public
function
PhpWsdlElement
($name,$type,$settings=
null
)
58
{
59
self::__construct
($name, $type, $settings);
60
}
61
62
public
function
__construct
($name,$type,$settings=
null
){
63
PhpWsdl::Debug
(
'New complex type element '
.$name);
64
parent::PhpWsdlParam($name,$type,$settings);
65
$this->NillAble=!in_array($type,
PhpWsdl::$NonNillable
);
66
if
(!is_null($settings)){
67
if
(isset($settings[
'nillable'
]))
68
$this->NillAble=$settings[
'nillable'
]==
'1'
||$settings[
'nillable'
]==
'true'
;
69
if
(isset($settings[
'minoccurs'
]))
70
$this->MinOccurs=$settings[
'minoccurs'
];
71
if
(isset($settings[
'maxoccurs'
]))
72
$this->MaxOccurs=$settings[
'maxoccurs'
];
73
}
74
}
75
82
public
function
CreateElement
($pw){
83
PhpWsdl::Debug
(
'Create WSDL definition for element '
.$this->Name);
84
$res=
'<s:element minOccurs="'
.$this->MinOccurs.
'" maxOccurs="'
.$this->MaxOccurs.
'" nillable="'
.((
$this->NillAble
)?
'true'
:
'false'
).
'" name="'
.$this->Name.
'" type="'
;
85
$res.=
PhpWsdl::TranslateType
($this->Type).
'"'
;
86
if
($pw->IncludeDocs&&!$pw->Optimize&&!is_null($this->Docs)){
87
$res.=
'>'
.
"\n"
;
88
$res.=
'<s:annotation>'
.
"\n"
;
89
$res.=
'<s:documentation><![CDATA['
.$this->Docs.
']]></s:documentation>'
.
"\n"
;
90
$res.=
'</s:annotation>'
.
"\n"
;
91
$res.=
'</s:element>'
;
92
}
else
{
93
$res.=
' />'
;
94
}
95
return
$res;
96
}
97
103
public
function
CreateElementHtml
($data){
104
PhpWsdl::Debug
(
'CreateElementHtml for '
.$data[
'element'
]->Name);
105
$res=&$data[
'res'
];
106
$e=&$data[
'element'
];
107
if
(in_array($e->Type,
PhpWsdl::$BasicTypes
)){
108
$res[]=
'<li><span class="blue">'
.$e->Type.
'</span> <span class="bold">'
.$e->Name.
'</span>'
;
109
}
else
{
110
$res[]=
'<li><a href="#'
.$e->Type.
'"><span class="lightBlue">'
.$e->Type.
'</span></a> <span class="bold">'
.$e->Name.
'</span>'
;
111
}
112
$o=
sizeof
($res)-1;
113
$temp=Array(
114
'nillable = <span class="blue">'
.(($e->NillAble)?
'true'
:
'false'
).
'</span>'
,
115
'minoccurs = <span class="blue">'
.$e->MinOccurs.
'</span>'
,
116
'maxoccurs = <span class="blue">'
.$e->MaxOccurs.
'</span>'
,
117
);
118
$res[$o].=
' ('
.implode(
', '
,$temp).
')'
;
119
if
(!is_null($e->Docs))
120
$res[$o].=
'<br><span class="normal">'
.nl2br(htmlentities($e->Docs)).
'</span>'
;
121
$res[$o].=
'</li>'
;
122
PhpWsdl::CallHook
(
123
'CreateElementHtmlHook'
,
124
$data
125
);
126
}
127
134
public
static
function
InterpretElement
($data){
135
$info=explode(
' '
,$data[
'keyword'
][1],3);
136
if
(
sizeof
($info)<2)
137
return
true
;
138
$name=substr($info[1],1);
139
if
(substr($name,strlen($name)-1,1)==
';'
)
140
$name=substr($name,0,strlen($name)-1);
141
PhpWsdl::Debug
(
'Interpret element '
.$name);
142
if
($data[
'server'
]->ParseDocs)
143
if
(
sizeof
($info)>2)
144
$data[
'settings'
][
'docs'
]=trim($info[2]);
145
$data[
'elements'
][]=
new
PhpWsdlElement
($name,$info[0],$data[
'settings'
]);
146
$data[
'settings'
]=Array();
147
return
false
;
148
}
149
}
PhpWsdlElement
Definição
class.phpwsdlelement.php:30
PhpWsdlElement\__construct
__construct($name, $type, $settings=null)
Definição
class.phpwsdlelement.php:62
PhpWsdlElement\$NillAble
$NillAble
Definição
class.phpwsdlelement.php:36
PhpWsdlElement\InterpretElement
static InterpretElement($data)
Definição
class.phpwsdlelement.php:134
PhpWsdlElement\$MaxOccurs
$MaxOccurs
Definição
class.phpwsdlelement.php:48
PhpWsdlElement\CreateElementHtml
CreateElementHtml($data)
Definição
class.phpwsdlelement.php:103
PhpWsdlElement\CreateElement
CreateElement($pw)
Definição
class.phpwsdlelement.php:82
PhpWsdlElement\$MinOccurs
$MinOccurs
Definição
class.phpwsdlelement.php:42
PhpWsdlElement\PhpWsdlElement
PhpWsdlElement($name, $type, $settings=null)
Definição
class.phpwsdlelement.php:57
PhpWsdlParam
Definição
class.phpwsdlparam.php:31
PhpWsdl\Debug
static Debug($str)
Definição
class.phpwsdl.php:2399
PhpWsdl\$NonNillable
static $NonNillable
Definição
class.phpwsdl.php:225
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.phpwsdlelement.php
Gerado por
1.10.0