Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpcstruct.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpcstruct.php 6000 2001-07-03 15:17:38Z jb $
5 //
6 // Definition of eZXMLRPCStruct class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <18-Dec-2000 17:31:48 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 eZXMLRPCStruct
37 {
43 function __construct( $struct = array(), $type = false, $rec = false )
44 {
45 $this->Struct = $struct;
46
47 $this->DataType = $type;
48 $this->Recursive = $rec;
49 }
50
54 function isRecursive()
55 {
56 return $this->Recursive;
57 }
58
62 function type()
63 {
64 return $this->DataType;
65 }
66
70 function setIsRecursive( $rec )
71 {
72 $this->Recursive = $rec;
73 }
74
78 function setType( $type )
79 {
80 $this->DataType = $type;
81 }
82
86 function &serialize( )
87 {
88 $ret = $this->serializeStruct( $this->Struct );
89 return $ret;
90 }
91
95 function value()
96 {
97 return $this->Struct;
98 }
99
103 function decode( $value )
104 {
105
106 }
107
111 function serializeStruct( $struct )
112 {
113 $ret = "<value><struct>";
114
115 reset( $struct );
116
117 while ( list( $key, $value ) = each( $struct ) )
118 {
119 // $ret .= "<member><name>" . ${key} . "</name>";
120 $ret .= "<member><name>" . $key . "</name>";
121
122 $type = gettype($value);
123 if ( !is_bool( $this->DataType ) )
124 $type = $this->DataType;
125 switch ( $type )
126 {
127 case "integer":
128 {
129 $ret .= "<value><int>$value</int></value>";
130 } break;
131
132 case "object":
133 {
134 if ( substr( get_class($value),0,8) == "ezxmlrpc" )
135 {
136 if ( is_a( $value, "eZXMLRPCStruct" ) and
137 $this->Recursive )
138 {
139 $value->setIsRecursive( $this->Recursive );
140 $value->setType( $this->DataType );
141 }
142 $ret .= $value->serialize( $value );
143 }
144 } break;
145
146 case "array":
147 {
148 if ( $this->Recursive )
149 $ret .= eZXMLRPCArray::serializeArray( $value, $this->DataType, $this->Recursive );
150 else
151 $ret .= eZXMLRPCArray::serializeArray( $value );
152 }
153 break;
154
155 default:
156 {
157 $ret .= "<value><string>$value</string></value>";
158 }
159 break;
160 }
161
162 $ret .= "</member>";
163 }
164
165 $ret .= "</struct></value>";
166
167 return $ret;
168 }
169
170 // The struct value
171 var $Struct;
172 var $DataType;
173 var $Recursive;
174 }
175
176 ?>
eZXMLRPCArray\serializeArray
static serializeArray( $array, $type=false, $rec=false)
Definition: ezxmlrpcarray.php:131
eZXMLRPCStruct
Definition: ezxmlrpcstruct.php:37
eZXMLRPCStruct\$Recursive
$Recursive
Definition: ezxmlrpcstruct.php:173
eZXMLRPCStruct\$DataType
$DataType
Definition: ezxmlrpcstruct.php:172
eZXMLRPCStruct\isRecursive
isRecursive()
Definition: ezxmlrpcstruct.php:54
eZXMLRPCStruct\decode
decode( $value)
Definition: ezxmlrpcstruct.php:103
eZXMLRPCStruct\value
value()
Definition: ezxmlrpcstruct.php:95
eZXMLRPCStruct\type
type()
Definition: ezxmlrpcstruct.php:62
eZXMLRPCStruct\setIsRecursive
setIsRecursive( $rec)
Definition: ezxmlrpcstruct.php:70
eZXMLRPCStruct\setType
setType( $type)
Definition: ezxmlrpcstruct.php:78
eZXMLRPCStruct\$Struct
$Struct
Definition: ezxmlrpcstruct.php:171
eZXMLRPCStruct\__construct
__construct( $struct=array(), $type=false, $rec=false)
Definition: ezxmlrpcstruct.php:43
eZXMLRPCStruct\serialize
& serialize()
Definition: ezxmlrpcstruct.php:86
eZXMLRPCStruct\serializeStruct
serializeStruct( $struct)
Definition: ezxmlrpcstruct.php:111
$type
$type
Definition: classes/admin/linkselect.php:220
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.