Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpcdatatypedecoder.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpcdatatypedecoder.php 8492 2001-11-16 16:21:00Z bf $
5 //
6 // Definition of eZXMLRPCDataTypeDecoder class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <01-Jan-2001 14:33:43 bf>
10 //
11 // This source file is part of Exponential Basic, publishing software.
12 // Copyright (C) 1999-2000 eZ systems as
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29
32
36 class eZXMLRPCDataTypeDecoder
37 {
41 function __construct( )
42 {
43 }
44
50 function &decodeDataTypes( $value )
51 {
52 $result = 0;
53 // check the type
54 foreach ( $value->children as $type )
55 {
56 switch ( $type->name )
57 {
58 // if no type is specified make it a string
59 case "#text" :
60 case "text" :
61 case "string" :
62 {
63 $result =& $this->decodeString( $type );
64 }
65 break;
66
67 case "i4" :
68 case "int" :
69 {
70 $result =& $this->decodeInt( $type );
71 }
72 break;
73
74 case "double" :
75 {
76 $result =& $this->decodeDouble( $type );
77 }
78 break;
79
80 case "boolean" :
81 {
82 $result =& $this->decodeBoolean( $type );
83 }
84 break;
85
86 case "base64" :
87 {
88 $result =& $this->decodeBase64( $type );
89 }
90 break;
91
92 case "dateTime.iso8601" :
93 {
94 $result =& $this->decodeDateTime( $type );
95 }
96 break;
97
98 case "array" :
99 {
100 $result =& $this->decodeArray( $type );
101 }
102 break;
103
104 case "struct" :
105 {
106 $result =& $this->decodeStruct( $type );
107 }
108 break;
109 }
110 }
111
112
113 return $result;
114 }
115
119 function &decodeString( $type )
120 {
121 $result = 0;
122 if ( count( $type->children ) > 0 )
123 {
124 foreach ( $type->children as $content )
125 {
126 if ( $content->name == "#text" || $content->name == "text" )
127 {
128 $result = new eZXMLRPCString( $content->content );
129 }
130 }
131 }
132 else
133 {
134 $result = new eZXMLRPCString( $type->content );
135 }
136
137 return $result;
138 }
139
143 function &decodeInt( $type )
144 {
145 $result = 0;
146 foreach ( $type->children as $content )
147 {
148 if ( $content->name == "#text" || $content->name == "text" )
149 {
150 $result = new eZXMLRPCInt( $content->content );
151 }
152 }
153 return $result;
154 }
155
159 function &decodeDouble( $type )
160 {
161 $result = 0;
162 foreach ( $type->children as $content )
163 {
164 if ( $content->name == "#text" || $content->name == "text" )
165 {
166 $result = new eZXMLRPCDouble( $content->content );
167 }
168 }
169 return $result;
170 }
171
175 function decodeBoolean( $type )
176 {
177 $result = 0;
178 foreach ( $type->children as $content )
179 {
180 if ( $content->name == "#text" || $content->name == "text" )
181 {
182 $bool = new eZXMLRPCBool( );
183 $bool->decode( $content->content );
184 $result = $bool;
185 }
186 }
187 return $result;
188 }
189
193 function decodeBase64( $type )
194 {
195 $result = 0;
196 foreach ( $type->children as $content )
197 {
198 if ( $content->name == "#text" || $content->name == "text" )
199 {
200 $bin = new eZXMLRPCBase64( );
201 $bin->decode( $content->content );
202 $result = $bin;
203 }
204 }
205 return $result;
206 }
207
211 function decodeDateTime( $type )
212 {
213 $result = 0;
214 foreach ( $type->children as $content )
215 {
216 if ( $content->name == "#text" || $content->name == "text" )
217 {
218 $date = new eZXMLRPCDateTime( );
219 $date->decode( $content->content );
220 $result = $date;
221 }
222 }
223 return $result;
224 }
225
229 function decodeArray( $type )
230 {
231 $array = array();
232 if ( count( $type->children ) > 0)
233 foreach ( $type->children as $data )
234 {
235 if ( $data->name == "data" )
236 {
237 if ( isset( $data->children ) and count( $data->children ) > 0 )
238 {
239 foreach ( $data->children as $dataValue )
240 {
241 if ( $dataValue->name == "value" )
242 {
243 $array[] = $this->decodeDataTypes( $dataValue );
244 }
245 if ( $dataValue->name == "array" )
246 {
247 $array[] = $this->decodeDataTypes( $dataValue );
248 }
249 }
250 }
251 }
252 }
253 return new eZXMLRPCArray( $array );
254 }
255
256
260 function decodeStruct( $type )
261 {
262 $array = array();
263 if ( count( $type->children ) > 0 )
264 foreach ( $type->children as $member )
265 {
266 if ( $member->name == "member" )
267 {
268 unset( $memberName );
269 unset( $memberData );
270
271 foreach ( $member->children as $memberValue )
272 {
273 if ( $memberValue->name == "name" )
274 {
275 foreach ( $memberValue->children as $content )
276 {
277 if ( $content->name == "#text" || $content->name == "text" )
278 {
279 $memberName = $content->content;
280 }
281 }
282 }
283
284 if ( $memberValue->name == "value" )
285 {
286 $memberData = $this->decodeDataTypes( $memberValue );
287 }
288
289 // if ( $dataValue->name == "array" )
290 // {
291 // $array[] = $this->decodeDataTypes( $dataValue );
292 // }
293
294 }
295
296 $array = array_merge( $array, array( $memberName => $memberData ) );
297 }
298 }
299 return new eZXMLRPCStruct( $array );
300 }
301
302 }
303
304 ?>
$date
$date
Definition: bugpreview.php:66
eZXMLRPCArray
Definition: ezxmlrpcarray.php:37
eZXMLRPCBase64
Definition: ezxmlrpcbase64.php:37
eZXMLRPCBool
Definition: ezxmlrpcbool.php:37
eZXMLRPCDataTypeDecoder
Definition: ezxmlrpcdatatypedecoder.php:37
eZXMLRPCDataTypeDecoder\decodeDateTime
decodeDateTime( $type)
Definition: ezxmlrpcdatatypedecoder.php:211
eZXMLRPCDataTypeDecoder\decodeArray
decodeArray( $type)
Definition: ezxmlrpcdatatypedecoder.php:229
eZXMLRPCDataTypeDecoder\__construct
__construct()
Definition: ezxmlrpcdatatypedecoder.php:41
eZXMLRPCDataTypeDecoder\decodeDataTypes
& decodeDataTypes( $value)
Definition: ezxmlrpcdatatypedecoder.php:50
eZXMLRPCDataTypeDecoder\decodeInt
& decodeInt( $type)
Definition: ezxmlrpcdatatypedecoder.php:143
eZXMLRPCDataTypeDecoder\decodeDouble
& decodeDouble( $type)
Definition: ezxmlrpcdatatypedecoder.php:159
eZXMLRPCDataTypeDecoder\decodeBoolean
decodeBoolean( $type)
Definition: ezxmlrpcdatatypedecoder.php:175
eZXMLRPCDataTypeDecoder\decodeStruct
decodeStruct( $type)
Definition: ezxmlrpcdatatypedecoder.php:260
eZXMLRPCDataTypeDecoder\decodeBase64
decodeBase64( $type)
Definition: ezxmlrpcdatatypedecoder.php:193
eZXMLRPCDataTypeDecoder\decodeString
& decodeString( $type)
Definition: ezxmlrpcdatatypedecoder.php:119
eZXMLRPCDouble
Definition: ezxmlrpcdouble.php:37
eZXMLRPCInt
Definition: ezxmlrpcint.php:37
eZXMLRPCString
Definition: ezxmlrpcstring.php:37
eZXMLRPCStruct
Definition: ezxmlrpcstruct.php:37
$type
$type
Definition: classes/admin/linkselect.php:220
$result
$result
Definition: companysearch.php:94
$content
$content
Definition: ezimagecatalogue/admin/filedownload.php:53
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.