Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpcarray.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpcarray.php 6261 2001-07-25 10:20:25Z jb $
5 //
6 // Definition of eZXMLRPCArray class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <18-Dec-2000 14:13:24 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 eZXMLRPCArray
37 {
43 function __construct( $array=array(), $type = false, $rec = false )
44 {
45 $this->Array = $array;
46 $this->Type = $type;
47 $this->Recursive = $rec;
48 }
49
53 function isRecursive()
54 {
55 return $this->Recursive;
56 }
57
61 function type()
62 {
63 return $this->Type;
64 }
65
69 function setIsRecursive( $rec )
70 {
71 $this->Recursive = $rec;
72 }
73
77 function setType( $type )
78 {
79 $this->Type = $type;
80 }
81
85 function &serialize( )
86 {
87 $ret = $this->serializeArray( $this->Array, $this->Type, $this->Recursive );
88 return $ret;
89 }
90
94 function value($arg = -1)
95 {
96 if ($arg == -1)
97 {
98 return $this->Array;
99 }
100 else
101 {
102 return $this->Array[$arg]->Value();
103 }
104 }
105
109 function &toArray()
110 {
111 $arr = array();
112 foreach( $this->Array as $item )
113 {
114 $arr[] = $item->value();
115 }
116 return $arr;
117 }
118
122 function decode( $value )
123 {
124
125 }
126
131 static public function serializeArray( $array, $type = false, $rec = false )
132 {
133 $ret = "<value><array><data>";
134 foreach ( $array as $value )
135 {
136 $val_type = gettype($value);
137 if ( !is_bool( $type ) )
138 $val_type = $type;
139 switch( $val_type )
140 {
141 case "integer":
142 {
143 $ret .= "<value><int>$value</int></value>";
144 }
145 break;
146
147 case "array":
148 {
149 if ( $rec )
150 $ret .= eZXMLRPCArray::serializeArray( $value, $type, $rec );
151 else
152 $ret .= eZXMLRPCArray::serializeArray( $value );
153 }
154 break;
155
156 case "object":
157 {
158 if ( substr( strtolower( get_class( $value ), 0, 8 ) ) == "ezxmlrpc" )
159 {
160 if ( is_a( $value, "eZXMLRPCStruct") and
161 $rec )
162 {
163 $value->setIsRecursive( $rec );
164 $value->setType( $type );
165 }
166 $ret .= $value->serialize( $value );
167 }
168 }
169 break;
170
171 default:
172 {
173 $ret .= "<value><string>$value</string></value>";
174 }
175 break;
176 }
177 }
178
179 $ret .= "</data></array></value>";
180 return $ret;
181 }
182
183 // The array value
184 var $Array;
185 var $Type;
186 var $Recursive;
187 }
188
189 ?>
eZXMLRPCArray
Definition: ezxmlrpcarray.php:37
eZXMLRPCArray\type
type()
Definition: ezxmlrpcarray.php:61
eZXMLRPCArray\serializeArray
static serializeArray( $array, $type=false, $rec=false)
Definition: ezxmlrpcarray.php:131
eZXMLRPCArray\decode
decode( $value)
Definition: ezxmlrpcarray.php:122
eZXMLRPCArray\toArray
& toArray()
Definition: ezxmlrpcarray.php:109
eZXMLRPCArray\$Array
$Array
Definition: ezxmlrpcarray.php:184
eZXMLRPCArray\isRecursive
isRecursive()
Definition: ezxmlrpcarray.php:53
eZXMLRPCArray\setIsRecursive
setIsRecursive( $rec)
Definition: ezxmlrpcarray.php:69
eZXMLRPCArray\$Recursive
$Recursive
Definition: ezxmlrpcarray.php:186
eZXMLRPCArray\serialize
& serialize()
Definition: ezxmlrpcarray.php:85
eZXMLRPCArray\setType
setType( $type)
Definition: ezxmlrpcarray.php:77
eZXMLRPCArray\$Type
$Type
Definition: ezxmlrpcarray.php:185
eZXMLRPCArray\__construct
__construct( $array=array(), $type=false, $rec=false)
Definition: ezxmlrpcarray.php:43
eZXMLRPCArray\value
value($arg=-1)
Definition: ezxmlrpcarray.php:94
$item
$item
Definition: classes/admin/linklist.php:228
$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+.