Changeset 21299 for branches/version-2_11-dev/data/module/SOAP/Value.php
- Timestamp:
- 2011/10/25 00:02:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/module/SOAP/Value.php
r20119 r21299 41 41 { 42 42 /** 43 * @var string 43 * The actual value. 44 * 45 * @var mixed 44 46 */ 45 47 var $value = null; 46 48 47 49 /** 50 * QName instance representing the value name. 51 * 52 * @var QName 53 */ 54 var $nqn; 55 56 /** 57 * The value name, without namespace information. 58 * 48 59 * @var string 49 60 */ … … 51 62 52 63 /** 64 * The namespace of the value name. 65 * 66 * @var string 67 */ 68 var $namespace = ''; 69 70 /** 71 * QName instance representing the value type. 72 * 73 * @var QName 74 */ 75 var $tqn; 76 77 /** 78 * The value type, without namespace information. 79 * 53 80 * @var string 54 81 */ … … 56 83 57 84 /** 58 * Namespace 59 * 60 * @var string 61 */ 62 var $namespace = ''; 85 * The namespace of the value type. 86 * 87 * @var string 88 */ 63 89 var $type_namespace = ''; 64 90 91 /** 92 * The type of the array elements, if this value is an array. 93 * 94 * @var string 95 */ 96 var $arrayType = ''; 97 98 /** 99 * A hash of additional attributes. 100 * 101 * @see SOAP_Value() 102 * @var array 103 */ 65 104 var $attributes = array(); 66 105 67 106 /** 68 * @var string 69 */ 70 var $arrayType = ''; 71 107 * List of encoding and serialization options. 108 * 109 * @see SOAP_Value() 110 * @var array 111 */ 72 112 var $options = array(); 73 74 var $nqn;75 var $tqn;76 113 77 114 /** … … 82 119 * automatically if not set. 83 120 * @param mixed $value Value to set. 84 * @param array $attributes Attributes. 121 * @param array $attributes A has of additional XML attributes to be 122 * added to the serialized value. 123 * @param array $options A list of encoding and serialization options: 124 * - 'attachment': array with information about 125 * the attachment 126 * - 'soap_encoding': defines encoding for SOAP 127 * message part of a MIME encoded SOAP request 128 * (default: base64) 129 * - 'keep_arrays_flat': use the tag name 130 * multiple times for each element when 131 * passing in an array in literal mode 132 * - 'no_type_prefix': supress adding of the 133 * namespace prefix 85 134 */ 86 135 function SOAP_Value($name = '', $type = false, $value = null, 87 $attributes = array()) 88 { 89 // Detect type if not passed. 136 $attributes = array(), $options = array()) 137 { 90 138 $this->nqn = new QName($name); 91 139 $this->name = $this->nqn->name; 92 140 $this->namespace = $this->nqn->namespace; 93 $this->tqn = new QName($type); 94 $this->type = $this->tqn->name; 95 $this->type_prefix = $this->tqn->ns; 96 $this->type_namespace = $this->tqn->namespace; 141 if ($type) { 142 $this->tqn = new QName($type); 143 $this->type = $this->tqn->name; 144 $this->type_namespace = $this->tqn->namespace; 145 } 97 146 $this->value = $value; 98 147 $this->attributes = $attributes; 148 $this->options = $options; 99 149 } 100 150 … … 110 160 { 111 161 return $serializer->_serializeValue($this->value, 112 $this->name, 113 $this->type, 114 $this->namespace, 115 $this->type_namespace, 162 $this->nqn, 163 $this->tqn, 116 164 $this->options, 117 165 $this->attributes, … … 157 205 158 206 if (isset($actor)) { 159 $this->attributes[ 'SOAP-ENV:actor'] = $actor;160 } elseif (!isset($this->attributes[ 'SOAP-ENV:actor'])) {161 $this->attributes[ 'SOAP-ENV:actor'] = 'http://schemas.xmlsoap.org/soap/actor/next';162 } 163 $this->attributes[ 'SOAP-ENV:mustUnderstand'] = (int)$mustunderstand;207 $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = $actor; 208 } elseif (!isset($this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'])) { 209 $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = 'http://schemas.xmlsoap.org/soap/actor/next'; 210 } 211 $this->attributes[SOAP_BASE::SOAPENVPrefix().':mustUnderstand'] = (int)$mustunderstand; 164 212 } 165 213 … … 184 232 * is provide. 185 233 * @param string $file The attachment data. 234 * @param array $attributes Attributes. 186 235 */ 187 236 function SOAP_Attachment($name = '', $type = 'application/octet-stream', 188 $filename, $file = null )237 $filename, $file = null, $attributes = null) 189 238 { 190 239 parent::SOAP_Value($name, null, null); 191 240 192 $filedata = ($file === null)? $this->_file2str($filename) : $file;241 $filedata = $file === null ? $this->_file2str($filename) : $file; 193 242 $filename = basename($filename); 194 243 if (PEAR::isError($filedata)) { … … 199 248 $cid = md5(uniqid(time())); 200 249 201 $this->attributes['href'] = 'cid:' . $cid; 250 $this->attributes = $attributes; 251 $this->attributes['href'] = 'cid:' . $cid; 202 252 203 253 $this->options['attachment'] = array('body' => $filedata,
Note: See TracChangeset
for help on using the changeset viewer.