Completed
Push — 1.11.x ( a12f80...59baa4 )
by José
192:14 queued 157:06
created
main/inc/lib/nusoap/nusoapmime.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	* @access public
87 87
 	*/
88 88
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
89
-		if (! $cid) {
89
+		if (!$cid) {
90 90
 			$cid = md5(uniqid(time()));
91 91
 		}
92 92
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	* @access   private
222 222
 	*/
223 223
     function parseResponse($headers, $data) {
224
-		$this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
224
+		$this->debug('Entering parseResponse() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
225 225
 		$this->responseAttachments = array();
226 226
 		if (strstr($headers['content-type'], 'multipart/related')) {
227 227
 			$this->debug('Decode multipart/related');
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			foreach ($headers as $k => $v) {
230 230
 				$input .= "$k: $v\r\n";
231 231
 			}
232
-			$params['input'] = $input . "\r\n" . $data;
232
+			$params['input'] = $input."\r\n".$data;
233 233
 			$params['include_bodies'] = true;
234 234
 			$params['decode_bodies'] = true;
235 235
 			$params['decode_headers'] = true;
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 
239 239
 			foreach ($structure->parts as $part) {
240 240
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
241
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
241
+					$this->debug('Have root part of type '.$part->headers['content-type']);
242 242
 					$root = $part->body;
243 243
 					$return = parent::parseResponse($part->headers, $part->body);
244 244
 				} else {
245
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
245
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
246 246
 					$info['data'] = $part->body;
247 247
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
248 248
 					$info['contenttype'] = $part->headers['content-type'];
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	* @access public
317 317
 	*/
318 318
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
319
-		if (! $cid) {
319
+		if (!$cid) {
320 320
 			$cid = md5(uniqid(time()));
321 321
 		}
322 322
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	* @access   private
452 452
 	*/
453 453
     function parseRequest($headers, $data) {
454
-		$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
454
+		$this->debug('Entering parseRequest() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
455 455
 		$this->requestAttachments = array();
456 456
 		if (strstr($headers['content-type'], 'multipart/related')) {
457 457
 			$this->debug('Decode multipart/related');
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			foreach ($headers as $k => $v) {
460 460
 				$input .= "$k: $v\r\n";
461 461
 			}
462
-			$params['input'] = $input . "\r\n" . $data;
462
+			$params['input'] = $input."\r\n".$data;
463 463
 			$params['include_bodies'] = true;
464 464
 			$params['decode_bodies'] = true;
465 465
 			$params['decode_headers'] = true;
@@ -468,10 +468,10 @@  discard block
 block discarded – undo
468 468
 
469 469
 			foreach ($structure->parts as $part) {
470 470
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
471
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
471
+					$this->debug('Have root part of type '.$part->headers['content-type']);
472 472
 					$return = parent::parseRequest($part->headers, $part->body);
473 473
 				} else {
474
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
474
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
475 475
 					$info['data'] = $part->body;
476 476
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
477 477
 					$info['contenttype'] = $part->headers['content-type'];
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.wsdl.php 1 patch
Spacing   +205 added lines, -207 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	var $proxypassword = '';
48 48
 	var $timeout = 0;
49 49
 	var $response_timeout = 30;
50
-	var $curl_options = array();	// User-specified cURL options
51
-	var $use_curl = false;			// whether to always try to use cURL
50
+	var $curl_options = array(); // User-specified cURL options
51
+	var $use_curl = false; // whether to always try to use cURL
52 52
 	// for HTTP authentication
53
-	var $username = '';				// Username for HTTP authentication
54
-	var $password = '';				// Password for HTTP authentication
55
-	var $authtype = '';				// Type of HTTP authentication
56
-	var $certRequest = array();		// Certificate for HTTP SSL authentication
53
+	var $username = ''; // Username for HTTP authentication
54
+	var $password = ''; // Password for HTTP authentication
55
+	var $authtype = ''; // Type of HTTP authentication
56
+	var $certRequest = array(); // Certificate for HTTP SSL authentication
57 57
 
58 58
     /**
59 59
      * constructor
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param boolean $use_curl try to use cURL
70 70
      * @access public
71 71
      */
72
-    function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
72
+    function wsdl($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false) {
73 73
 		parent::nusoap_base();
74 74
 		$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
75 75
         $this->proxyhost = $proxyhost;
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
     		// Schema imports
106 106
     		foreach ($this->schemas as $ns => $list) {
107 107
     			foreach ($list as $xs) {
108
-					$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
108
+					$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
109 109
 		            foreach ($xs->imports as $ns2 => $list2) {
110 110
 		                for ($ii = 0; $ii < count($list2); $ii++) {
111
-		                	if (! $list2[$ii]['loaded']) {
111
+		                	if (!$list2[$ii]['loaded']) {
112 112
 		                		$this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
113 113
 		                		$url = $list2[$ii]['location'];
114 114
 								if ($url != '') {
115 115
 									$urlparts = parse_url($url);
116 116
 									if (!isset($urlparts['host'])) {
117
-										$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
118
-												substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
117
+										$url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : '').
118
+												substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path'];
119 119
 									}
120
-									if (! in_array($url, $imported_urls)) {
120
+									if (!in_array($url, $imported_urls)) {
121 121
 					                	$this->parseWSDL($url);
122 122
 				                		$imported++;
123 123
 				                		$imported_urls[] = $url;
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
     			}
132 132
     		}
133 133
     		// WSDL imports
134
-			$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
134
+			$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
135 135
             foreach ($this->import as $ns => $list) {
136 136
                 for ($ii = 0; $ii < count($list); $ii++) {
137
-                	if (! $list[$ii]['loaded']) {
137
+                	if (!$list[$ii]['loaded']) {
138 138
                 		$this->import[$ns][$ii]['loaded'] = true;
139 139
                 		$url = $list[$ii]['location'];
140 140
 						if ($url != '') {
141 141
 							$urlparts = parse_url($url);
142 142
 							if (!isset($urlparts['host'])) {
143
-								$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
144
-										substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
143
+								$url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : '').
144
+										substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path'];
145 145
 							}
146
-							if (! in_array($url, $imported_urls)) {
146
+							if (!in_array($url, $imported_urls)) {
147 147
 			                	$this->parseWSDL($url);
148 148
 		                		$imported++;
149 149
 		                		$imported_urls[] = $url;
@@ -156,30 +156,28 @@  discard block
 block discarded – undo
156 156
             }
157 157
 		}
158 158
         // add new data to operation data
159
-        foreach($this->bindings as $binding => $bindingData) {
159
+        foreach ($this->bindings as $binding => $bindingData) {
160 160
             if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
161
-                foreach($bindingData['operations'] as $operation => $data) {
162
-                    $this->debug('post-parse data gathering for ' . $operation);
161
+                foreach ($bindingData['operations'] as $operation => $data) {
162
+                    $this->debug('post-parse data gathering for '.$operation);
163 163
                     $this->bindings[$binding]['operations'][$operation]['input'] =
164 164
 						isset($this->bindings[$binding]['operations'][$operation]['input']) ?
165
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
166
-						$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
165
+						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input'];
167 166
                     $this->bindings[$binding]['operations'][$operation]['output'] =
168 167
 						isset($this->bindings[$binding]['operations'][$operation]['output']) ?
169
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
170
-						$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
171
-                    if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
172
-						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
168
+						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output'];
169
+                    if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) {
170
+						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']];
173 171
 					}
174
-					if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
175
-                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
172
+					if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) {
173
+                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']];
176 174
                     }
177 175
                     // Set operation style if necessary, but do not override one already provided
178 176
 					if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
179 177
                         $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
180 178
                     }
181 179
                     $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
182
-                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
180
+                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : '';
183 181
                     $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
184 182
                 }
185 183
             }
@@ -205,13 +203,13 @@  discard block
 block discarded – undo
205 203
         $wsdl_props = parse_url($wsdl);
206 204
 
207 205
         if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
208
-            $this->debug('getting WSDL http(s) URL ' . $wsdl);
206
+            $this->debug('getting WSDL http(s) URL '.$wsdl);
209 207
         	// get wsdl
210 208
 	        $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
211 209
 			$tr->request_method = 'GET';
212 210
 			$tr->useSOAPAction = false;
213
-			if($this->proxyhost && $this->proxyport){
214
-				$tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
211
+			if ($this->proxyhost && $this->proxyport) {
212
+				$tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
215 213
 			}
216 214
 			if ($this->authtype != '') {
217 215
 				$tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
@@ -222,8 +220,8 @@  discard block
 block discarded – undo
222 220
 			//$this->debug("WSDL response\n" . $tr->incoming_payload);
223 221
 			$this->appendDebug($tr->getDebug());
224 222
 			// catch errors
225
-			if($err = $tr->getError() ){
226
-				$errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err;
223
+			if ($err = $tr->getError()) {
224
+				$errstr = 'Getting '.$wsdl.' - HTTP ERROR: '.$err;
227 225
 				$this->debug($errstr);
228 226
 	            $this->setError($errstr);
229 227
 				unset($tr);
@@ -234,11 +232,11 @@  discard block
 block discarded – undo
234 232
         } else {
235 233
             // $wsdl is not http(s), so treat it as a file URL or plain file path
236 234
         	if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
237
-        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
235
+        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'].':'.$wsdl_props['path']) : $wsdl_props['path'];
238 236
         	} else {
239 237
         		$path = $wsdl;
240 238
         	}
241
-            $this->debug('getting WSDL file ' . $path);
239
+            $this->debug('getting WSDL file '.$path);
242 240
             if ($fp = @fopen($path, 'r')) {
243 241
                 $wsdl_string = '';
244 242
                 while ($data = fread($fp, 32768)) {
@@ -274,7 +272,7 @@  discard block
 block discarded – undo
274 272
                 xml_error_string(xml_get_error_code($this->parser))
275 273
                 );
276 274
             $this->debug($errstr);
277
-			$this->debug("XML payload:\n" . $wsdl_string);
275
+			$this->debug("XML payload:\n".$wsdl_string);
278 276
             $this->setError($errstr);
279 277
             return false;
280 278
         }
@@ -282,7 +280,7 @@  discard block
 block discarded – undo
282 280
         xml_parser_free($this->parser);
283 281
         $this->debug('Parsing WSDL done');
284 282
 		// catch wsdl parse errors
285
-		if($this->getError()){
283
+		if ($this->getError()) {
286 284
 			return false;
287 285
 		}
288 286
         return true;
@@ -320,21 +318,21 @@  discard block
 block discarded – undo
320 318
             // process attributes
321 319
             if (count($attrs) > 0) {
322 320
 				// register namespace declarations
323
-                foreach($attrs as $k => $v) {
324
-                    if (preg_match('/^xmlns/',$k)) {
321
+                foreach ($attrs as $k => $v) {
322
+                    if (preg_match('/^xmlns/', $k)) {
325 323
                         if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
326 324
                             $this->namespaces[$ns_prefix] = $v;
327 325
                         } else {
328
-                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
326
+                            $this->namespaces['ns'.(count($this->namespaces) + 1)] = $v;
329 327
                         }
330 328
                         if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
331 329
                             $this->XMLSchemaVersion = $v;
332
-                            $this->namespaces['xsi'] = $v . '-instance';
330
+                            $this->namespaces['xsi'] = $v.'-instance';
333 331
                         }
334 332
                     }
335 333
                 }
336 334
                 // expand each attribute prefix to its namespace
337
-                foreach($attrs as $k => $v) {
335
+                foreach ($attrs as $k => $v) {
338 336
                     $k = strpos($k, ':') ? $this->expandQname($k) : $k;
339 337
                     if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
340 338
                         $v = strpos($v, ':') ? $this->expandQname($v) : $v;
@@ -360,12 +358,12 @@  discard block
 block discarded – undo
360 358
                 case 'message':
361 359
                     if ($name == 'part') {
362 360
 			            if (isset($attrs['type'])) {
363
-		                    $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
361
+		                    $this->debug("msg ".$this->currentMessage.": found part (with type) $attrs[name]: ".implode(',', $attrs));
364 362
 		                    $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
365 363
             			}
366 364
 			            if (isset($attrs['element'])) {
367
-		                    $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
368
-			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
365
+		                    $this->debug("msg ".$this->currentMessage.": found part (with element) $attrs[name]: ".implode(',', $attrs));
366
+			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'].'^';
369 367
 			            }
370 368
         			}
371 369
         			break;
@@ -434,15 +432,15 @@  discard block
 block discarded – undo
434 432
 					switch ($name) {
435 433
 					    case 'port':
436 434
 					        $this->currentPort = $attrs['name'];
437
-					        $this->debug('current port: ' . $this->currentPort);
435
+					        $this->debug('current port: '.$this->currentPort);
438 436
 					        $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
439 437
 
440 438
 					        break;
441 439
 					    case 'address':
442 440
 					        $this->ports[$this->currentPort]['location'] = $attrs['location'];
443 441
 					        $this->ports[$this->currentPort]['bindingType'] = $namespace;
444
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
445
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
442
+					        $this->bindings[$this->ports[$this->currentPort]['binding']]['bindingType'] = $namespace;
443
+					        $this->bindings[$this->ports[$this->currentPort]['binding']]['endpoint'] = $attrs['location'];
446 444
 					        break;
447 445
 					}
448 446
 					break;
@@ -452,13 +450,13 @@  discard block
 block discarded – undo
452 450
 			case 'import':
453 451
 			    if (isset($attrs['location'])) {
454 452
                     $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
455
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
453
+                    $this->debug('parsing import '.$attrs['namespace'].' - '.$attrs['location'].' ('.count($this->import[$attrs['namespace']]).')');
456 454
 				} else {
457 455
                     $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
458
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
459
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
456
+					if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
457
+						$this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace'];
460 458
 					}
461
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
459
+                    $this->debug('parsing import '.$attrs['namespace'].' - [no location] ('.count($this->import[$attrs['namespace']]).')');
462 460
 				}
463 461
 				break;
464 462
 			//wait for schema
@@ -485,13 +483,13 @@  discard block
 block discarded – undo
485 483
 					}
486 484
 					$this->status = 'binding';
487 485
 					$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
488
-					$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
486
+					$this->debug("current binding: $this->currentBinding of portType: ".$attrs['type']);
489 487
 				}
490 488
 				break;
491 489
 			case 'service':
492 490
 				$this->serviceName = $attrs['name'];
493 491
 				$this->status = 'service';
494
-				$this->debug('current service: ' . $this->serviceName);
492
+				$this->debug('current service: '.$this->serviceName);
495 493
 				break;
496 494
 			case 'definitions':
497 495
 				foreach ($attrs as $name => $value) {
@@ -509,7 +507,7 @@  discard block
 block discarded – undo
509 507
 	* @param string $name element name
510 508
 	* @access private
511 509
 	*/
512
-	function end_element($parser, $name){
510
+	function end_element($parser, $name) {
513 511
 		// unset schema status
514 512
 		if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
515 513
 			$this->status = "";
@@ -594,8 +592,8 @@  discard block
 block discarded – undo
594 592
 		}
595 593
 		$this->debug("getOperations for port '$portName' bindingType $bindingType");
596 594
 		// loop thru ports
597
-		foreach($this->ports as $port => $portData) {
598
-			$this->debug("getOperations checking port $port bindingType " . $portData['bindingType']);
595
+		foreach ($this->ports as $port => $portData) {
596
+			$this->debug("getOperations checking port $port bindingType ".$portData['bindingType']);
599 597
 			if ($portName == '' || $port == $portName) {
600 598
 				// binding type of port matches parameter
601 599
 				if ($portData['bindingType'] == $bindingType) {
@@ -603,8 +601,8 @@  discard block
 block discarded – undo
603 601
 					//$this->debug("port data: " . $this->varDump($portData));
604 602
 					//$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
605 603
 					// merge bindings
606
-					if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
607
-						$ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
604
+					if (isset($this->bindings[$portData['binding']]['operations'])) {
605
+						$ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']);
608 606
 					}
609 607
 				}
610 608
 			}
@@ -631,15 +629,15 @@  discard block
 block discarded – undo
631 629
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
632 630
 		}
633 631
 		// loop thru ports
634
-		foreach($this->ports as $port => $portData) {
632
+		foreach ($this->ports as $port => $portData) {
635 633
 			// binding type of port matches parameter
636 634
 			if ($portData['bindingType'] == $bindingType) {
637 635
 				// get binding
638 636
 				//foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
639
-				foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
637
+				foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) {
640 638
 					// note that we could/should also check the namespace here
641 639
 					if ($operation == $bOperation) {
642
-						$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
640
+						$opData = $this->bindings[$portData['binding']]['operations'][$operation];
643 641
 					    return $opData;
644 642
 					}
645 643
 				}
@@ -662,11 +660,11 @@  discard block
 block discarded – undo
662 660
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
663 661
 		}
664 662
 		// loop thru ports
665
-		foreach($this->ports as $port => $portData) {
663
+		foreach ($this->ports as $port => $portData) {
666 664
 			// binding type of port matches parameter
667 665
 			if ($portData['bindingType'] == $bindingType) {
668 666
 				// loop through operations for the binding
669
-				foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
667
+				foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) {
670 668
 					if ($opData['soapAction'] == $soapAction) {
671 669
 					    return $opData;
672 670
 					}
@@ -695,7 +693,7 @@  discard block
 block discarded – undo
695 693
     */
696 694
 	function getTypeDef($type, $ns) {
697 695
 		$this->debug("in getTypeDef: type=$type, ns=$ns");
698
-		if ((! $ns) && isset($this->namespaces['tns'])) {
696
+		if ((!$ns) && isset($this->namespaces['tns'])) {
699 697
 			$ns = $this->namespaces['tns'];
700 698
 			$this->debug("in getTypeDef: type namespace forced to $ns");
701 699
 		}
@@ -753,7 +751,7 @@  discard block
 block discarded – undo
753 751
     *
754 752
     * @access private
755 753
     */
756
-    function webDescription(){
754
+    function webDescription() {
757 755
     	global $HTTP_SERVER_VARS;
758 756
 
759 757
 		if (isset($_SERVER)) {
@@ -847,19 +845,19 @@  discard block
 block discarded – undo
847 845
 				<p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
848 846
 				Click on an operation name to view it&apos;s details.</p>
849 847
 				<ul>';
850
-				foreach($this->getOperations() as $op => $data){
848
+				foreach ($this->getOperations() as $op => $data) {
851 849
 				    $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
852 850
 				    // create hidden div
853 851
 				    $b .= "<div id='$op' class='hidden'>
854 852
 				    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
855
-				    foreach($data as $donnie => $marie){ // loop through opdata
856
-						if($donnie == 'input' || $donnie == 'output'){ // show input/output data
853
+				    foreach ($data as $donnie => $marie) { // loop through opdata
854
+						if ($donnie == 'input' || $donnie == 'output') { // show input/output data
857 855
 						    $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
858
-						    foreach($marie as $captain => $tenille){ // loop through data
859
-								if($captain == 'parts'){ // loop thru parts
856
+						    foreach ($marie as $captain => $tenille) { // loop through data
857
+								if ($captain == 'parts') { // loop thru parts
860 858
 								    $b .= "&nbsp;&nbsp;$captain:<br>";
861 859
 					                //if(is_array($tenille)){
862
-								    	foreach($tenille as $joanie => $chachi){
860
+								    	foreach ($tenille as $joanie => $chachi) {
863 861
 											$b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
864 862
 								    	}
865 863
 					        		//}
@@ -891,31 +889,31 @@  discard block
 block discarded – undo
891 889
 	{
892 890
 		$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
893 891
 		$xml .= "\n<definitions";
894
-		foreach($this->namespaces as $k => $v) {
892
+		foreach ($this->namespaces as $k => $v) {
895 893
 			$xml .= " xmlns:$k=\"$v\"";
896 894
 		}
897 895
 		// 10.9.02 - add poulter fix for wsdl and tns declarations
898 896
 		if (isset($this->namespaces['wsdl'])) {
899
-			$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
897
+			$xml .= " xmlns=\"".$this->namespaces['wsdl']."\"";
900 898
 		}
901 899
 		if (isset($this->namespaces['tns'])) {
902
-			$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
900
+			$xml .= " targetNamespace=\"".$this->namespaces['tns']."\"";
903 901
 		}
904 902
 		$xml .= '>';
905 903
 		// imports
906 904
 		if (sizeof($this->import) > 0) {
907
-			foreach($this->import as $ns => $list) {
905
+			foreach ($this->import as $ns => $list) {
908 906
 				foreach ($list as $ii) {
909 907
 					if ($ii['location'] != '') {
910
-						$xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
908
+						$xml .= '<import location="'.$ii['location'].'" namespace="'.$ns.'" />';
911 909
 					} else {
912
-						$xml .= '<import namespace="' . $ns . '" />';
910
+						$xml .= '<import namespace="'.$ns.'" />';
913 911
 					}
914 912
 				}
915 913
 			}
916 914
 		}
917 915
 		// types
918
-		if (count($this->schemas)>=1) {
916
+		if (count($this->schemas) >= 1) {
919 917
 			$xml .= "\n<types>\n";
920 918
 			foreach ($this->schemas as $ns => $list) {
921 919
 				foreach ($list as $xs) {
@@ -926,10 +924,10 @@  discard block
 block discarded – undo
926 924
 		}
927 925
 		// messages
928 926
 		if (count($this->messages) >= 1) {
929
-			foreach($this->messages as $msgName => $msgParts) {
930
-				$xml .= "\n<message name=\"" . $msgName . '">';
931
-				if(is_array($msgParts)){
932
-					foreach($msgParts as $partName => $partType) {
927
+			foreach ($this->messages as $msgName => $msgParts) {
928
+				$xml .= "\n<message name=\"".$msgName.'">';
929
+				if (is_array($msgParts)) {
930
+					foreach ($msgParts as $partName => $partType) {
933 931
 						// print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
934 932
 						if (strpos($partType, ':')) {
935 933
 						    $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
@@ -937,7 +935,7 @@  discard block
 block discarded – undo
937 935
 						    // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
938 936
 						    $typePrefix = 'xsd';
939 937
 						} else {
940
-						    foreach($this->typemap as $ns => $types) {
938
+						    foreach ($this->typemap as $ns => $types) {
941 939
 						        if (isset($types[$partType])) {
942 940
 						            $typePrefix = $this->getPrefixFromNamespace($ns);
943 941
 						        }
@@ -957,7 +955,7 @@  discard block
 block discarded – undo
957 955
 						} else {
958 956
 							$elementortype = 'type';
959 957
 						}
960
-						$xml .= "\n" . '  <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
958
+						$xml .= "\n".'  <part name="'.$partName.'" '.$elementortype.'="'.$typePrefix.':'.$localPart.'" />';
961 959
 					}
962 960
 				}
963 961
 				$xml .= '</message>';
@@ -967,54 +965,54 @@  discard block
 block discarded – undo
967 965
 		if (count($this->bindings) >= 1) {
968 966
 			$binding_xml = '';
969 967
 			$portType_xml = '';
970
-			foreach($this->bindings as $bindingName => $attrs) {
971
-				$binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
972
-				$binding_xml .= "\n" . '  <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
973
-				$portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
974
-				foreach($attrs['operations'] as $opName => $opParts) {
975
-					$binding_xml .= "\n" . '  <operation name="' . $opName . '">';
976
-					$binding_xml .= "\n" . '    <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
968
+			foreach ($this->bindings as $bindingName => $attrs) {
969
+				$binding_xml .= "\n<binding name=\"".$bindingName.'" type="tns:'.$attrs['portType'].'">';
970
+				$binding_xml .= "\n".'  <soap:binding style="'.$attrs['style'].'" transport="'.$attrs['transport'].'"/>';
971
+				$portType_xml .= "\n<portType name=\"".$attrs['portType'].'">';
972
+				foreach ($attrs['operations'] as $opName => $opParts) {
973
+					$binding_xml .= "\n".'  <operation name="'.$opName.'">';
974
+					$binding_xml .= "\n".'    <soap:operation soapAction="'.$opParts['soapAction'].'" style="'.$opParts['style'].'"/>';
977 975
 					if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
978
-						$enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
976
+						$enc_style = ' encodingStyle="'.$opParts['input']['encodingStyle'].'"';
979 977
 					} else {
980 978
 						$enc_style = '';
981 979
 					}
982
-					$binding_xml .= "\n" . '    <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
980
+					$binding_xml .= "\n".'    <input><soap:body use="'.$opParts['input']['use'].'" namespace="'.$opParts['input']['namespace'].'"'.$enc_style.'/></input>';
983 981
 					if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
984
-						$enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
982
+						$enc_style = ' encodingStyle="'.$opParts['output']['encodingStyle'].'"';
985 983
 					} else {
986 984
 						$enc_style = '';
987 985
 					}
988
-					$binding_xml .= "\n" . '    <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
989
-					$binding_xml .= "\n" . '  </operation>';
990
-					$portType_xml .= "\n" . '  <operation name="' . $opParts['name'] . '"';
986
+					$binding_xml .= "\n".'    <output><soap:body use="'.$opParts['output']['use'].'" namespace="'.$opParts['output']['namespace'].'"'.$enc_style.'/></output>';
987
+					$binding_xml .= "\n".'  </operation>';
988
+					$portType_xml .= "\n".'  <operation name="'.$opParts['name'].'"';
991 989
 					if (isset($opParts['parameterOrder'])) {
992
-					    $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
990
+					    $portType_xml .= ' parameterOrder="'.$opParts['parameterOrder'].'"';
993 991
 					}
994 992
 					$portType_xml .= '>';
995
-					if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
996
-						$portType_xml .= "\n" . '    <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
993
+					if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
994
+						$portType_xml .= "\n".'    <documentation>'.htmlspecialchars($opParts['documentation']).'</documentation>';
997 995
 					}
998
-					$portType_xml .= "\n" . '    <input message="tns:' . $opParts['input']['message'] . '"/>';
999
-					$portType_xml .= "\n" . '    <output message="tns:' . $opParts['output']['message'] . '"/>';
1000
-					$portType_xml .= "\n" . '  </operation>';
996
+					$portType_xml .= "\n".'    <input message="tns:'.$opParts['input']['message'].'"/>';
997
+					$portType_xml .= "\n".'    <output message="tns:'.$opParts['output']['message'].'"/>';
998
+					$portType_xml .= "\n".'  </operation>';
1001 999
 				}
1002
-				$portType_xml .= "\n" . '</portType>';
1003
-				$binding_xml .= "\n" . '</binding>';
1000
+				$portType_xml .= "\n".'</portType>';
1001
+				$binding_xml .= "\n".'</binding>';
1004 1002
 			}
1005
-			$xml .= $portType_xml . $binding_xml;
1003
+			$xml .= $portType_xml.$binding_xml;
1006 1004
 		}
1007 1005
 		// services
1008
-		$xml .= "\n<service name=\"" . $this->serviceName . '">';
1006
+		$xml .= "\n<service name=\"".$this->serviceName.'">';
1009 1007
 		if (count($this->ports) >= 1) {
1010
-			foreach($this->ports as $pName => $attrs) {
1011
-				$xml .= "\n" . '  <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
1012
-				$xml .= "\n" . '    <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
1013
-				$xml .= "\n" . '  </port>';
1008
+			foreach ($this->ports as $pName => $attrs) {
1009
+				$xml .= "\n".'  <port name="'.$pName.'" binding="tns:'.$attrs['binding'].'">';
1010
+				$xml .= "\n".'    <soap:address location="'.$attrs['location'].($debug ? '?debug=1' : '').'"/>';
1011
+				$xml .= "\n".'  </port>';
1014 1012
 			}
1015 1013
 		}
1016
-		$xml .= "\n" . '</service>';
1017
-		return $xml . "\n</definitions>";
1014
+		$xml .= "\n".'</service>';
1015
+		return $xml."\n</definitions>";
1018 1016
 	}
1019 1017
 
1020 1018
 	/**
@@ -1111,7 +1109,7 @@  discard block
 block discarded – undo
1111 1109
 	 */
1112 1110
 	function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') {
1113 1111
 		$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
1114
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
1112
+		$this->appendDebug('parameters='.$this->varDump($parameters));
1115 1113
 
1116 1114
 		if ($direction != 'input' && $direction != 'output') {
1117 1115
 			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
@@ -1119,8 +1117,8 @@  discard block
 block discarded – undo
1119 1117
 			return false;
1120 1118
 		}
1121 1119
 		if (!$opData = $this->getOperationData($operation, $bindingType)) {
1122
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
1123
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
1120
+			$this->debug('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType);
1121
+			$this->setError('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType);
1124 1122
 			return false;
1125 1123
 		}
1126 1124
 		$this->debug('in serializeRPCParameters: opData:');
@@ -1128,7 +1126,7 @@  discard block
 block discarded – undo
1128 1126
 
1129 1127
 		// Get encoding style for output and set to current
1130 1128
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1131
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1129
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1132 1130
 			$encodingStyle = $opData['output']['encodingStyle'];
1133 1131
 			$enc_style = $encodingStyle;
1134 1132
 		}
@@ -1213,7 +1211,7 @@  discard block
 block discarded – undo
1213 1211
 	function serializeParameters($operation, $direction, $parameters)
1214 1212
 	{
1215 1213
 		$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
1216
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
1214
+		$this->appendDebug('parameters='.$this->varDump($parameters));
1217 1215
 
1218 1216
 		if ($direction != 'input' && $direction != 'output') {
1219 1217
 			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
@@ -1221,8 +1219,8 @@  discard block
 block discarded – undo
1221 1219
 			return false;
1222 1220
 		}
1223 1221
 		if (!$opData = $this->getOperationData($operation)) {
1224
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
1225
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
1222
+			$this->debug('Unable to retrieve WSDL data for operation: '.$operation);
1223
+			$this->setError('Unable to retrieve WSDL data for operation: '.$operation);
1226 1224
 			return false;
1227 1225
 		}
1228 1226
 		$this->debug('opData:');
@@ -1230,7 +1228,7 @@  discard block
 block discarded – undo
1230 1228
 
1231 1229
 		// Get encoding style for output and set to current
1232 1230
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1233
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1231
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1234 1232
 			$encodingStyle = $opData['output']['encodingStyle'];
1235 1233
 			$enc_style = $encodingStyle;
1236 1234
 		}
@@ -1241,14 +1239,14 @@  discard block
 block discarded – undo
1241 1239
 
1242 1240
 			$use = $opData[$direction]['use'];
1243 1241
 			$this->debug("use=$use");
1244
-			$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
1242
+			$this->debug('got '.count($opData[$direction]['parts']).' part(s)');
1245 1243
 			if (is_array($parameters)) {
1246 1244
 				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
1247
-				$this->debug('have ' . $parametersArrayType . ' parameters');
1248
-				foreach($opData[$direction]['parts'] as $name => $type) {
1245
+				$this->debug('have '.$parametersArrayType.' parameters');
1246
+				foreach ($opData[$direction]['parts'] as $name => $type) {
1249 1247
 					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
1250 1248
 					// Track encoding style
1251
-					if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1249
+					if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1252 1250
 						$encodingStyle = $opData[$direction]['encodingStyle'];
1253 1251
 						$enc_style = $encodingStyle;
1254 1252
 					} else {
@@ -1289,18 +1287,18 @@  discard block
 block discarded – undo
1289 1287
 	 * @return string value serialized as an XML string
1290 1288
 	 * @access private
1291 1289
 	 */
1292
-	function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
1290
+	function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false)
1293 1291
 	{
1294
-		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
1295
-		$this->appendDebug("value=" . $this->varDump($value));
1296
-		if($use == 'encoded' && $encodingStyle) {
1297
-			$encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
1292
+		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=".($unqualified ? "unqualified" : "qualified"));
1293
+		$this->appendDebug("value=".$this->varDump($value));
1294
+		if ($use == 'encoded' && $encodingStyle) {
1295
+			$encodingStyle = ' SOAP-ENV:encodingStyle="'.$encodingStyle.'"';
1298 1296
 		}
1299 1297
 
1300 1298
 		// if a soapval has been supplied, let its type override the WSDL
1301 1299
     	if (is_object($value) && get_class($value) == 'soapval') {
1302 1300
     		if ($value->type_ns) {
1303
-    			$type = $value->type_ns . ':' . $value->type;
1301
+    			$type = $value->type_ns.':'.$value->type;
1304 1302
 		    	$forceType = true;
1305 1303
 		    	$this->debug("in serializeType: soapval overrides type to $type");
1306 1304
     		} elseif ($value->type) {
@@ -1319,7 +1317,7 @@  discard block
 block discarded – undo
1319 1317
 	    			$value['!'] = $value;
1320 1318
 	    		}
1321 1319
 	    		foreach ($attrs as $n => $v) {
1322
-	    			$value['!' . $n] = $v;
1320
+	    			$value['!'.$n] = $v;
1323 1321
 	    		}
1324 1322
 		    	$this->debug("in serializeType: soapval provides attributes");
1325 1323
 		    }
@@ -1337,7 +1335,7 @@  discard block
 block discarded – undo
1337 1335
 				$this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
1338 1336
 			}
1339 1337
 
1340
-			if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
1338
+			if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') {
1341 1339
 				$this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
1342 1340
 				if ($unqualified && $use == 'literal') {
1343 1341
 					$elementNS = " xmlns=\"\"";
@@ -1350,7 +1348,7 @@  discard block
 block discarded – undo
1350 1348
 						$xml = "<$name$elementNS/>";
1351 1349
 					} else {
1352 1350
 						// TODO: depends on nillable, which should be checked before calling this method
1353
-						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
1351
+						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>";
1354 1352
 					}
1355 1353
 					$this->debug("in serializeType: returning: $xml");
1356 1354
 					return $xml;
@@ -1360,7 +1358,7 @@  discard block
 block discarded – undo
1360 1358
 					return $this->serialize_val($value, $name, false, false, false, false, $use);
1361 1359
 				}
1362 1360
 		    	if ($uqType == 'boolean') {
1363
-		    		if ((is_string($value) && $value == 'false') || (! $value)) {
1361
+		    		if ((is_string($value) && $value == 'false') || (!$value)) {
1364 1362
 						$value = 'false';
1365 1363
 					} else {
1366 1364
 						$value = 'true';
@@ -1378,12 +1376,12 @@  discard block
 block discarded – undo
1378 1376
 				if (!$this->getTypeDef($uqType, $ns)) {
1379 1377
 					if ($use == 'literal') {
1380 1378
 						if ($forceType) {
1381
-							$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
1379
+							$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>";
1382 1380
 						} else {
1383 1381
 							$xml = "<$name$elementNS>$value</$name>";
1384 1382
 						}
1385 1383
 					} else {
1386
-						$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
1384
+						$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>";
1387 1385
 					}
1388 1386
 					$this->debug("in serializeType: returning: $xml");
1389 1387
 					return $xml;
@@ -1393,29 +1391,29 @@  discard block
 block discarded – undo
1393 1391
 				$this->debug('in serializeType: appears to be Apache SOAP type');
1394 1392
 				if ($uqType == 'Map') {
1395 1393
 					$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1396
-					if (! $tt_prefix) {
1394
+					if (!$tt_prefix) {
1397 1395
 						$this->debug('in serializeType: Add namespace for Apache SOAP type');
1398
-						$tt_prefix = 'ns' . rand(1000, 9999);
1396
+						$tt_prefix = 'ns'.rand(1000, 9999);
1399 1397
 						$this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
1400 1398
 						// force this to be added to usedNamespaces
1401 1399
 						$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1402 1400
 					}
1403 1401
 					$contents = '';
1404
-					foreach($value as $k => $v) {
1402
+					foreach ($value as $k => $v) {
1405 1403
 						$this->debug("serializing map element: key $k, value $v");
1406 1404
 						$contents .= '<item>';
1407
-						$contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
1408
-						$contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
1405
+						$contents .= $this->serialize_val($k, 'key', false, false, false, false, $use);
1406
+						$contents .= $this->serialize_val($v, 'value', false, false, false, false, $use);
1409 1407
 						$contents .= '</item>';
1410 1408
 					}
1411 1409
 					if ($use == 'literal') {
1412 1410
 						if ($forceType) {
1413
-							$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
1411
+							$xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\">$contents</$name>";
1414 1412
 						} else {
1415 1413
 							$xml = "<$name>$contents</$name>";
1416 1414
 						}
1417 1415
 					} else {
1418
-						$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
1416
+						$xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\"$encodingStyle>$contents</$name>";
1419 1417
 					}
1420 1418
 					$this->debug("in serializeType: returning: $xml");
1421 1419
 					return $xml;
@@ -1429,13 +1427,13 @@  discard block
 block discarded – undo
1429 1427
 			$ns = '';
1430 1428
 			$uqType = $type;
1431 1429
 		}
1432
-		if(!$typeDef = $this->getTypeDef($uqType, $ns)){
1430
+		if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
1433 1431
 			$this->setError("$type ($uqType) is not a supported type.");
1434 1432
 			$this->debug("in serializeType: $type ($uqType) is not a supported type.");
1435 1433
 			return false;
1436 1434
 		} else {
1437 1435
 			$this->debug("in serializeType: found typeDef");
1438
-			$this->appendDebug('typeDef=' . $this->varDump($typeDef));
1436
+			$this->appendDebug('typeDef='.$this->varDump($typeDef));
1439 1437
 			if (substr($uqType, -1) == '^') {
1440 1438
 				$uqType = substr($uqType, 0, -1);
1441 1439
 			}
@@ -1446,7 +1444,7 @@  discard block
 block discarded – undo
1446 1444
 			return false;
1447 1445
 		}
1448 1446
 		$phpType = $typeDef['phpType'];
1449
-		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
1447
+		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: ".(isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''));
1450 1448
 		// if php type == struct, map value to the <all> element names
1451 1449
 		if ($phpType == 'struct') {
1452 1450
 			if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 					// TODO: depends on minOccurs and nillable
1470 1468
 					$xml = "<$elementName$elementNS/>";
1471 1469
 				} else {
1472
-					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
1470
+					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>";
1473 1471
 				}
1474 1472
 				$this->debug("in serializeType: returning: $xml");
1475 1473
 				return $xml;
@@ -1481,12 +1479,12 @@  discard block
 block discarded – undo
1481 1479
 				$elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
1482 1480
 				if ($use == 'literal') {
1483 1481
 					if ($forceType) {
1484
-						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
1482
+						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">";
1485 1483
 					} else {
1486 1484
 						$xml = "<$elementName$elementNS$elementAttrs>";
1487 1485
 					}
1488 1486
 				} else {
1489
-					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
1487
+					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>";
1490 1488
 				}
1491 1489
 
1492 1490
 				if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') {
@@ -1521,13 +1519,13 @@  discard block
 block discarded – undo
1521 1519
 					// TODO: depends on minOccurs
1522 1520
 					$xml = "<$name$elementNS/>";
1523 1521
 				} else {
1524
-					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
1525
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
1526
-						":Array\" " .
1527
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
1528
-						':arrayType="' .
1529
-						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
1530
-						':' .
1522
+					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".
1523
+						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').
1524
+						":Array\" ".
1525
+						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').
1526
+						':arrayType="'.
1527
+						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])).
1528
+						':'.
1531 1529
 						$this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
1532 1530
 				}
1533 1531
 				$this->debug("in serializeType: returning: $xml");
@@ -1535,8 +1533,8 @@  discard block
 block discarded – undo
1535 1533
 			}
1536 1534
 			if (isset($typeDef['multidimensional'])) {
1537 1535
 				$nv = array();
1538
-				foreach($value as $v) {
1539
-					$cols = ',' . sizeof($v);
1536
+				foreach ($value as $v) {
1537
+					$cols = ','.sizeof($v);
1540 1538
 					$nv = array_merge($nv, $v);
1541 1539
 				}
1542 1540
 				$value = $nv;
@@ -1546,10 +1544,10 @@  discard block
 block discarded – undo
1546 1544
 			if (is_array($value) && sizeof($value) >= 1) {
1547 1545
 				$rows = sizeof($value);
1548 1546
 				$contents = '';
1549
-				foreach($value as $k => $v) {
1547
+				foreach ($value as $k => $v) {
1550 1548
 					//$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
1551 1549
 					//if (strpos($typeDef['arrayType'], ':') ) {
1552
-					if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1550
+					if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1553 1551
 					    $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
1554 1552
 					} else {
1555 1553
 					    $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
@@ -1586,12 +1584,12 @@  discard block
 block discarded – undo
1586 1584
 			}
1587 1585
 			if ($use == 'literal') {
1588 1586
 				if ($forceType) {
1589
-					$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
1587
+					$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>";
1590 1588
 				} else {
1591 1589
 					$xml = "<$name$elementNS>$value</$name>";
1592 1590
 				}
1593 1591
 			} else {
1594
-				$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
1592
+				$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>";
1595 1593
 			}
1596 1594
 		}
1597 1595
 		$this->debug("in serializeType: returning: $xml");
@@ -1635,22 +1633,22 @@  discard block
 block discarded – undo
1635 1633
 				$xvalue = array();
1636 1634
 			}
1637 1635
 			foreach ($typeDef['attrs'] as $aName => $attrs) {
1638
-				if (isset($xvalue['!' . $aName])) {
1639
-					$xname = '!' . $aName;
1636
+				if (isset($xvalue['!'.$aName])) {
1637
+					$xname = '!'.$aName;
1640 1638
 					$this->debug("value provided for attribute $aName with key $xname");
1641 1639
 				} elseif (isset($xvalue[$aName])) {
1642 1640
 					$xname = $aName;
1643 1641
 					$this->debug("value provided for attribute $aName with key $xname");
1644 1642
 				} elseif (isset($attrs['default'])) {
1645
-					$xname = '!' . $aName;
1643
+					$xname = '!'.$aName;
1646 1644
 					$xvalue[$xname] = $attrs['default'];
1647
-					$this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
1645
+					$this->debug('use default value of '.$xvalue[$aName].' for attribute '.$aName);
1648 1646
 				} else {
1649 1647
 					$xname = '';
1650 1648
 					$this->debug("no value provided for attribute $aName");
1651 1649
 				}
1652 1650
 				if ($xname) {
1653
-					$xml .=  " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
1651
+					$xml .= " $aName=\"".$this->expandEntities($xvalue[$xname])."\"";
1654 1652
 				}
1655 1653
 			}
1656 1654
 		} else {
@@ -1671,7 +1669,7 @@  discard block
 block discarded – undo
1671 1669
 	 * @return string value serialized as an XML string
1672 1670
 	 * @access private
1673 1671
 	 */
1674
-	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
1672
+	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) {
1675 1673
 		$this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType");
1676 1674
 		$xml = '';
1677 1675
 		if (isset($typeDef['extensionBase'])) {
@@ -1698,23 +1696,23 @@  discard block
 block discarded – undo
1698 1696
 				$xvalue = array();
1699 1697
 			}
1700 1698
 			// toggle whether all elements are present - ideally should validate against schema
1701
-			if (count($typeDef['elements']) != count($xvalue)){
1699
+			if (count($typeDef['elements']) != count($xvalue)) {
1702 1700
 				$optionals = true;
1703 1701
 			}
1704 1702
 			foreach ($typeDef['elements'] as $eName => $attrs) {
1705 1703
 				if (!isset($xvalue[$eName])) {
1706 1704
 					if (isset($attrs['default'])) {
1707 1705
 						$xvalue[$eName] = $attrs['default'];
1708
-						$this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
1706
+						$this->debug('use default value of '.$xvalue[$eName].' for element '.$eName);
1709 1707
 					}
1710 1708
 				}
1711 1709
 				// if user took advantage of a minOccurs=0, then only serialize named parameters
1712 1710
 				if (isset($optionals)
1713 1711
 				    && (!isset($xvalue[$eName]))
1714
-					&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1715
-					){
1712
+					&& ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1713
+					) {
1716 1714
 					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
1717
-						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
1715
+						$this->debug("apparent error: no value provided for element $eName with minOccurs=".$attrs['minOccurs']);
1718 1716
 					}
1719 1717
 					// do nothing
1720 1718
 					$this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
@@ -1779,15 +1777,15 @@  discard block
 block discarded – undo
1779 1777
 	* @see nusoap_xmlschema
1780 1778
 	* @access public
1781 1779
 	*/
1782
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
1780
+	function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') {
1783 1781
 		if (count($elements) > 0) {
1784 1782
 			$eElements = array();
1785
-	    	foreach($elements as $n => $e){
1783
+	    	foreach ($elements as $n => $e) {
1786 1784
 	            // expand each element
1787 1785
 	            $ee = array();
1788 1786
 	            foreach ($e as $k => $v) {
1789
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1790
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1787
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1788
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1791 1789
 		            $ee[$k] = $v;
1792 1790
 		    	}
1793 1791
 	    		$eElements[$n] = $ee;
@@ -1796,11 +1794,11 @@  discard block
 block discarded – undo
1796 1794
 		}
1797 1795
 
1798 1796
 		if (count($attrs) > 0) {
1799
-	    	foreach($attrs as $n => $a){
1797
+	    	foreach ($attrs as $n => $a) {
1800 1798
 	            // expand each attribute
1801 1799
 	            foreach ($a as $k => $v) {
1802
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1803
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1800
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1801
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1804 1802
 		            $aa[$k] = $v;
1805 1803
 		    	}
1806 1804
 	    		$eAttrs[$n] = $aa;
@@ -1808,11 +1806,11 @@  discard block
 block discarded – undo
1808 1806
 	    	$attrs = $eAttrs;
1809 1807
 		}
1810 1808
 
1811
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1812
-		$arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
1809
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1810
+		$arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
1813 1811
 
1814 1812
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1815
-		$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
1813
+		$this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
1816 1814
 	}
1817 1815
 
1818 1816
 	/**
@@ -1826,8 +1824,8 @@  discard block
 block discarded – undo
1826 1824
 	* @see nusoap_xmlschema
1827 1825
 	* @access public
1828 1826
 	*/
1829
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
1830
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1827
+	function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) {
1828
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1831 1829
 
1832 1830
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1833 1831
 		$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
@@ -1859,7 +1857,7 @@  discard block
 block discarded – undo
1859 1857
 	* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
1860 1858
 	* @access public
1861 1859
 	*/
1862
-	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
1860
+	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') {
1863 1861
 		if ($use == 'encoded' && $encodingStyle == '') {
1864 1862
 			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1865 1863
 		}
@@ -1869,24 +1867,24 @@  discard block
 block discarded – undo
1869 1867
 			foreach ($in as $n => $t) {
1870 1868
 				$elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
1871 1869
 			}
1872
-			$this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
1873
-			$this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
1874
-			$in = array('parameters' => 'tns:' . $name . '^');
1870
+			$this->addComplexType($name.'RequestType', 'complexType', 'struct', 'all', '', $elements);
1871
+			$this->addElement(array('name' => $name, 'type' => $name.'RequestType'));
1872
+			$in = array('parameters' => 'tns:'.$name.'^');
1875 1873
 
1876 1874
 			$elements = array();
1877 1875
 			foreach ($out as $n => $t) {
1878 1876
 				$elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
1879 1877
 			}
1880
-			$this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
1881
-			$this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
1882
-			$out = array('parameters' => 'tns:' . $name . 'Response' . '^');
1878
+			$this->addComplexType($name.'ResponseType', 'complexType', 'struct', 'all', '', $elements);
1879
+			$this->addElement(array('name' => $name.'Response', 'type' => $name.'ResponseType', 'form' => 'qualified'));
1880
+			$out = array('parameters' => 'tns:'.$name.'Response'.'^');
1883 1881
 		}
1884 1882
 
1885 1883
 		// get binding
1886
-		$this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
1884
+		$this->bindings[$this->serviceName.'Binding']['operations'][$name] =
1887 1885
 		array(
1888 1886
 		'name' => $name,
1889
-		'binding' => $this->serviceName . 'Binding',
1887
+		'binding' => $this->serviceName.'Binding',
1890 1888
 		'endpoint' => $this->endpoint,
1891 1889
 		'soapAction' => $soapaction,
1892 1890
 		'style' => $style,
@@ -1894,42 +1892,42 @@  discard block
 block discarded – undo
1894 1892
 			'use' => $use,
1895 1893
 			'namespace' => $namespace,
1896 1894
 			'encodingStyle' => $encodingStyle,
1897
-			'message' => $name . 'Request',
1895
+			'message' => $name.'Request',
1898 1896
 			'parts' => $in),
1899 1897
 		'output' => array(
1900 1898
 			'use' => $use,
1901 1899
 			'namespace' => $namespace,
1902 1900
 			'encodingStyle' => $encodingStyle,
1903
-			'message' => $name . 'Response',
1901
+			'message' => $name.'Response',
1904 1902
 			'parts' => $out),
1905 1903
 		'namespace' => $namespace,
1906 1904
 		'transport' => 'http://schemas.xmlsoap.org/soap/http',
1907 1905
 		'documentation' => $documentation);
1908 1906
 		// add portTypes
1909 1907
 		// add messages
1910
-		if($in)
1908
+		if ($in)
1911 1909
 		{
1912
-			foreach($in as $pName => $pType)
1910
+			foreach ($in as $pName => $pType)
1913 1911
 			{
1914
-				if(strpos($pType,':')) {
1912
+				if (strpos($pType, ':')) {
1915 1913
 					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1916 1914
 				}
1917 1915
 				$this->messages[$name.'Request'][$pName] = $pType;
1918 1916
 			}
1919 1917
 		} else {
1920
-            $this->messages[$name.'Request']= '0';
1918
+            $this->messages[$name.'Request'] = '0';
1921 1919
         }
1922
-		if($out)
1920
+		if ($out)
1923 1921
 		{
1924
-			foreach($out as $pName => $pType)
1922
+			foreach ($out as $pName => $pType)
1925 1923
 			{
1926
-				if(strpos($pType,':')) {
1924
+				if (strpos($pType, ':')) {
1927 1925
 					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1928 1926
 				}
1929 1927
 				$this->messages[$name.'Response'][$pName] = $pType;
1930 1928
 			}
1931 1929
 		} else {
1932
-            $this->messages[$name.'Response']= '0';
1930
+            $this->messages[$name.'Response'] = '0';
1933 1931
         }
1934 1932
 		return true;
1935 1933
 	}
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.nusoap_base.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -183,26 +183,26 @@  discard block
 block discarded – undo
183 183
 	*/
184 184
 	var $typemap = array(
185 185
 	'http://www.w3.org/2001/XMLSchema' => array(
186
-		'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
187
-		'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
188
-		'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
186
+		'string'=>'string', 'boolean'=>'boolean', 'float'=>'double', 'double'=>'double', 'decimal'=>'double',
187
+		'duration'=>'', 'dateTime'=>'string', 'time'=>'string', 'date'=>'string', 'gYearMonth'=>'',
188
+		'gYear'=>'', 'gMonthDay'=>'', 'gDay'=>'', 'gMonth'=>'', 'hexBinary'=>'string', 'base64Binary'=>'string',
189 189
 		// abstract "any" types
190
-		'anyType'=>'string','anySimpleType'=>'string',
190
+		'anyType'=>'string', 'anySimpleType'=>'string',
191 191
 		// derived datatypes
192
-		'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
193
-		'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
194
-		'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
195
-		'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
192
+		'normalizedString'=>'string', 'token'=>'string', 'language'=>'', 'NMTOKEN'=>'', 'NMTOKENS'=>'', 'Name'=>'', 'NCName'=>'', 'ID'=>'',
193
+		'IDREF'=>'', 'IDREFS'=>'', 'ENTITY'=>'', 'ENTITIES'=>'', 'integer'=>'integer', 'nonPositiveInteger'=>'integer',
194
+		'negativeInteger'=>'integer', 'long'=>'integer', 'int'=>'integer', 'short'=>'integer', 'byte'=>'integer', 'nonNegativeInteger'=>'integer',
195
+		'unsignedLong'=>'', 'unsignedInt'=>'', 'unsignedShort'=>'', 'unsignedByte'=>'', 'positiveInteger'=>''),
196 196
 	'http://www.w3.org/2000/10/XMLSchema' => array(
197
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
198
-		'float'=>'double','dateTime'=>'string',
199
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
197
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
198
+		'float'=>'double', 'dateTime'=>'string',
199
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
200 200
 	'http://www.w3.org/1999/XMLSchema' => array(
201
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
202
-		'float'=>'double','dateTime'=>'string',
203
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
201
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
202
+		'float'=>'double', 'dateTime'=>'string',
203
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
204 204
 	'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
205
-	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
205
+	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string', 'array'=>'array', 'Array'=>'array'),
206 206
     'http://xml.apache.org/xml-soap' => array('Map')
207 207
 	);
208 208
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	* @deprecated
215 215
 	* @see	expandEntities
216 216
 	*/
217
-	var $xmlEntities = array('quot' => '"','amp' => '&',
218
-		'lt' => '<','gt' => '>','apos' => "'");
217
+	var $xmlEntities = array('quot' => '"', 'amp' => '&',
218
+		'lt' => '<', 'gt' => '>', 'apos' => "'");
219 219
 
220 220
 	/**
221 221
 	* constructor
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	* @param    string $string debug data
273 273
 	* @access   private
274 274
 	*/
275
-	function debug($string){
275
+	function debug($string) {
276 276
 		if ($this->debugLevel > 0) {
277 277
 			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
278 278
 		}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	* @param    string $string debug data
285 285
 	* @access   public
286 286
 	*/
287
-	function appendDebug($string){
287
+	function appendDebug($string) {
288 288
 		if ($this->debugLevel > 0) {
289 289
 			// it would be nice to use a memory stream here to use
290 290
 			// memory more efficiently
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		while (strpos($this->debug_str, '--')) {
329 329
 			$this->debug_str = str_replace('--', '- -', $this->debug_str);
330 330
 		}
331
-		$ret = "<!--\n" . $this->debug_str . "\n-->";
331
+		$ret = "<!--\n".$this->debug_str."\n-->";
332 332
     	return $ret;
333 333
 	}
334 334
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* @return   mixed error string or false
356 356
 	* @access   public
357 357
 	*/
358
-	function getError(){
359
-		if($this->error_str != ''){
358
+	function getError() {
359
+		if ($this->error_str != '') {
360 360
 			return $this->error_str;
361 361
 		}
362 362
 		return false;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	* @return   boolean $string error string
369 369
 	* @access   private
370 370
 	*/
371
-	function setError($str){
371
+	function setError($str) {
372 372
 		$this->error_str = $str;
373 373
 	}
374 374
 
@@ -404,12 +404,12 @@  discard block
 block discarded – undo
404 404
 	* @return	string	The serialized element, possibly with child elements
405 405
     * @access	public
406 406
 	*/
407
-	function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) {
407
+	function serialize_val($val, $name = false, $type = false, $name_ns = false, $type_ns = false, $attributes = false, $use = 'encoded', $soapval = false) {
408 408
 		$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
409
-		$this->appendDebug('value=' . $this->varDump($val));
410
-		$this->appendDebug('attributes=' . $this->varDump($attributes));
409
+		$this->appendDebug('value='.$this->varDump($val));
410
+		$this->appendDebug('attributes='.$this->varDump($attributes));
411 411
 
412
-    	if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
412
+    	if (is_object($val) && get_class($val) == 'soapval' && (!$soapval)) {
413 413
     		$this->debug("serialize_val: serialize soapval");
414 414
         	$xml = $val->serialize($use);
415 415
 			$this->appendDebug($val->getDebug());
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
         }
420 420
 		// force valid name if necessary
421 421
 		if (is_numeric($name)) {
422
-			$name = '__numeric_' . $name;
423
-		} elseif (! $name) {
422
+			$name = '__numeric_'.$name;
423
+		} elseif (!$name) {
424 424
 			$name = 'noname';
425 425
 		}
426 426
 		// if name has ns, add ns prefix to name
427 427
 		$xmlns = '';
428
-        if($name_ns){
429
-			$prefix = 'nu'.rand(1000,9999);
428
+        if ($name_ns) {
429
+			$prefix = 'nu'.rand(1000, 9999);
430 430
 			$name = $prefix.':'.$name;
431 431
 			$xmlns .= " xmlns:$prefix=\"$name_ns\"";
432 432
 		}
433 433
 		// if type is prefixed, create type prefix
434
-		if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
434
+		if ($type_ns != '' && $type_ns == $this->namespaces['xsd']) {
435 435
 			// need to fix this. shouldn't default to xsd if no ns specified
436 436
 		    // w/o checking against typemap
437 437
 			$type_prefix = 'xsd';
438
-		} elseif($type_ns){
439
-			$type_prefix = 'ns'.rand(1000,9999);
438
+		} elseif ($type_ns) {
439
+			$type_prefix = 'ns'.rand(1000, 9999);
440 440
 			$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
441 441
 		}
442 442
 		// serialize attributes if present
443 443
 		$atts = '';
444
-		if($attributes){
445
-			foreach($attributes as $k => $v){
444
+		if ($attributes) {
445
+			foreach ($attributes as $k => $v) {
446 446
 				$atts .= " $k=\"".$this->expandEntities($v).'"';
447 447
 			}
448 448
 		}
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
         	}
467 467
 		}
468 468
         // serialize if an xsd built-in primitive type
469
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
469
+        if ($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])) {
470 470
     		$this->debug("serialize_val: serialize xsd built-in primitive type");
471 471
         	if (is_bool($val)) {
472 472
         		if ($type == 'boolean') {
473 473
 	        		$val = $val ? 'true' : 'false';
474
-	        	} elseif (! $val) {
474
+	        	} elseif (!$val) {
475 475
 	        		$val = 0;
476 476
 	        	}
477 477
 			} else if (is_string($val)) {
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
         }
490 490
 		// detect type and serialize
491 491
 		$xml = '';
492
-		switch(true) {
492
+		switch (true) {
493 493
 			case (is_bool($val) || $type == 'boolean'):
494 494
 		   		$this->debug("serialize_val: serialize boolean");
495 495
         		if ($type == 'boolean') {
496 496
 	        		$val = $val ? 'true' : 'false';
497
-	        	} elseif (! $val) {
497
+	        	} elseif (!$val) {
498 498
 	        		$val = 0;
499 499
 	        	}
500 500
 				if ($use == 'literal') {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
512 512
 				}
513 513
 				break;
514
-			case (is_float($val)|| is_double($val) || $type == 'float'):
514
+			case (is_float($val) || is_double($val) || $type == 'float'):
515 515
 		   		$this->debug("serialize_val: serialize float");
516 516
 				if ($use == 'literal') {
517 517
 					$xml .= "<$name$xmlns$atts>$val</$name>";
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 					$this->appendDebug($val->getDebug());
537 537
 					$val->clearDebug();
538 538
 		        } else {
539
-					if (! $name) {
539
+					if (!$name) {
540 540
 						$name = get_class($val);
541 541
 						$this->debug("In serialize_val, used class name $name as element name");
542 542
 					} else {
543
-						$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
543
+						$this->debug("In serialize_val, do not override name $name for element name for class ".get_class($val));
544 544
 					}
545
-					foreach(get_object_vars($val) as $k => $v){
546
-						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
545
+					foreach (get_object_vars($val) as $k => $v) {
546
+						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v, $k, false, false, false, false, $use) : $this->serialize_val($v, $k, false, false, false, false, $use);
547 547
 					}
548 548
 				}
549
-				if(isset($type) && isset($type_prefix)){
549
+				if (isset($type) && isset($type_prefix)) {
550 550
 					$type_str = " xsi:type=\"$type_prefix:$type\"";
551 551
 				} else {
552 552
 					$type_str = '';
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
 			case (is_array($val) || $type):
562 562
 				// detect if struct or array
563 563
 				$valueType = $this->isArraySimpleOrStruct($val);
564
-                if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
564
+                if ($valueType == 'arraySimple' || preg_match('/^ArrayOf/', $type)) {
565 565
 			   		$this->debug("serialize_val: serialize array");
566 566
 					$i = 0;
567
-					if(is_array($val) && count($val)> 0){
568
-						foreach($val as $v){
569
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
567
+					if (is_array($val) && count($val) > 0) {
568
+						foreach ($val as $v) {
569
+	                    	if (is_object($v) && get_class($v) == 'soapval') {
570 570
 								$tt_ns = $v->type_ns;
571 571
 								$tt = $v->type;
572 572
 							} elseif (is_array($v)) {
@@ -576,26 +576,26 @@  discard block
 block discarded – undo
576 576
 	                        }
577 577
 							$array_types[$tt] = 1;
578 578
 							// TODO: for literal, the name should be $name
579
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
579
+							$xml .= $this->serialize_val($v, 'item', false, false, false, false, $use);
580 580
 							++$i;
581 581
 						}
582
-						if(count($array_types) > 1){
582
+						if (count($array_types) > 1) {
583 583
 							$array_typename = 'xsd:anyType';
584
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
584
+						} elseif (isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
585 585
 							if ($tt == 'integer') {
586 586
 								$tt = 'int';
587 587
 							}
588 588
 							$array_typename = 'xsd:'.$tt;
589
-						} elseif(isset($tt) && $tt == 'arraySimple'){
589
+						} elseif (isset($tt) && $tt == 'arraySimple') {
590 590
 							$array_typename = 'SOAP-ENC:Array';
591
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
591
+						} elseif (isset($tt) && $tt == 'arrayStruct') {
592 592
 							$array_typename = 'unnamed_struct_use_soapval';
593 593
 						} else {
594 594
 							// if type is prefixed, create type prefix
595
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
596
-								 $array_typename = 'xsd:' . $tt;
595
+							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']) {
596
+								 $array_typename = 'xsd:'.$tt;
597 597
 							} elseif ($tt_ns) {
598
-								$tt_prefix = 'ns' . rand(1000, 9999);
598
+								$tt_prefix = 'ns'.rand(1000, 9999);
599 599
 								$array_typename = "$tt_prefix:$tt";
600 600
 								$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
601 601
 							} else {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 				} else {
626 626
 					// got a struct
627 627
 			   		$this->debug("serialize_val: serialize struct");
628
-					if(isset($type) && isset($type_prefix)){
628
+					if (isset($type) && isset($type_prefix)) {
629 629
 						$type_str = " xsi:type=\"$type_prefix:$type\"";
630 630
 					} else {
631 631
 						$type_str = '';
@@ -635,15 +635,15 @@  discard block
 block discarded – undo
635 635
 					} else {
636 636
 						$xml .= "<$name$xmlns$type_str$atts>";
637 637
 					}
638
-					foreach($val as $k => $v){
638
+					foreach ($val as $k => $v) {
639 639
 						// Apache Map
640 640
 						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
641 641
 							$xml .= '<item>';
642
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
643
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
642
+							$xml .= $this->serialize_val($k, 'key', false, false, false, false, $use);
643
+							$xml .= $this->serialize_val($v, 'value', false, false, false, false, $use);
644 644
 							$xml .= '</item>';
645 645
 						} else {
646
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
646
+							$xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
647 647
 						}
648 648
 					}
649 649
 					$xml .= "</$name>";
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
     * @return string the message
671 671
     * @access public
672 672
     */
673
-    function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
673
+    function serializeEnvelope($body, $headers = false, $namespaces = array(), $style = 'rpc', $use = 'encoded', $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/') {
674 674
     // TODO: add an option to automatically run utf8_encode on $body and $headers
675 675
     // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
676 676
     // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
677 677
 
678
-	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
678
+	$this->debug("In serializeEnvelope length=".strlen($body)." body (max 1000 characters)=".substr($body, 0, 1000)." style=$style use=$use encodingStyle=$encodingStyle");
679 679
 	$this->debug("headers:");
680 680
 	$this->appendDebug($this->varDump($headers));
681 681
 	$this->debug("namespaces:");
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 
684 684
 	// serialize namespaces
685 685
     $ns_string = '';
686
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
686
+	foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
687 687
 		$ns_string .= " xmlns:$k=\"$v\"";
688 688
 	}
689
-	if($encodingStyle) {
689
+	if ($encodingStyle) {
690 690
 		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
691 691
 	}
692 692
 
693 693
 	// serialize headers
694
-	if($headers){
694
+	if ($headers) {
695 695
 		if (is_array($headers)) {
696 696
 			$xml = '';
697 697
 			foreach ($headers as $k => $v) {
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 	// serialize envelope
710 710
 	return
711
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
711
+	'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?'.">".
712 712
 	'<SOAP-ENV:Envelope'.$ns_string.">".
713 713
 	$headers.
714 714
 	"<SOAP-ENV:Body>".
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 * @access public
726 726
 	 * @deprecated
727 727
 	 */
728
-    function formatDump($str){
728
+    function formatDump($str) {
729 729
 		$str = htmlspecialchars($str);
730 730
 		return nl2br($str);
731 731
     }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	* @return	string contracted qname
738 738
 	* @access   private
739 739
 	*/
740
-	function contractQname($qname){
740
+	function contractQname($qname) {
741 741
 		// get element namespace
742 742
 		//$this->xdebug("Contract $qname");
743 743
 		if (strrpos($qname, ':')) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 			$ns = substr($qname, 0, strrpos($qname, ':'));
748 748
 			$p = $this->getPrefixFromNamespace($ns);
749 749
 			if ($p) {
750
-				return $p . ':' . $name;
750
+				return $p.':'.$name;
751 751
 			}
752 752
 			return $qname;
753 753
 		} else {
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	* @return	string expanded qname
763 763
 	* @access   private
764 764
 	*/
765
-	function expandQname($qname){
765
+	function expandQname($qname) {
766 766
 		// get element prefix
767
-		if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
767
+		if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
768 768
 			// get unqualified name
769
-			$name = substr(strstr($qname,':'),1);
769
+			$name = substr(strstr($qname, ':'), 1);
770 770
 			// get ns prefix
771
-			$prefix = substr($qname,0,strpos($qname,':'));
772
-			if(isset($this->namespaces[$prefix])){
771
+			$prefix = substr($qname, 0, strpos($qname, ':'));
772
+			if (isset($this->namespaces[$prefix])) {
773 773
 				return $this->namespaces[$prefix].':'.$name;
774 774
 			} else {
775 775
 				return $qname;
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
     * @return string The local part
788 788
     * @access public
789 789
     */
790
-	function getLocalPart($str){
791
-		if($sstr = strrchr($str,':')){
790
+	function getLocalPart($str) {
791
+		if ($sstr = strrchr($str, ':')) {
792 792
 			// get unqualified name
793
-			return substr( $sstr, 1 );
793
+			return substr($sstr, 1);
794 794
 		} else {
795 795
 			return $str;
796 796
 		}
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
     * @return mixed The prefix or false if there is no prefix
805 805
     * @access public
806 806
     */
807
-	function getPrefix($str){
808
-		if($pos = strrpos($str,':')){
807
+	function getPrefix($str) {
808
+		if ($pos = strrpos($str, ':')) {
809 809
 			// get prefix
810
-			return substr($str,0,$pos);
810
+			return substr($str, 0, $pos);
811 811
 		}
812 812
 		return false;
813 813
 	}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     * @return mixed The namespace, false if no namespace has the specified prefix
820 820
     * @access public
821 821
     */
822
-	function getNamespaceFromPrefix($prefix){
822
+	function getNamespaceFromPrefix($prefix) {
823 823
 		if (isset($this->namespaces[$prefix])) {
824 824
 			return $this->namespaces[$prefix];
825 825
 		}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 			$sec = time();
861 861
 			$usec = 0;
862 862
 		}
863
-		return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
863
+		return strftime('%Y-%m-%d %H:%M:%S', $sec).'.'.sprintf('%06d', $usec);
864 864
 	}
865 865
 
866 866
 	/**
@@ -901,31 +901,31 @@  discard block
 block discarded – undo
901 901
 * @return	mixed ISO 8601 date string or false
902 902
 * @access   public
903 903
 */
904
-function timestamp_to_iso8601($timestamp,$utc=true){
905
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
904
+function timestamp_to_iso8601($timestamp, $utc = true) {
905
+	$datestr = date('Y-m-d\TH:i:sO', $timestamp);
906 906
 	$pos = strrpos($datestr, "+");
907 907
 	if ($pos === FALSE) {
908 908
 		$pos = strrpos($datestr, "-");
909 909
 	}
910 910
 	if ($pos !== FALSE) {
911 911
 		if (strlen($datestr) == $pos + 5) {
912
-			$datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2);
912
+			$datestr = substr($datestr, 0, $pos + 3).':'.substr($datestr, -2);
913 913
 		}
914 914
 	}
915
-	if($utc){
915
+	if ($utc) {
916 916
 		$pattern = '/'.
917
-		'([0-9]{4})-'.	// centuries & years CCYY-
918
-		'([0-9]{2})-'.	// months MM-
919
-		'([0-9]{2})'.	// days DD
920
-		'T'.			// separator T
921
-		'([0-9]{2}):'.	// hours hh:
922
-		'([0-9]{2}):'.	// minutes mm:
923
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
924
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
917
+		'([0-9]{4})-'.// centuries & years CCYY-
918
+		'([0-9]{2})-'.// months MM-
919
+		'([0-9]{2})'.// days DD
920
+		'T'.// separator T
921
+		'([0-9]{2}):'.// hours hh:
922
+		'([0-9]{2}):'.// minutes mm:
923
+		'([0-9]{2})(\.[0-9]*)?'.// seconds ss.ss...
924
+		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
925 925
 		'/';
926 926
 
927
-		if(preg_match($pattern,$datestr,$regs)){
928
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
927
+		if (preg_match($pattern, $datestr, $regs)) {
928
+			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ', $regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6]);
929 929
 		}
930 930
 		return false;
931 931
 	} else {
@@ -940,27 +940,27 @@  discard block
 block discarded – undo
940 940
 * @return	mixed Unix timestamp (int) or false
941 941
 * @access   public
942 942
 */
943
-function iso8601_to_timestamp($datestr){
943
+function iso8601_to_timestamp($datestr) {
944 944
 	$pattern = '/'.
945
-	'([0-9]{4})-'.	// centuries & years CCYY-
946
-	'([0-9]{2})-'.	// months MM-
947
-	'([0-9]{2})'.	// days DD
948
-	'T'.			// separator T
949
-	'([0-9]{2}):'.	// hours hh:
950
-	'([0-9]{2}):'.	// minutes mm:
951
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
952
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
945
+	'([0-9]{4})-'.// centuries & years CCYY-
946
+	'([0-9]{2})-'.// months MM-
947
+	'([0-9]{2})'.// days DD
948
+	'T'.// separator T
949
+	'([0-9]{2}):'.// hours hh:
950
+	'([0-9]{2}):'.// minutes mm:
951
+	'([0-9]{2})(\.[0-9]+)?'.// seconds ss.ss...
952
+	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
953 953
 	'/';
954
-	if(preg_match($pattern,$datestr,$regs)){
954
+	if (preg_match($pattern, $datestr, $regs)) {
955 955
 		// not utc
956
-		if($regs[8] != 'Z'){
957
-			$op = substr($regs[8],0,1);
958
-			$h = substr($regs[8],1,2);
959
-			$m = substr($regs[8],strlen($regs[8])-2,2);
960
-			if($op == '-'){
956
+		if ($regs[8] != 'Z') {
957
+			$op = substr($regs[8], 0, 1);
958
+			$h = substr($regs[8], 1, 2);
959
+			$m = substr($regs[8], strlen($regs[8]) - 2, 2);
960
+			if ($op == '-') {
961 961
 				$regs[4] = $regs[4] + $h;
962 962
 				$regs[5] = $regs[5] + $m;
963
-			} elseif($op == '+'){
963
+			} elseif ($op == '+') {
964 964
 				$regs[4] = $regs[4] - $h;
965 965
 				$regs[5] = $regs[5] - $m;
966 966
 			}
Please login to merge, or discard this patch.
main/inc/lib/add_many_session_to_category_functions.lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
      * @assert () !== ''
22 22
      * @assert ('abc','single') !== ''
23 23
      */
24
-    function search_courses($needle,$type)
24
+    function search_courses($needle, $type)
25 25
     {
26 26
         $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
27 27
 		$xajax_response = new xajaxResponse();
28 28
 		$return = '';
29
-		if(!empty($needle) && !empty($type)) {
29
+		if (!empty($needle) && !empty($type)) {
30 30
 			// xajax send utf8 datas... datas in db can be non-utf8 datas
31 31
 			$charset = api_get_system_encoding();
32 32
 			$needle = api_convert_encoding($needle, $charset, 'utf-8');
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 			$course_list = array();
39 39
 
40 40
 			$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
41
-			while($course = Database :: fetch_array($rs)) {
41
+			while ($course = Database :: fetch_array($rs)) {
42 42
 				$course_list[] = $course['id'];
43
-				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
43
+				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'], ENT_QUOTES).'">'.$course['name'].'</option>';
44 44
 			}
45 45
 			$return .= '</select>';
46
-			$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
46
+			$xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
47 47
 		}
48 48
 		$_SESSION['course_list'] = $course_list;
49 49
 		return $xajax_response;
Please login to merge, or discard this patch.
main/inc/lib/statistics.lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
105 105
         $course_table = Database:: get_main_table(TABLE_MAIN_COURSE);
106 106
         $user_table = Database:: get_main_table(TABLE_MAIN_USER);
107
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
107
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
108 108
         $current_url_id = api_get_current_access_url_id();
109
-        $active_filter = $onlyActive?' AND active=1':'';
110
-        $status_filter = isset($status)?' AND status = '.intval($status):'';
109
+        $active_filter = $onlyActive ? ' AND active=1' : '';
110
+        $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
111 111
 
112 112
         if (api_is_multiple_url_enabled()) {
113 113
             $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     FROM $user_table
132 132
                     WHERE 1=1 $status_filter $active_filter";
133 133
             if (isset ($categoryCode)) {
134
-                $status_filter = isset($status)?' AND status = '.intval($status):'';
134
+                $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
135 135
                 $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
136 136
                         FROM $course_user_table cu, $course_table c
137 137
                         WHERE
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function countSessions()
157 157
     {
158 158
         $session_table = Database :: get_main_table(TABLE_MAIN_SESSION);
159
-        $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
159
+        $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
160 160
         if (api_is_multiple_url_enabled()) {
161 161
             $current_url_id = api_get_current_access_url_id();
162 162
             $sql = "SELECT COUNT(id) AS number
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     public static function getNumberOfActivities()
180 180
     {
181 181
         // Database table definitions
182
-        $track_e_default  = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
182
+        $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
183 183
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
184
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
184
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
185 185
         $current_url_id = api_get_current_access_url_id();
186 186
         if (api_is_multiple_url_enabled()) {
187 187
             $sql = "SELECT count(default_id) AS total_number_of_items
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $from = intval($from);
226 226
         $numberOfItems = intval($numberOfItems);
227 227
 
228
-        if (!in_array($direction, array('ASC','DESC'))) {
228
+        if (!in_array($direction, array('ASC', 'DESC'))) {
229 229
             $direction = 'DESC';
230 230
         }
231 231
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $sql .= " LIMIT $from,$numberOfItems ";
277 277
 
278 278
         $res = Database::query($sql);
279
-        $activities = array ();
279
+        $activities = array();
280 280
         while ($row = Database::fetch_row($res)) {
281 281
 
282 282
             if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $sql = "SELECT code, name FROM $categoryTable
344 344
                 ORDER BY tree_pos";
345 345
         $res = Database::query($sql);
346
-        $categories = array ();
346
+        $categories = array();
347 347
         while ($category = Database::fetch_object($res)) {
348 348
             $categories[$category->code] = $category->name;
349 349
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             $data_max = ($data_max < $value ? $value : $data_max);
365 365
         }
366 366
         reset($data);
367
-        $result = array ();
367
+        $result = array();
368 368
         $delta = $max / $data_max;
369 369
         foreach ($data as $index => $value) {
370 370
             $result[$index] = (int) round($value * $delta);
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
             } else {
399 399
                 $number_label = Statistics::makeSizeString($number);
400 400
             }
401
-            $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0');
401
+            $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0');
402 402
 
403
-            echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'">
403
+            echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'">
404 404
                     <td width="150">'.$subtitle.'</td>
405 405
                     <td width="550">'.Display::bar_progress($percentage, false).'</td>
406 406
                     <td align="right">'.$number_label.'</td>';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 echo '<td align="right"> '.$percentage.'%</td>';
409 409
             }
410 410
             echo '</tr>';
411
-            $i ++;
411
+            $i++;
412 412
         }
413 413
         if ($showTotal) {
414 414
             if (!$isFileSize) {
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
     public static function printLoginStats($type)
429 429
     {
430 430
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
431
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
431
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
432 432
         $current_url_id = api_get_current_access_url_id();
433 433
 
434 434
         $table_url = null;
435 435
         $where_url = null;
436 436
         $now = api_get_utc_datetime();
437
-        $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
437
+        $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
438 438
         if (api_is_multiple_url_enabled()) {
439 439
             $table_url = ", $access_url_rel_user_table";
440 440
             $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
441
-            $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
441
+            $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
442 442
         }
443 443
 
444 444
         $period = get_lang('PeriodMonth');
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
             case 'hour':
454 454
                 $period = get_lang('PeriodHour');
455 455
                 $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
456
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
456
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." GROUP BY stat_date ORDER BY stat_date ";
457 457
                 break;
458 458
             case 'day':
459 459
                 $periodCollection = api_get_week_days_long();
460 460
                 $period = get_lang('PeriodDay');
461 461
                 $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
463 463
                 break;
464 464
         }
465 465
         if ($sql_last_x) {
@@ -501,14 +501,14 @@  discard block
 block discarded – undo
501 501
     {
502 502
         $totalLogin = array();
503 503
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
504
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
504
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
505 505
         $current_url_id = api_get_current_access_url_id();
506 506
         if (api_is_multiple_url_enabled()) {
507 507
             $table_url = ", $access_url_rel_user_table";
508 508
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
509 509
         } else {
510 510
             $table_url = '';
511
-            $where_url='';
511
+            $where_url = '';
512 512
         }
513 513
         $now = api_get_utc_datetime();
514 514
         $field = 'login_user_id';
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $totalLogin = [];
542 542
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
543
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
543
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
544 544
         $current_url_id = api_get_current_access_url_id();
545 545
         if (api_is_multiple_url_enabled()) {
546 546
             $table_url = ", $access_url_rel_user_table";
547 547
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
548 548
         } else {
549 549
             $table_url = '';
550
-            $where_url='';
550
+            $where_url = '';
551 551
         }
552 552
         $now = api_get_utc_datetime();
553 553
         $field = 'login_user_id';
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         $sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)";
558 558
         
559 559
         $res = Database::query($sql);
560
-        while($row = Database::fetch_array($res,'ASSOC')){
560
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
561 561
             $totalLogin[$row['login_date']] = $row['number'];
562 562
         }
563 563
         
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
     public static function printUserPicturesStats()
653 653
     {
654 654
         $user_table = Database :: get_main_table(TABLE_MAIN_USER);
655
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
655
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
656 656
         $current_url_id = api_get_current_access_url_id();
657 657
         $url_condition = null;
658 658
         $url_condition2 = null;
659 659
         $table = null;
660 660
         if (api_is_multiple_url_enabled()) {
661
-            $url_condition =  ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
661
+            $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
662 662
             $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
663 663
             $table = ", $access_url_rel_user_table as url ";
664 664
         }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             'width=200px',
691 691
             false
692 692
         );
693
-        $renderer =& $form->defaultRenderer();
693
+        $renderer = & $form->defaultRenderer();
694 694
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
695 695
         $form->addElement('hidden', 'report', 'activities');
696 696
         $form->addElement('hidden', 'activities_direction', 'DESC');
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
         $columns[1] = 'access_date';
741 741
         $sql_order[SORT_ASC] = 'ASC';
742 742
         $sql_order[SORT_DESC] = 'DESC';
743
-        $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10;
744
-        $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
745
-        $column = isset($_GET['column'])?intval($_GET['column']) : 0;
746
-        $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
743
+        $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10;
744
+        $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1;
745
+        $column = isset($_GET['column']) ? intval($_GET['column']) : 0;
746
+        $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60;
747 747
 
748 748
         $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
749 749
 
@@ -772,25 +772,25 @@  discard block
 block discarded – undo
772 772
                         access_url_id='".$current_url_id."'
773 773
                    GROUP BY c_id
774 774
                    HAVING c_id <> ''
775
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
775
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
776 776
         } else {
777 777
             $sql = "SELECT * FROM $table
778 778
                    GROUP BY c_id
779 779
                    HAVING c_id <> ''
780
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
780
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
781 781
         }
782 782
         $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction];
783
-        $from = ($page_nr -1) * $per_page;
783
+        $from = ($page_nr - 1) * $per_page;
784 784
         $sql .= ' LIMIT '.$from.','.$per_page;
785 785
 
786 786
         echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>';
787 787
         $res = Database::query($sql);
788 788
         if (Database::num_rows($res) > 0) {
789
-            $courses = array ();
789
+            $courses = array();
790 790
             while ($obj = Database::fetch_object($res)) {
791 791
                 $courseInfo = api_get_course_info_by_id($obj->c_id);
792
-                $course = array ();
793
-                $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
792
+                $course = array();
793
+                $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
794 794
                 // Allow sort by date hiding the numerical date
795 795
                 $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date);
796 796
                 $courses[] = $course;
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     {
864 864
         $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
865 865
         $user_table = Database::get_main_table(TABLE_MAIN_USER);
866
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
866
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
867 867
         $current_url_id = api_get_current_access_url_id();
868 868
 
869 869
         if (api_is_multiple_url_enabled()) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     {
896 896
         $totalLogin = array();
897 897
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
898
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
898
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
899 899
         $current_url_id = api_get_current_access_url_id();
900 900
         $total = self::countUsers();
901 901
         if (api_is_multiple_url_enabled()) {
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
904 904
         } else {
905 905
             $table_url = '';
906
-            $where_url='';
906
+            $where_url = '';
907 907
         }
908 908
         $now = api_get_utc_datetime();
909
-        $sql[get_lang('ThisDay')]    =
909
+        $sql[get_lang('ThisDay')] =
910 910
             "SELECT count(distinct(login_user_id)) AS number ".
911 911
             " FROM $table $table_url ".
912 912
             " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url";
913
-        $sql[get_lang('Last7days')]  =
913
+        $sql[get_lang('Last7days')] =
914 914
             "SELECT count(distinct(login_user_id)) AS number ".
915 915
             " FROM $table $table_url ".
916 916
             " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url";
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
             "SELECT count(distinct(login_user_id)) AS number ".
923 923
             " FROM $table $table_url ".
924 924
             " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= '$now' $where_url";
925
-        $sql[get_lang('NeverConnected')]      =
925
+        $sql[get_lang('NeverConnected')] =
926 926
             "SELECT count(distinct(login_user_id)) AS number ".
927 927
             " FROM $table $table_url WHERE 1=1 $where_url";
928 928
         foreach ($sql as $index => $query) {
Please login to merge, or discard this patch.
main/inc/lib/javascript/chat/video.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 $idUserLocal = api_get_user_id();
35 35
 $userLocal = api_get_user_info($idUserLocal, true);
36 36
 $htmlHeadXtra[] = '<script type="text/javascript" src="'
37
-    . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js'
38
-    . '"></script>' . "\n";
37
+    . api_get_path(WEB_PATH).'web/assets/SimpleWebRTC/latest.js'
38
+    . '"></script>'."\n";
39 39
 
40 40
 $template = new Template();
41 41
 $template->assign('room_name', $chatVideo->getRoomName());
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Rights {
8 8
 	private static $rights_cache = array();
9
-	private static $rights = array (
9
+	private static $rights = array(
10 10
 		'show_tabs:reports' =>
11
-			array (
11
+			array(
12 12
 				'type' => 'const',
13 13
 				'const' => 'true' )
14 14
 		);
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.
main/inc/lib/plugin.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             //extra options
426 426
             $plugin_settings = api_get_settings_params(
427 427
                 array(
428
-                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting')
428
+                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting')
429 429
                 )
430 430
             );
431 431
             $settings_filtered = array();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             if (!empty($obj->course_settings)) {
531 531
                 if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) {
532 532
                     $icon = Display::return_icon(
533
-                        $plugin_name . '.png',
533
+                        $plugin_name.'.png',
534 534
                         Security::remove_XSS($pluginTitle),
535 535
                         '',
536 536
                         ICON_SIZE_SMALL
Please login to merge, or discard this patch.