Completed
Push — developer ( 81429f...31cfdf )
by Błażej
38:40
created
libraries/nusoap/class.nusoap_base.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -183,26 +183,26 @@  discard block
 block discarded – undo
183 183
 	*/
184 184
 	public 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
-	public var $xmlEntities = array('quot' => '"','amp' => '&',
218
-		'lt' => '<','gt' => '>','apos' => "'");
217
+	public var $xmlEntities = array('quot' => '"', 'amp' => '&',
218
+		'lt' => '<', 'gt' => '>', 'apos' => "'");
219 219
 
220 220
 	/**
221 221
 	* constructor
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	* @param    string $string debug data
273 273
 	* @access   private
274 274
 	*/
275
-	public function debug($string){
275
+	public function debug($string) {
276 276
 		if ($this->debugLevel > 0) {
277
-			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
277
+			$this->appendDebug($this->getmicrotime() . ' ' . get_class($this) . ": $string\n");
278 278
 		}
279 279
 	}
280 280
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	* @param    string $string debug data
285 285
 	* @access   public
286 286
 	*/
287
-	public function appendDebug($string){
287
+	public 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
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* @return   mixed error string or false
356 356
 	* @access   public
357 357
 	*/
358
-	public function getError(){
359
-		if($this->error_str != ''){
358
+	public 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
-	public function setError($str){
371
+	public 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
-	public function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) {
407
+	public 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 409
 		$this->appendDebug('value=' . $this->varDump($val));
410 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());
@@ -420,30 +420,30 @@  discard block
 block discarded – undo
420 420
 		// force valid name if necessary
421 421
 		if (is_numeric($name)) {
422 422
 			$name = '__numeric_' . $name;
423
-		} elseif (! $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);
430
-			$name = $prefix.':'.$name;
428
+        if ($name_ns) {
429
+			$prefix = 'nu' . rand(1000, 9999);
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){
446
-				$atts .= " $k=\"".$this->expandEntities($v).'"';
444
+		if ($attributes) {
445
+			foreach ($attributes as $k => $v) {
446
+				$atts .= " $k=\"" . $this->expandEntities($v) . '"';
447 447
 			}
448 448
 		}
449 449
 		// serialize null value
@@ -465,12 +465,12 @@  discard block
 block discarded – undo
465 465
         	}
466 466
 		}
467 467
         // serialize if an xsd built-in primitive type
468
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
468
+        if ($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])) {
469 469
     		$this->debug("serialize_val: serialize xsd built-in primitive type");
470 470
         	if (is_bool($val)) {
471 471
         		if ($type == 'boolean') {
472 472
 	        		$val = $val ? 'true' : 'false';
473
-	        	} elseif (! $val) {
473
+	        	} elseif (!$val) {
474 474
 	        		$val = 0;
475 475
 	        	}
476 476
 			} else if (is_string($val)) {
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
         }
489 489
 		// detect type and serialize
490 490
 		$xml = '';
491
-		switch(true) {
491
+		switch (true) {
492 492
 			case (is_bool($val) || $type == 'boolean'):
493 493
 		   		$this->debug("serialize_val: serialize boolean");
494 494
         		if ($type == 'boolean') {
495 495
 	        		$val = $val ? 'true' : 'false';
496
-	        	} elseif (! $val) {
496
+	        	} elseif (!$val) {
497 497
 	        		$val = 0;
498 498
 	        	}
499 499
 				if ($use == 'literal') {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
511 511
 				}
512 512
 				break;
513
-			case (is_float($val)|| is_double($val) || $type == 'float'):
513
+			case (is_float($val) || is_double($val) || $type == 'float'):
514 514
 		   		$this->debug("serialize_val: serialize float");
515 515
 				if ($use == 'literal') {
516 516
 					$xml .= "<$name$xmlns$atts>$val</$name>";
@@ -535,17 +535,17 @@  discard block
 block discarded – undo
535 535
 					$this->appendDebug($val->getDebug());
536 536
 					$val->clearDebug();
537 537
 		        } else {
538
-					if (! $name) {
538
+					if (!$name) {
539 539
 						$name = get_class($val);
540 540
 						$this->debug("In serialize_val, used class name $name as element name");
541 541
 					} else {
542 542
 						$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
543 543
 					}
544
-					foreach(get_object_vars($val) as $k => $v){
545
-						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
544
+					foreach (get_object_vars($val) as $k => $v) {
545
+						$pXml = isset($pXml) ? $pXml . $this->serialize_val($v, $k, false, false, false, false, $use) : $this->serialize_val($v, $k, false, false, false, false, $use);
546 546
 					}
547 547
 				}
548
-				if(isset($type) && isset($type_prefix)){
548
+				if (isset($type) && isset($type_prefix)) {
549 549
 					$type_str = " xsi:type=\"$type_prefix:$type\"";
550 550
 				} else {
551 551
 					$type_str = '';
@@ -560,12 +560,12 @@  discard block
 block discarded – undo
560 560
 			case (is_array($val) || $type):
561 561
 				// detect if struct or array
562 562
 				$valueType = $this->isArraySimpleOrStruct($val);
563
-                if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
563
+                if ($valueType == 'arraySimple' || preg_match('/^ArrayOf/', $type)) {
564 564
 			   		$this->debug("serialize_val: serialize array");
565 565
 					$i = 0;
566
-					if(is_array($val) && count($val)> 0){
567
-						foreach($val as $v){
568
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
566
+					if (is_array($val) && count($val) > 0) {
567
+						foreach ($val as $v) {
568
+	                    	if (is_object($v) && get_class($v) == 'soapval') {
569 569
 								$tt_ns = $v->type_ns;
570 570
 								$tt = $v->type;
571 571
 							} elseif (is_array($v)) {
@@ -574,23 +574,23 @@  discard block
 block discarded – undo
574 574
 								$tt = gettype($v);
575 575
 	                        }
576 576
 							$array_types[$tt] = 1;
577
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
577
+							$xml .= $this->serialize_val($v, 'item', false, false, false, false, $use);
578 578
 							++$i;
579 579
 						}
580
-						if(count($array_types) > 1){
580
+						if (count($array_types) > 1) {
581 581
 							$array_typename = 'xsd:anyType';
582
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
582
+						} elseif (isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
583 583
 							if ($tt == 'integer') {
584 584
 								$tt = 'int';
585 585
 							}
586
-							$array_typename = 'xsd:'.$tt;
587
-						} elseif(isset($tt) && $tt == 'arraySimple'){
586
+							$array_typename = 'xsd:' . $tt;
587
+						} elseif (isset($tt) && $tt == 'arraySimple') {
588 588
 							$array_typename = 'SOAP-ENC:Array';
589
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
589
+						} elseif (isset($tt) && $tt == 'arrayStruct') {
590 590
 							$array_typename = 'unnamed_struct_use_soapval';
591 591
 						} else {
592 592
 							// if type is prefixed, create type prefix
593
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
593
+							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']) {
594 594
 								 $array_typename = 'xsd:' . $tt;
595 595
 							} elseif ($tt_ns) {
596 596
 								$tt_prefix = 'ns' . rand(1000, 9999);
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 						} else if (isset($type) && isset($type_prefix)) {
607 607
 							$type_str = " xsi:type=\"$type_prefix:$type\"";
608 608
 						} else {
609
-							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
609
+							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"" . $array_typename . "[$array_type]\"";
610 610
 						}
611 611
 					// empty array
612 612
 					} else {
@@ -618,11 +618,11 @@  discard block
 block discarded – undo
618 618
 							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
619 619
 						}
620 620
 					}
621
-					$xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
621
+					$xml = "<$name$xmlns$type_str$atts>" . $xml . "</$name>";
622 622
 				} else {
623 623
 					// got a struct
624 624
 			   		$this->debug("serialize_val: serialize struct");
625
-					if(isset($type) && isset($type_prefix)){
625
+					if (isset($type) && isset($type_prefix)) {
626 626
 						$type_str = " xsi:type=\"$type_prefix:$type\"";
627 627
 					} else {
628 628
 						$type_str = '';
@@ -632,15 +632,15 @@  discard block
 block discarded – undo
632 632
 					} else {
633 633
 						$xml .= "<$name$xmlns$type_str$atts>";
634 634
 					}
635
-					foreach($val as $k => $v){
635
+					foreach ($val as $k => $v) {
636 636
 						// Apache Map
637 637
 						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
638 638
 							$xml .= '<item>';
639
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
640
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
639
+							$xml .= $this->serialize_val($k, 'key', false, false, false, false, $use);
640
+							$xml .= $this->serialize_val($v, 'value', false, false, false, false, $use);
641 641
 							$xml .= '</item>';
642 642
 						} else {
643
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
643
+							$xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
644 644
 						}
645 645
 					}
646 646
 					$xml .= "</$name>";
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 				break;
649 649
 			default:
650 650
 		   		$this->debug("serialize_val: serialize unknown");
651
-				$xml .= 'not detected, got '.gettype($val).' for '.$val;
651
+				$xml .= 'not detected, got ' . gettype($val) . ' for ' . $val;
652 652
 				break;
653 653
 		}
654 654
 		$this->debug("serialize_val returning $xml");
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
     * @return string the message
668 668
     * @access public
669 669
     */
670
-    public function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
670
+    public function serializeEnvelope($body, $headers = false, $namespaces = array(), $style = 'rpc', $use = 'encoded', $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/') {
671 671
 
672 672
 	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
673 673
 	$this->debug("headers:");
@@ -677,15 +677,15 @@  discard block
 block discarded – undo
677 677
 
678 678
 	// serialize namespaces
679 679
     $ns_string = '';
680
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
680
+	foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
681 681
 		$ns_string .= " xmlns:$k=\"$v\"";
682 682
 	}
683
-	if($encodingStyle) {
683
+	if ($encodingStyle) {
684 684
 		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
685 685
 	}
686 686
 
687 687
 	// serialize headers
688
-	if($headers){
688
+	if ($headers) {
689 689
 		if (is_array($headers)) {
690 690
 			$xml = '';
691 691
 			foreach ($headers as $k => $v) {
@@ -698,16 +698,16 @@  discard block
 block discarded – undo
698 698
 			$headers = $xml;
699 699
 			$this->debug("In serializeEnvelope, serialized array of headers to $headers");
700 700
 		}
701
-		$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
701
+		$headers = "<SOAP-ENV:Header>" . $headers . "</SOAP-ENV:Header>";
702 702
 	}
703 703
 	// serialize envelope
704 704
 	return
705
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
706
-	'<SOAP-ENV:Envelope'.$ns_string.">".
707
-	$headers.
708
-	"<SOAP-ENV:Body>".
709
-		$body.
710
-	"</SOAP-ENV:Body>".
705
+	'<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?' . ">" .
706
+	'<SOAP-ENV:Envelope' . $ns_string . ">" .
707
+	$headers .
708
+	"<SOAP-ENV:Body>" .
709
+		$body .
710
+	"</SOAP-ENV:Body>" .
711 711
 	"</SOAP-ENV:Envelope>";
712 712
     }
713 713
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	 * @access public
720 720
 	 * @deprecated
721 721
 	 */
722
-    public function formatDump($str){
722
+    public function formatDump($str) {
723 723
 		$str = htmlspecialchars($str);
724 724
 		return nl2br($str);
725 725
     }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 	* @return	string contracted qname
732 732
 	* @access   private
733 733
 	*/
734
-	public function contractQname($qname){
734
+	public function contractQname($qname) {
735 735
 		// get element namespace
736 736
 		if (strrpos($qname, ':')) {
737 737
 			// get unqualified name
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
 	* @return	string expanded qname
756 756
 	* @access   private
757 757
 	*/
758
-	public function expandQname($qname){
758
+	public function expandQname($qname) {
759 759
 		// get element prefix
760
-		if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
760
+		if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
761 761
 			// get unqualified name
762
-			$name = substr(strstr($qname,':'),1);
762
+			$name = substr(strstr($qname, ':'), 1);
763 763
 			// get ns prefix
764
-			$prefix = substr($qname,0,strpos($qname,':'));
765
-			if(isset($this->namespaces[$prefix])){
766
-				return $this->namespaces[$prefix].':'.$name;
764
+			$prefix = substr($qname, 0, strpos($qname, ':'));
765
+			if (isset($this->namespaces[$prefix])) {
766
+				return $this->namespaces[$prefix] . ':' . $name;
767 767
 			} else {
768 768
 				return $qname;
769 769
 			}
@@ -780,10 +780,10 @@  discard block
 block discarded – undo
780 780
     * @return string The local part
781 781
     * @access public
782 782
     */
783
-	public function getLocalPart($str){
784
-		if($sstr = strrchr($str,':')){
783
+	public function getLocalPart($str) {
784
+		if ($sstr = strrchr($str, ':')) {
785 785
 			// get unqualified name
786
-			return substr( $sstr, 1 );
786
+			return substr($sstr, 1);
787 787
 		} else {
788 788
 			return $str;
789 789
 		}
@@ -797,10 +797,10 @@  discard block
 block discarded – undo
797 797
     * @return mixed The prefix or false if there is no prefix
798 798
     * @access public
799 799
     */
800
-	public function getPrefix($str){
801
-		if($pos = strrpos($str,':')){
800
+	public function getPrefix($str) {
801
+		if ($pos = strrpos($str, ':')) {
802 802
 			// get prefix
803
-			return substr($str,0,$pos);
803
+			return substr($str, 0, $pos);
804 804
 		}
805 805
 		return false;
806 806
 	}
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
     * @return mixed The namespace, false if no namespace has the specified prefix
813 813
     * @access public
814 814
     */
815
-	public function getNamespaceFromPrefix($prefix){
815
+	public function getNamespaceFromPrefix($prefix) {
816 816
 		if (isset($this->namespaces[$prefix])) {
817 817
 			return $this->namespaces[$prefix];
818 818
 		}
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 * @return	mixed ISO 8601 date string or false
891 891
 * @access   public
892 892
 */
893
-function timestamp_to_iso8601($timestamp,$utc=true){
894
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
893
+function timestamp_to_iso8601($timestamp, $utc = true) {
894
+	$datestr = date('Y-m-d\TH:i:sO', $timestamp);
895 895
 	$pos = strrpos($datestr, "+");
896 896
 	if ($pos === false) {
897 897
 		$pos = strrpos($datestr, "-");
@@ -901,20 +901,20 @@  discard block
 block discarded – undo
901 901
 			$datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2);
902 902
 		}
903 903
 	}
904
-	if($utc){
905
-		$pattern = '/'.
906
-		'([0-9]{4})-'.	// centuries & years CCYY-
907
-		'([0-9]{2})-'.	// months MM-
908
-		'([0-9]{2})'.	// days DD
909
-		'T'.			// separator T
910
-		'([0-9]{2}):'.	// hours hh:
911
-		'([0-9]{2}):'.	// minutes mm:
912
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
913
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
904
+	if ($utc) {
905
+		$pattern = '/' .
906
+		'([0-9]{4})-' . // centuries & years CCYY-
907
+		'([0-9]{2})-' . // months MM-
908
+		'([0-9]{2})' . // days DD
909
+		'T' . // separator T
910
+		'([0-9]{2}):' . // hours hh:
911
+		'([0-9]{2}):' . // minutes mm:
912
+		'([0-9]{2})(\.[0-9]*)?' . // seconds ss.ss...
913
+		'(Z|[+\-][0-9]{2}:?[0-9]{2})?' . // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
914 914
 		'/';
915 915
 
916
-		if(preg_match($pattern,$datestr,$regs)){
917
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
916
+		if (preg_match($pattern, $datestr, $regs)) {
917
+			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ', $regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6]);
918 918
 		}
919 919
 		return false;
920 920
 	} else {
@@ -929,27 +929,27 @@  discard block
 block discarded – undo
929 929
 * @return	mixed Unix timestamp (int) or false
930 930
 * @access   public
931 931
 */
932
-function iso8601_to_timestamp($datestr){
933
-	$pattern = '/'.
934
-	'([0-9]{4})-'.	// centuries & years CCYY-
935
-	'([0-9]{2})-'.	// months MM-
936
-	'([0-9]{2})'.	// days DD
937
-	'T'.			// separator T
938
-	'([0-9]{2}):'.	// hours hh:
939
-	'([0-9]{2}):'.	// minutes mm:
940
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
941
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
932
+function iso8601_to_timestamp($datestr) {
933
+	$pattern = '/' .
934
+	'([0-9]{4})-' . // centuries & years CCYY-
935
+	'([0-9]{2})-' . // months MM-
936
+	'([0-9]{2})' . // days DD
937
+	'T' . // separator T
938
+	'([0-9]{2}):' . // hours hh:
939
+	'([0-9]{2}):' . // minutes mm:
940
+	'([0-9]{2})(\.[0-9]+)?' . // seconds ss.ss...
941
+	'(Z|[+\-][0-9]{2}:?[0-9]{2})?' . // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
942 942
 	'/';
943
-	if(preg_match($pattern,$datestr,$regs)){
943
+	if (preg_match($pattern, $datestr, $regs)) {
944 944
 		// not utc
945
-		if($regs[8] != 'Z'){
946
-			$op = substr($regs[8],0,1);
947
-			$h = substr($regs[8],1,2);
948
-			$m = substr($regs[8],strlen($regs[8])-2,2);
949
-			if($op == '-'){
945
+		if ($regs[8] != 'Z') {
946
+			$op = substr($regs[8], 0, 1);
947
+			$h = substr($regs[8], 1, 2);
948
+			$m = substr($regs[8], strlen($regs[8]) - 2, 2);
949
+			if ($op == '-') {
950 950
 				$regs[4] = $regs[4] + $h;
951 951
 				$regs[5] = $regs[5] + $m;
952
-			} elseif($op == '+'){
952
+			} elseif ($op == '+') {
953 953
 				$regs[4] = $regs[4] - $h;
954 954
 				$regs[5] = $regs[5] - $m;
955 955
 			}
Please login to merge, or discard this patch.
libraries/nusoap/class.wsdl.php 1 patch
Spacing   +125 added lines, -127 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	public var $proxypassword = '';
48 48
 	public var $timeout = 0;
49 49
 	public var $response_timeout = 30;
50
-	public var $curl_options = array();	// User-specified cURL options
51
-	public var $use_curl = false;			// whether to always try to use cURL
50
+	public var $curl_options = array(); // User-specified cURL options
51
+	public var $use_curl = false; // whether to always try to use cURL
52 52
 	// for HTTP authentication
53
-	public var $username = '';				// Username for HTTP authentication
54
-	public var $password = '';				// Password for HTTP authentication
55
-	public var $authtype = '';				// Type of HTTP authentication
56
-	public var $certRequest = array();		// Certificate for HTTP SSL authentication
53
+	public var $username = ''; // Username for HTTP authentication
54
+	public var $password = ''; // Password for HTTP authentication
55
+	public var $authtype = ''; // Type of HTTP authentication
56
+	public 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
-    public function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
72
+    public 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;
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
     		// Schema imports
104 104
     		foreach ($this->schemas as $ns => $list) {
105 105
     			foreach ($list as $xs) {
106
-					$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
106
+					$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
107 107
 		            foreach ($xs->imports as $ns2 => $list2) {
108 108
 		                for ($ii = 0; $ii < count($list2); $ii++) {
109
-		                	if (! $list2[$ii]['loaded']) {
109
+		                	if (!$list2[$ii]['loaded']) {
110 110
 		                		/*
111 111
 		                		 * Substituted with line below
112 112
 		                		 * because of error "Warning: attempt to modify property of non-object"
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 								if ($url != '') {
118 118
 									$urlparts = parse_url($url);
119 119
 									if (!isset($urlparts['host'])) {
120
-										$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
121
-												substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
120
+										$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
121
+												substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
122 122
 									}
123
-									if (! in_array($url, $imported_urls)) {
123
+									if (!in_array($url, $imported_urls)) {
124 124
 					                	$this->parseWSDL($url);
125 125
 				                		$imported++;
126 126
 				                		$imported_urls[] = $url;
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
     			}
135 135
     		}
136 136
     		// WSDL imports
137
-			$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
137
+			$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
138 138
             foreach ($this->import as $ns => $list) {
139 139
                 for ($ii = 0; $ii < count($list); $ii++) {
140
-                	if (! $list[$ii]['loaded']) {
140
+                	if (!$list[$ii]['loaded']) {
141 141
                 		$this->import[$ns][$ii]['loaded'] = true;
142 142
                 		$url = $list[$ii]['location'];
143 143
 						if ($url != '') {
144 144
 							$urlparts = parse_url($url);
145 145
 							if (!isset($urlparts['host'])) {
146 146
 								$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
147
-										substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
147
+										substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
148 148
 							}
149
-							if (! in_array($url, $imported_urls)) {
149
+							if (!in_array($url, $imported_urls)) {
150 150
 			                	$this->parseWSDL($url);
151 151
 		                		$imported++;
152 152
 		                		$imported_urls[] = $url;
@@ -159,30 +159,28 @@  discard block
 block discarded – undo
159 159
             } 
160 160
 		}
161 161
         // add new data to operation data
162
-        foreach($this->bindings as $binding => $bindingData) {
162
+        foreach ($this->bindings as $binding => $bindingData) {
163 163
             if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
164
-                foreach($bindingData['operations'] as $operation => $data) {
164
+                foreach ($bindingData['operations'] as $operation => $data) {
165 165
                     $this->debug('post-parse data gathering for ' . $operation);
166 166
                     $this->bindings[$binding]['operations'][$operation]['input'] = 
167 167
 						isset($this->bindings[$binding]['operations'][$operation]['input']) ? 
168
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
169
-						$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
168
+						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input'];
170 169
                     $this->bindings[$binding]['operations'][$operation]['output'] = 
171 170
 						isset($this->bindings[$binding]['operations'][$operation]['output']) ?
172
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
173
-						$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
174
-                    if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
175
-						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
171
+						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output'];
172
+                    if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) {
173
+						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']];
176 174
 					}
177
-					if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
178
-                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
175
+					if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) {
176
+                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']];
179 177
                     }
180 178
                     // Set operation style if necessary, but do not override one already provided
181 179
 					if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
182 180
                         $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
183 181
                     }
184 182
                     $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
185
-                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
183
+                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : '';
186 184
                     $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
187 185
                 } 
188 186
             } 
@@ -213,8 +211,8 @@  discard block
 block discarded – undo
213 211
 	        $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
214 212
 			$tr->request_method = 'GET';
215 213
 			$tr->useSOAPAction = false;
216
-			if($this->proxyhost && $this->proxyport){
217
-				$tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
214
+			if ($this->proxyhost && $this->proxyport) {
215
+				$tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
218 216
 			}
219 217
 			if ($this->authtype != '') {
220 218
 				$tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
@@ -223,8 +221,8 @@  discard block
 block discarded – undo
223 221
 			$wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
224 222
 			$this->appendDebug($tr->getDebug());
225 223
 			// catch errors
226
-			if($err = $tr->getError() ){
227
-				$errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err;
224
+			if ($err = $tr->getError()) {
225
+				$errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: ' . $err;
228 226
 				$this->debug($errstr);
229 227
 	            $this->setError($errstr);
230 228
 				unset($tr);
@@ -283,7 +281,7 @@  discard block
 block discarded – undo
283 281
         xml_parser_free($this->parser);
284 282
         $this->debug('Parsing WSDL done');
285 283
 		// catch wsdl parse errors
286
-		if($this->getError()){
284
+		if ($this->getError()) {
287 285
 			return false;
288 286
 		}
289 287
         return true;
@@ -320,8 +318,8 @@  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 {
@@ -334,7 +332,7 @@  discard block
 block discarded – undo
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;
@@ -441,8 +439,8 @@  discard block
 block discarded – undo
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
@@ -509,7 +507,7 @@  discard block
 block discarded – undo
509 507
 	* @param string $name element name
510 508
 	* @access private 
511 509
 	*/
512
-	public function end_element($parser, $name){ 
510
+	public 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 = "";
@@ -592,15 +590,15 @@  discard block
 block discarded – undo
592 590
 		}
593 591
 		$this->debug("getOperations for port '$portName' bindingType $bindingType");
594 592
 		// loop thru ports
595
-		foreach($this->ports as $port => $portData) {
593
+		foreach ($this->ports as $port => $portData) {
596 594
 			$this->debug("getOperations checking port $port bindingType " . $portData['bindingType']);
597 595
 			if ($portName == '' || $port == $portName) {
598 596
 				// binding type of port matches parameter
599 597
 				if ($portData['bindingType'] == $bindingType) {
600 598
 					$this->debug("getOperations found port $port bindingType $bindingType");
601 599
 					// merge bindings
602
-					if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
603
-						$ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
600
+					if (isset($this->bindings[$portData['binding']]['operations'])) {
601
+						$ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']);
604 602
 					}
605 603
 				}
606 604
 			}
@@ -627,15 +625,15 @@  discard block
 block discarded – undo
627 625
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
628 626
 		}
629 627
 		// loop thru ports
630
-		foreach($this->ports as $port => $portData) {
628
+		foreach ($this->ports as $port => $portData) {
631 629
 			// binding type of port matches parameter
632 630
 			if ($portData['bindingType'] == $bindingType) {
633 631
 				// get binding
634 632
 				//foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
635
-				foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
633
+				foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) {
636 634
 					// note that we could/should also check the namespace here
637 635
 					if ($operation == $bOperation) {
638
-						$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
636
+						$opData = $this->bindings[$portData['binding']]['operations'][$operation];
639 637
 					    return $opData;
640 638
 					} 
641 639
 				} 
@@ -658,11 +656,11 @@  discard block
 block discarded – undo
658 656
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
659 657
 		}
660 658
 		// loop thru ports
661
-		foreach($this->ports as $port => $portData) {
659
+		foreach ($this->ports as $port => $portData) {
662 660
 			// binding type of port matches parameter
663 661
 			if ($portData['bindingType'] == $bindingType) {
664 662
 				// loop through operations for the binding
665
-				foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
663
+				foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) {
666 664
 					if ($opData['soapAction'] == $soapAction) {
667 665
 					    return $opData;
668 666
 					} 
@@ -691,7 +689,7 @@  discard block
 block discarded – undo
691 689
     */
692 690
 	public function getTypeDef($type, $ns) {
693 691
 		$this->debug("in getTypeDef: type=$type, ns=$ns");
694
-		if ((! $ns) && isset($this->namespaces['tns'])) {
692
+		if ((!$ns) && isset($this->namespaces['tns'])) {
695 693
 			$ns = $this->namespaces['tns'];
696 694
 			$this->debug("in getTypeDef: type namespace forced to $ns");
697 695
 		}
@@ -749,7 +747,7 @@  discard block
 block discarded – undo
749 747
     *
750 748
     * @access private
751 749
     */
752
-    public function webDescription(){
750
+    public function webDescription() {
753 751
     	global $HTTP_SERVER_VARS;
754 752
 
755 753
 		if (isset($_SERVER)) {
@@ -761,7 +759,7 @@  discard block
 block discarded – undo
761 759
 		}
762 760
 
763 761
 		$b = '
764
-		<html><head><title>NuSOAP: '.$this->serviceName.'</title>
762
+		<html><head><title>NuSOAP: '.$this->serviceName . '</title>
765 763
 		<style type="text/css">
766 764
 		    body    { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
767 765
 		    p       { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
@@ -838,24 +836,24 @@  discard block
 block discarded – undo
838 836
 		<body>
839 837
 		<div class=content>
840 838
 			<br><br>
841
-			<div class=title>'.$this->serviceName.'</div>
839
+			<div class=title>'.$this->serviceName . '</div>
842 840
 			<div class=nav>
843
-				<p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
841
+				<p>View the <a href="'.$PHP_SELF . '?wsdl">WSDL</a> for the service.
844 842
 				Click on an operation name to view it&apos;s details.</p>
845 843
 				<ul>';
846
-				foreach($this->getOperations() as $op => $data){
844
+				foreach ($this->getOperations() as $op => $data) {
847 845
 				    $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
848 846
 				    // create hidden div
849 847
 				    $b .= "<div id='$op' class='hidden'>
850 848
 				    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
851
-				    foreach($data as $donnie => $marie){ // loop through opdata
852
-						if($donnie == 'input' || $donnie == 'output'){ // show input/output data
853
-						    $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
854
-						    foreach($marie as $captain => $tenille){ // loop through data
855
-								if($captain == 'parts'){ // loop thru parts
849
+				    foreach ($data as $donnie => $marie) { // loop through opdata
850
+						if ($donnie == 'input' || $donnie == 'output') { // show input/output data
851
+						    $b .= "<font color='white'>" . ucfirst($donnie) . ':</font><br>';
852
+						    foreach ($marie as $captain => $tenille) { // loop through data
853
+								if ($captain == 'parts') { // loop thru parts
856 854
 								    $b .= "&nbsp;&nbsp;$captain:<br>";
857 855
 					                //if(is_array($tenille)){
858
-								    	foreach($tenille as $joanie => $chachi){
856
+								    	foreach ($tenille as $joanie => $chachi) {
859 857
 											$b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
860 858
 								    	}
861 859
 					        		//}
@@ -864,7 +862,7 @@  discard block
 block discarded – undo
864 862
 								}
865 863
 						    }
866 864
 						} else {
867
-						    $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>";
865
+						    $b .= "<font color='white'>" . ucfirst($donnie) . ":</font> $marie<br>";
868 866
 						}
869 867
 				    }
870 868
 					$b .= '</div>';
@@ -887,7 +885,7 @@  discard block
 block discarded – undo
887 885
 	{
888 886
 		$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
889 887
 		$xml .= "\n<definitions";
890
-		foreach($this->namespaces as $k => $v) {
888
+		foreach ($this->namespaces as $k => $v) {
891 889
 			$xml .= " xmlns:$k=\"$v\"";
892 890
 		} 
893 891
 		// 10.9.02 - add poulter fix for wsdl and tns declarations
@@ -900,7 +898,7 @@  discard block
 block discarded – undo
900 898
 		$xml .= '>'; 
901 899
 		// imports
902 900
 		if (sizeof($this->import) > 0) {
903
-			foreach($this->import as $ns => $list) {
901
+			foreach ($this->import as $ns => $list) {
904 902
 				foreach ($list as $ii) {
905 903
 					if ($ii['location'] != '') {
906 904
 						$xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
@@ -911,7 +909,7 @@  discard block
 block discarded – undo
911 909
 			} 
912 910
 		} 
913 911
 		// types
914
-		if (count($this->schemas)>=1) {
912
+		if (count($this->schemas) >= 1) {
915 913
 			$xml .= "\n<types>\n";
916 914
 			foreach ($this->schemas as $ns => $list) {
917 915
 				foreach ($list as $xs) {
@@ -922,10 +920,10 @@  discard block
 block discarded – undo
922 920
 		} 
923 921
 		// messages
924 922
 		if (count($this->messages) >= 1) {
925
-			foreach($this->messages as $msgName => $msgParts) {
923
+			foreach ($this->messages as $msgName => $msgParts) {
926 924
 				$xml .= "\n<message name=\"" . $msgName . '">';
927
-				if(is_array($msgParts)){
928
-					foreach($msgParts as $partName => $partType) {
925
+				if (is_array($msgParts)) {
926
+					foreach ($msgParts as $partName => $partType) {
929 927
 						// print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
930 928
 						if (strpos($partType, ':')) {
931 929
 						    $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
@@ -933,7 +931,7 @@  discard block
 block discarded – undo
933 931
 						    // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
934 932
 						    $typePrefix = 'xsd';
935 933
 						} else {
936
-						    foreach($this->typemap as $ns => $types) {
934
+						    foreach ($this->typemap as $ns => $types) {
937 935
 						        if (isset($types[$partType])) {
938 936
 						            $typePrefix = $this->getPrefixFromNamespace($ns);
939 937
 						        } 
@@ -963,13 +961,13 @@  discard block
 block discarded – undo
963 961
 		if (count($this->bindings) >= 1) {
964 962
 			$binding_xml = '';
965 963
 			$portType_xml = '';
966
-			foreach($this->bindings as $bindingName => $attrs) {
964
+			foreach ($this->bindings as $bindingName => $attrs) {
967 965
 				$binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
968 966
 				$binding_xml .= "\n" . '  <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
969 967
 				$portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
970
-				foreach($attrs['operations'] as $opName => $opParts) {
968
+				foreach ($attrs['operations'] as $opName => $opParts) {
971 969
 					$binding_xml .= "\n" . '  <operation name="' . $opName . '">';
972
-					$binding_xml .= "\n" . '    <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
970
+					$binding_xml .= "\n" . '    <soap:operation soapAction="' . $opParts['soapAction'] . '" style="' . $opParts['style'] . '"/>';
973 971
 					if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
974 972
 						$enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
975 973
 					} else {
@@ -988,7 +986,7 @@  discard block
 block discarded – undo
988 986
 					    $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
989 987
 					} 
990 988
 					$portType_xml .= '>';
991
-					if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
989
+					if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
992 990
 						$portType_xml .= "\n" . '    <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
993 991
 					}
994 992
 					$portType_xml .= "\n" . '    <input message="tns:' . $opParts['input']['message'] . '"/>';
@@ -1003,7 +1001,7 @@  discard block
 block discarded – undo
1003 1001
 		// services
1004 1002
 		$xml .= "\n<service name=\"" . $this->serviceName . '">';
1005 1003
 		if (count($this->ports) >= 1) {
1006
-			foreach($this->ports as $pName => $attrs) {
1004
+			foreach ($this->ports as $pName => $attrs) {
1007 1005
 				$xml .= "\n" . '  <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
1008 1006
 				$xml .= "\n" . '    <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
1009 1007
 				$xml .= "\n" . '  </port>';
@@ -1118,7 +1116,7 @@  discard block
 block discarded – undo
1118 1116
 
1119 1117
 		// Get encoding style for output and set to current
1120 1118
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1121
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1119
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1122 1120
 			$encodingStyle = $opData['output']['encodingStyle'];
1123 1121
 			$enc_style = $encodingStyle;
1124 1122
 		}
@@ -1213,7 +1211,7 @@  discard block
 block discarded – undo
1213 1211
 		
1214 1212
 		// Get encoding style for output and set to current
1215 1213
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1216
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1214
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1217 1215
 			$encodingStyle = $opData['output']['encodingStyle'];
1218 1216
 			$enc_style = $encodingStyle;
1219 1217
 		}
@@ -1228,10 +1226,10 @@  discard block
 block discarded – undo
1228 1226
 			if (is_array($parameters)) {
1229 1227
 				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
1230 1228
 				$this->debug('have ' . $parametersArrayType . ' parameters');
1231
-				foreach($opData[$direction]['parts'] as $name => $type) {
1232
-					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
1229
+				foreach ($opData[$direction]['parts'] as $name => $type) {
1230
+					$this->debug('serializing part "' . $name . '" of type "' . $type . '"');
1233 1231
 					// Track encoding style
1234
-					if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1232
+					if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1235 1233
 						$encodingStyle = $opData[$direction]['encodingStyle'];			
1236 1234
 						$enc_style = $encodingStyle;
1237 1235
 					} else {
@@ -1271,11 +1269,11 @@  discard block
 block discarded – undo
1271 1269
 	 * @return string value serialized as an XML string
1272 1270
 	 * @access private
1273 1271
 	 */
1274
-	public function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
1272
+	public function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false)
1275 1273
 	{
1276 1274
 		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
1277 1275
 		$this->appendDebug("value=" . $this->varDump($value));
1278
-		if($use == 'encoded' && $encodingStyle) {
1276
+		if ($use == 'encoded' && $encodingStyle) {
1279 1277
 			$encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
1280 1278
 		}
1281 1279
 
@@ -1319,7 +1317,7 @@  discard block
 block discarded – undo
1319 1317
 				$this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
1320 1318
 			}
1321 1319
 
1322
-			if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
1320
+			if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') {
1323 1321
 				$this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
1324 1322
 				if ($unqualified && $use == 'literal') {
1325 1323
 					$elementNS = " xmlns=\"\"";
@@ -1340,7 +1338,7 @@  discard block
 block discarded – undo
1340 1338
 					return $this->serialize_val($value, $name, false, false, false, false, $use);
1341 1339
 				}
1342 1340
 		    	if ($uqType == 'boolean') {
1343
-		    		if ((is_string($value) && $value == 'false') || (! $value)) {
1341
+		    		if ((is_string($value) && $value == 'false') || (!$value)) {
1344 1342
 						$value = 'false';
1345 1343
 					} else {
1346 1344
 						$value = 'true';
@@ -1370,7 +1368,7 @@  discard block
 block discarded – undo
1370 1368
 				$this->debug('in serializeType: appears to be Apache SOAP type');
1371 1369
 				if ($uqType == 'Map') {
1372 1370
 					$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1373
-					if (! $tt_prefix) {
1371
+					if (!$tt_prefix) {
1374 1372
 						$this->debug('in serializeType: Add namespace for Apache SOAP type');
1375 1373
 						$tt_prefix = 'ns' . rand(1000, 9999);
1376 1374
 						$this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
@@ -1378,11 +1376,11 @@  discard block
 block discarded – undo
1378 1376
 						$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1379 1377
 					}
1380 1378
 					$contents = '';
1381
-					foreach($value as $k => $v) {
1379
+					foreach ($value as $k => $v) {
1382 1380
 						$this->debug("serializing map element: key $k, value $v");
1383 1381
 						$contents .= '<item>';
1384
-						$contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
1385
-						$contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
1382
+						$contents .= $this->serialize_val($k, 'key', false, false, false, false, $use);
1383
+						$contents .= $this->serialize_val($v, 'value', false, false, false, false, $use);
1386 1384
 						$contents .= '</item>';
1387 1385
 					}
1388 1386
 					if ($use == 'literal') {
@@ -1404,7 +1402,7 @@  discard block
 block discarded – undo
1404 1402
 			$ns = '';
1405 1403
 			$uqType = $type;
1406 1404
 		}
1407
-		if(!$typeDef = $this->getTypeDef($uqType, $ns)){
1405
+		if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
1408 1406
 			$this->setError("$type ($uqType) is not a supported type.");
1409 1407
 			$this->debug("in serializeType: $type ($uqType) is not a supported type.");
1410 1408
 			return false;
@@ -1421,7 +1419,7 @@  discard block
 block discarded – undo
1421 1419
 			return false;
1422 1420
 		}
1423 1421
 		$phpType = $typeDef['phpType'];
1424
-		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); 
1422
+		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '')); 
1425 1423
 		// if php type == struct, map value to the <all> element names
1426 1424
 		if ($phpType == 'struct') {
1427 1425
 			if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
@@ -1501,14 +1499,14 @@  discard block
 block discarded – undo
1501 1499
 						':arrayType="' .
1502 1500
 						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
1503 1501
 						':' .
1504
-						$this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
1502
+						$this->getLocalPart($typeDef['arrayType']) . "[0]\"/>";
1505 1503
 				}
1506 1504
 				$this->debug("in serializeType: returning: $xml");
1507 1505
 				return $xml;
1508 1506
 			}
1509 1507
 			if (isset($typeDef['multidimensional'])) {
1510 1508
 				$nv = array();
1511
-				foreach($value as $v) {
1509
+				foreach ($value as $v) {
1512 1510
 					$cols = ',' . sizeof($v);
1513 1511
 					$nv = array_merge($nv, $v);
1514 1512
 				} 
@@ -1519,10 +1517,10 @@  discard block
 block discarded – undo
1519 1517
 			if (is_array($value) && sizeof($value) >= 1) {
1520 1518
 				$rows = sizeof($value);
1521 1519
 				$contents = '';
1522
-				foreach($value as $k => $v) {
1520
+				foreach ($value as $k => $v) {
1523 1521
 					$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
1524 1522
 					//if (strpos($typeDef['arrayType'], ':') ) {
1525
-					if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1523
+					if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1526 1524
 					    $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
1527 1525
 					} else {
1528 1526
 					    $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
@@ -1537,11 +1535,11 @@  discard block
 block discarded – undo
1537 1535
 					.$contents
1538 1536
 					."</$name>";
1539 1537
 			} else {
1540
-				$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
1538
+				$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . ':Array" ' .
1541 1539
 					$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
1542 1540
 					.':arrayType="'
1543 1541
 					.$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
1544
-					.":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
1542
+					.":" . $this->getLocalPart($typeDef['arrayType']) . "[$rows$cols]\">"
1545 1543
 					.$contents
1546 1544
 					."</$name>";
1547 1545
 			}
@@ -1621,7 +1619,7 @@  discard block
 block discarded – undo
1621 1619
 					$this->debug("no value provided for attribute $aName");
1622 1620
 				}
1623 1621
 				if ($xname) {
1624
-					$xml .=  " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
1622
+					$xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
1625 1623
 				}
1626 1624
 			} 
1627 1625
 		} else {
@@ -1642,7 +1640,7 @@  discard block
 block discarded – undo
1642 1640
 	 * @return string value serialized as an XML string
1643 1641
 	 * @access private
1644 1642
 	 */
1645
-	public function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
1643
+	public function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) {
1646 1644
 		$this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType");
1647 1645
 		$xml = '';
1648 1646
 		if (isset($typeDef['extensionBase'])) {
@@ -1669,7 +1667,7 @@  discard block
 block discarded – undo
1669 1667
 				$xvalue = array();
1670 1668
 			}
1671 1669
 			// toggle whether all elements are present - ideally should validate against schema
1672
-			if (count($typeDef['elements']) != count($xvalue)){
1670
+			if (count($typeDef['elements']) != count($xvalue)) {
1673 1671
 				$optionals = true;
1674 1672
 			}
1675 1673
 			foreach ($typeDef['elements'] as $eName => $attrs) {
@@ -1682,8 +1680,8 @@  discard block
 block discarded – undo
1682 1680
 				// if user took advantage of a minOccurs=0, then only serialize named parameters
1683 1681
 				if (isset($optionals)
1684 1682
 				    && (!isset($xvalue[$eName])) 
1685
-					&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1686
-					){
1683
+					&& ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1684
+					) {
1687 1685
 					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
1688 1686
 						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
1689 1687
 					}
@@ -1748,15 +1746,15 @@  discard block
 block discarded – undo
1748 1746
 	* @see nusoap_xmlschema
1749 1747
 	* @access public
1750 1748
 	*/
1751
-	public function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
1749
+	public function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') {
1752 1750
 		if (count($elements) > 0) {
1753 1751
 			$eElements = array();
1754
-	    	foreach($elements as $n => $e){
1752
+	    	foreach ($elements as $n => $e) {
1755 1753
 	            // expand each element
1756 1754
 	            $ee = array();
1757 1755
 	            foreach ($e as $k => $v) {
1758
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1759
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1756
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1757
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1760 1758
 		            $ee[$k] = $v;
1761 1759
 		    	}
1762 1760
 	    		$eElements[$n] = $ee;
@@ -1765,11 +1763,11 @@  discard block
 block discarded – undo
1765 1763
 		}
1766 1764
 		
1767 1765
 		if (count($attrs) > 0) {
1768
-	    	foreach($attrs as $n => $a){
1766
+	    	foreach ($attrs as $n => $a) {
1769 1767
 	            // expand each attribute
1770 1768
 	            foreach ($a as $k => $v) {
1771
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1772
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1769
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1770
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1773 1771
 		            $aa[$k] = $v;
1774 1772
 		    	}
1775 1773
 	    		$eAttrs[$n] = $aa;
@@ -1777,11 +1775,11 @@  discard block
 block discarded – undo
1777 1775
 	    	$attrs = $eAttrs;
1778 1776
 		}
1779 1777
 
1780
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1781
-		$arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
1778
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1779
+		$arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
1782 1780
 
1783 1781
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1784
-		$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
1782
+		$this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
1785 1783
 	}
1786 1784
 
1787 1785
 	/**
@@ -1795,8 +1793,8 @@  discard block
 block discarded – undo
1795 1793
 	* @see nusoap_xmlschema
1796 1794
 	* @access public
1797 1795
 	*/
1798
-	public function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
1799
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1796
+	public function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) {
1797
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1800 1798
 
1801 1799
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1802 1800
 		$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
@@ -1828,7 +1826,7 @@  discard block
 block discarded – undo
1828 1826
 	* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
1829 1827
 	* @access public 
1830 1828
 	*/
1831
-	public function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
1829
+	public function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') {
1832 1830
 		if ($use == 'encoded' && $encodingStyle == '') {
1833 1831
 			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1834 1832
 		}
@@ -1852,7 +1850,7 @@  discard block
 block discarded – undo
1852 1850
 		}
1853 1851
 
1854 1852
 		// get binding
1855
-		$this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
1853
+		$this->bindings[$this->serviceName . 'Binding']['operations'][$name] =
1856 1854
 		array(
1857 1855
 		'name' => $name,
1858 1856
 		'binding' => $this->serviceName . 'Binding',
@@ -1876,29 +1874,29 @@  discard block
 block discarded – undo
1876 1874
 		'documentation' => $documentation); 
1877 1875
 		// add portTypes
1878 1876
 		// add messages
1879
-		if($in)
1877
+		if ($in)
1880 1878
 		{
1881
-			foreach($in as $pName => $pType)
1879
+			foreach ($in as $pName => $pType)
1882 1880
 			{
1883
-				if(strpos($pType,':')) {
1884
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1881
+				if (strpos($pType, ':')) {
1882
+					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
1885 1883
 				}
1886
-				$this->messages[$name.'Request'][$pName] = $pType;
1884
+				$this->messages[$name . 'Request'][$pName] = $pType;
1887 1885
 			}
1888 1886
 		} else {
1889
-            $this->messages[$name.'Request']= '0';
1887
+            $this->messages[$name . 'Request'] = '0';
1890 1888
         }
1891
-		if($out)
1889
+		if ($out)
1892 1890
 		{
1893
-			foreach($out as $pName => $pType)
1891
+			foreach ($out as $pName => $pType)
1894 1892
 			{
1895
-				if(strpos($pType,':')) {
1896
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1893
+				if (strpos($pType, ':')) {
1894
+					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
1897 1895
 				}
1898
-				$this->messages[$name.'Response'][$pName] = $pType;
1896
+				$this->messages[$name . 'Response'][$pName] = $pType;
1899 1897
 			}
1900 1898
 		} else {
1901
-            $this->messages[$name.'Response']= '0';
1899
+            $this->messages[$name . 'Response'] = '0';
1902 1900
         }
1903 1901
 		return true;
1904 1902
 	} 
Please login to merge, or discard this patch.
libraries/nusoap/class.soap_transport_http.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	public var $incoming_cookies = array();
30 30
 	public var $outgoing_payload = '';
31 31
 	public var $incoming_payload = '';
32
-	public var $response_status_line;	// HTTP response status line
32
+	public var $response_status_line; // HTTP response status line
33 33
 	public var $useSOAPAction = true;
34 34
 	public var $persistentConnection = false;
35
-	public var $ch = false;	// cURL handle
36
-	public var $ch_options = array();	// cURL custom options
37
-	public var $use_curl = false;		// force cURL use
38
-	public var $proxy = null;			// proxy information (associative array)
35
+	public var $ch = false; // cURL handle
36
+	public var $ch_options = array(); // cURL custom options
37
+	public var $use_curl = false; // force cURL use
38
+	public var $proxy = null; // proxy information (associative array)
39 39
 	public var $username = '';
40 40
 	public var $password = '';
41 41
 	public var $authtype = '';
42 42
 	public var $digestRequest = array();
43
-	public var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
43
+	public var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
44 44
 								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
45 45
 								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
46 46
 								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	* @param boolean $use_curl Whether to try to force cURL use
58 58
 	* @access public
59 59
 	*/
60
-	public function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
60
+	public function soap_transport_http($url, $curl_options = NULL, $use_curl = false) {
61 61
 		parent::nusoap_base();
62 62
 		$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
63 63
 		$this->appendDebug($this->varDump($curl_options));
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 		$this->use_curl = $use_curl;
69 69
 		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
70
-		$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
70
+		$this->setHeader('User-Agent', $this->title . '/' . $this->version . ' (' . $rev[1] . ')');
71 71
 	}
72 72
 
73 73
 	/**
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 		$this->url = $url;
119 119
 
120 120
 		$u = parse_url($url);
121
-		foreach($u as $k => $v){
121
+		foreach ($u as $k => $v) {
122 122
 			$this->debug("parsed URL $k = $v");
123 123
 			$this->$k = $v;
124 124
 		}
125 125
 		
126 126
 		// add any GET params to path
127
-		if(isset($u['query']) && $u['query'] != ''){
127
+		if (isset($u['query']) && $u['query'] != '') {
128 128
             $this->path .= '?' . $u['query'];
129 129
 		}
130 130
 		
131 131
 		// set default port
132
-		if(!isset($u['port'])){
133
-			if($u['scheme'] == 'https'){
132
+		if (!isset($u['port'])) {
133
+			if ($u['scheme'] == 'https') {
134 134
 				$this->port = 443;
135 135
 			} else {
136 136
 				$this->port = 80;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		if (!isset($u['port'])) {
145 145
 			$this->setHeader('Host', $this->host);
146 146
 		} else {
147
-			$this->setHeader('Host', $this->host.':'.$this->port);
147
+			$this->setHeader('Host', $this->host . ':' . $this->port);
148 148
 		}
149 149
 
150 150
 		if (isset($u['user']) && $u['user'] != '') {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return	boolean true if connected, false if not
175 175
 	* @access   private
176 176
 	*/
177
-	public function connect($connection_timeout=0,$response_timeout=30){
177
+	public function connect($connection_timeout = 0, $response_timeout = 30) {
178 178
 	  $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
179 179
 	  if ($this->io_method() == 'socket') {
180 180
 		if (!is_array($this->proxy)) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		}
187 187
 
188 188
 		// use persistent connection
189
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
189
+		if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) {
190 190
 			if (!feof($this->fp)) {
191 191
 				$this->debug('Re-use persistent connection');
192 192
 				return true;
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
 		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
203 203
 
204 204
 		// open socket
205
-		if($connection_timeout > 0){
206
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
205
+		if ($connection_timeout > 0) {
206
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout);
207 207
 		} else {
208
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
208
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str);
209 209
 		}
210 210
 		
211 211
 		// test pointer
212
-		if(!$this->fp) {
212
+		if (!$this->fp) {
213 213
 			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
214 214
 			if ($this->errno) {
215
-				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
215
+				$msg .= ', Error (' . $this->errno . '): ' . $this->error_str;
216 216
 			} else {
217 217
 				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
218 218
 			}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		
224 224
 		// set response timeout
225 225
 		$this->debug('set response timeout to ' . $response_timeout);
226
-		socket_set_timeout( $this->fp, $response_timeout);
226
+		socket_set_timeout($this->fp, $response_timeout);
227 227
 
228 228
 		$this->debug('socket connected');
229 229
 		return true;
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
 		if (is_array($this->proxy)) {
363 363
 			$this->debug('set cURL proxy options');
364 364
 			if ($this->proxy['port'] != '') {
365
-				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']);
365
+				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'] . ':' . $this->proxy['port']);
366 366
 			} else {
367 367
 				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']);
368 368
 			}
369 369
 			if ($this->proxy['username'] || $this->proxy['password']) {
370 370
 				$this->debug('set cURL proxy authentication options');
371
-				$this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']);
371
+				$this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'] . ':' . $this->proxy['password']);
372 372
 				if ($this->proxy['authtype'] == 'basic') {
373 373
 					$this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC);
374 374
 				}
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	* @return	string data
397 397
 	* @access   public
398 398
 	*/
399
-	public function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
399
+	public function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) {
400 400
 		
401
-		$this->debug('entered send() with data of length: '.strlen($data));
401
+		$this->debug('entered send() with data of length: ' . strlen($data));
402 402
 
403 403
 		$this->tryagain = true;
404 404
 		$tries = 0;
@@ -406,12 +406,12 @@  discard block
 block discarded – undo
406 406
 			$this->tryagain = false;
407 407
 			if ($tries++ < 2) {
408 408
 				// make connnection
409
-				if (!$this->connect($timeout, $response_timeout)){
409
+				if (!$this->connect($timeout, $response_timeout)) {
410 410
 					return false;
411 411
 				}
412 412
 				
413 413
 				// send request
414
-				if (!$this->sendRequest($data, $cookies)){
414
+				if (!$this->sendRequest($data, $cookies)) {
415 415
 					return false;
416 416
 				}
417 417
 				
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	* @access   public
438 438
 	* @deprecated
439 439
 	*/
440
-	public function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
440
+	public function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) {
441 441
 		return $this->send($data, $timeout, $response_timeout, $cookies);
442 442
 	}
443 443
 	
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		$this->appendDebug($this->varDump($certRequest));
459 459
 		// cf. RFC 2617
460 460
 		if ($authtype == 'basic') {
461
-			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
461
+			$this->setHeader('Authorization', 'Basic ' . base64_encode(str_replace(':', '', $username) . ':' . $password));
462 462
 		} elseif ($authtype == 'digest') {
463 463
 			if (isset($digestRequest['nonce'])) {
464 464
 				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
467 467
 	
468 468
 				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
469
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
469
+				$A1 = $username . ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
470 470
 	
471 471
 				// H(A1) = MD5(A1)
472 472
 				$HA1 = md5($A1);
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 				$A2 = $this->request_method . ':' . $this->digest_uri;
476 476
 	
477 477
 				// H(A2)
478
-				$HA2 =  md5($A2);
478
+				$HA2 = md5($A2);
479 479
 	
480 480
 				// KD(secret, data) = H(concat(secret, ":", data))
481 481
 				// if qop == auth:
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	* @param    string $enc encoding style. supported values: gzip, deflate, or both
536 536
 	* @access   public
537 537
 	*/
538
-	public function setEncoding($enc='gzip, deflate') {
538
+	public function setEncoding($enc = 'gzip, deflate') {
539 539
 		if (function_exists('gzdeflate')) {
540 540
 			$this->protocol_version = '1.1';
541 541
 			$this->setHeader('Accept-Encoding', $enc);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				'authtype' => $proxyauthtype
570 570
 			);
571 571
 			if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
572
-				$this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
572
+				$this->setHeader('Proxy-Authorization', ' Basic ' . base64_encode($proxyusername . ':' . $proxypassword));
573 573
 			}
574 574
 		} else {
575 575
 			$this->debug('remove proxy');
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 	 * @access	private
589 589
 	 */
590 590
 	public function isSkippableCurlHeader(&$data) {
591
-		$skipHeaders = array(	'HTTP/1.1 100',
591
+		$skipHeaders = array('HTTP/1.1 100',
592 592
 								'HTTP/1.0 301',
593 593
 								'HTTP/1.1 301',
594 594
 								'HTTP/1.0 302',
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	* @access   public
615 615
 	* @deprecated
616 616
 	*/
617
-	public function decodeChunked($buffer, $lb){
617
+	public function decodeChunked($buffer, $lb) {
618 618
 		// length := 0
619 619
 		$length = 0;
620 620
 		$new = '';
@@ -626,17 +626,17 @@  discard block
 block discarded – undo
626 626
 			$this->debug('no linebreak found in decodeChunked');
627 627
 			return $new;
628 628
 		}
629
-		$temp = substr($buffer,0,$chunkend);
630
-		$chunk_size = hexdec( trim($temp) );
629
+		$temp = substr($buffer, 0, $chunkend);
630
+		$chunk_size = hexdec(trim($temp));
631 631
 		$chunkstart = $chunkend + strlen($lb);
632 632
 		// while (chunk-size > 0) {
633 633
 		while ($chunk_size > 0) {
634 634
 			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
635
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
635
+			$chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size);
636 636
 		  	
637 637
 			// Just in case we got a broken connection
638 638
 		  	if ($chunkend === false) {
639
-		  	    $chunk = substr($buffer,$chunkstart);
639
+		  	    $chunk = substr($buffer, $chunkstart);
640 640
 				// append chunk-data to entity-body
641 641
 		    	$new .= $chunk;
642 642
 		  	    $length += strlen($chunk);
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			}
645 645
 			
646 646
 		  	// read chunk-data and CRLF
647
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
647
+		  	$chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart);
648 648
 		  	// append chunk-data to entity-body
649 649
 		  	$new .= $chunk;
650 650
 		  	// length := length + chunk-size
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 			if ($chunkend === false) {
657 657
 				break; //Just in case we got a broken connection
658 658
 			}
659
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
660
-			$chunk_size = hexdec( trim($temp) );
659
+			$temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
660
+			$chunk_size = hexdec(trim($temp));
661 661
 			$chunkstart = $chunkend;
662 662
 		}
663 663
 		return $new;
@@ -692,15 +692,15 @@  discard block
 block discarded – undo
692 692
 		$this->outgoing_payload = "$req\r\n";
693 693
 
694 694
 		// loop thru headers, serializing
695
-		foreach($this->outgoing_headers as $k => $v){
696
-			$hdr = $k.': '.$v;
695
+		foreach ($this->outgoing_headers as $k => $v) {
696
+			$hdr = $k . ': ' . $v;
697 697
 			$this->debug("HTTP header: $hdr");
698 698
 			$this->outgoing_payload .= "$hdr\r\n";
699 699
 		}
700 700
 
701 701
 		// add any cookies
702 702
 		if ($cookie_str != '') {
703
-			$hdr = 'Cookie: '.$cookie_str;
703
+			$hdr = 'Cookie: ' . $cookie_str;
704 704
 			$this->debug("HTTP header: $hdr");
705 705
 			$this->outgoing_payload .= "$hdr\r\n";
706 706
 		}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 	  if ($this->io_method() == 'socket') {
731 731
 		// send payload
732
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
732
+		if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
733 733
 			$this->setError('couldn\'t write message data to socket');
734 734
 			$this->debug('couldn\'t write message data to socket');
735 735
 			return false;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 		// turns out that the URI and HTTP version are appended to this, which
743 743
 		// some servers refuse to work with (so we no longer use this method!)
744 744
 		$curl_headers = array();
745
-		foreach($this->outgoing_headers as $k => $v){
745
+		foreach ($this->outgoing_headers as $k => $v) {
746 746
 			if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
747 747
 				$this->debug("Skip cURL header $k: $v");
748 748
 			} else {
@@ -776,16 +776,16 @@  discard block
 block discarded – undo
776 776
 	* @return	string the response (also sets member variables like incoming_payload)
777 777
 	* @access   private
778 778
 	*/
779
-	public function getResponse(){
779
+	public function getResponse() {
780 780
 		$this->incoming_payload = '';
781 781
 	    
782 782
 	  if ($this->io_method() == 'socket') {
783 783
 	    // loop until headers have been retrieved
784 784
 	    $data = '';
785
-	    while (!isset($lb)){
785
+	    while (!isset($lb)) {
786 786
 
787 787
 			// We might EOF during header read.
788
-			if(feof($this->fp)) {
788
+			if (feof($this->fp)) {
789 789
 				$this->incoming_payload = $data;
790 790
 				$this->debug('found no headers before EOF after length ' . strlen($data));
791 791
 				$this->debug("received before EOF:\n" . $data);
@@ -806,17 +806,17 @@  discard block
 block discarded – undo
806 806
 			}
807 807
 
808 808
 			$data .= $tmp;
809
-			$pos = strpos($data,"\r\n\r\n");
810
-			if($pos > 1){
809
+			$pos = strpos($data, "\r\n\r\n");
810
+			if ($pos > 1) {
811 811
 				$lb = "\r\n";
812 812
 			} else {
813
-				$pos = strpos($data,"\n\n");
814
-				if($pos > 1){
813
+				$pos = strpos($data, "\n\n");
814
+				if ($pos > 1) {
815 815
 					$lb = "\n";
816 816
 				}
817 817
 			}
818 818
 			// remove 100 headers
819
-			if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
819
+			if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) {
820 820
 				unset($lb);
821 821
 				$data = '';
822 822
 			}//
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 		$this->incoming_payload .= $data;
826 826
 		$this->debug('found end of headers after length ' . strlen($data));
827 827
 		// process headers
828
-		$header_data = trim(substr($data,0,$pos));
829
-		$header_array = explode($lb,$header_data);
828
+		$header_data = trim(substr($data, 0, $pos));
829
+		$header_array = explode($lb, $header_data);
830 830
 		$this->incoming_headers = array();
831 831
 		$this->incoming_cookies = array();
832
-		foreach($header_array as $header_line){
833
-			$arr = explode(':',$header_line, 2);
834
-			if(count($arr) > 1){
832
+		foreach ($header_array as $header_line) {
833
+			$arr = explode(':', $header_line, 2);
834
+			if (count($arr) > 1) {
835 835
 				$header_name = strtolower(trim($arr[0]));
836 836
 				$this->incoming_headers[$header_name] = trim($arr[1]);
837 837
 				if ($header_name == 'set-cookie') {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		// loop until msg has been received
853 853
 		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
854
-			$content_length =  2147483647;	// ignore any content-length header
854
+			$content_length = 2147483647; // ignore any content-length header
855 855
 			$chunked = true;
856 856
 			$this->debug("want to read chunked content");
857 857
 		} elseif (isset($this->incoming_headers['content-length'])) {
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 			$chunked = false;
860 860
 			$this->debug("want to read content of length $content_length");
861 861
 		} else {
862
-			$content_length =  2147483647;
862
+			$content_length = 2147483647;
863 863
 			$chunked = false;
864 864
 			$this->debug("want to read content to EOF");
865 865
 		}
@@ -913,19 +913,19 @@  discard block
 block discarded – undo
913 913
 		}
914 914
 		$this->debug('read body of length ' . strlen($data));
915 915
 		$this->incoming_payload .= $data;
916
-		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
916
+		$this->debug('received a total of ' . strlen($this->incoming_payload) . ' bytes of data from server');
917 917
 		
918 918
 		// close filepointer
919
-		if(
919
+		if (
920 920
 			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
921
-			(! $this->persistentConnection) || feof($this->fp)){
921
+			(!$this->persistentConnection) || feof($this->fp)) {
922 922
 			fclose($this->fp);
923 923
 			$this->fp = false;
924 924
 			$this->debug('closed socket');
925 925
 		}
926 926
 		
927 927
 		// connection was closed unexpectedly
928
-		if($this->incoming_payload == ''){
928
+		if ($this->incoming_payload == '') {
929 929
 			$this->setError('no response from server');
930 930
 			return false;
931 931
 		}
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
 
950 950
         $cErr = curl_error($this->ch);
951 951
 		if ($cErr != '') {
952
-        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
953
-			foreach(curl_getinfo($this->ch) as $k => $v){
952
+        	$err = 'cURL ERROR: ' . curl_errno($this->ch) . ': ' . $cErr . '<br>';
953
+			foreach (curl_getinfo($this->ch) as $k => $v) {
954 954
 				$err .= "$k: $v<br>";
955 955
 			}
956 956
 			$this->debug($err);
@@ -970,44 +970,44 @@  discard block
 block discarded – undo
970 970
 		$savedata = $data;
971 971
 		while ($this->isSkippableCurlHeader($data)) {
972 972
 			$this->debug("Found HTTP header to skip");
973
-			if ($pos = strpos($data,"\r\n\r\n")) {
974
-				$data = ltrim(substr($data,$pos));
975
-			} elseif($pos = strpos($data,"\n\n") ) {
976
-				$data = ltrim(substr($data,$pos));
973
+			if ($pos = strpos($data, "\r\n\r\n")) {
974
+				$data = ltrim(substr($data, $pos));
975
+			} elseif ($pos = strpos($data, "\n\n")) {
976
+				$data = ltrim(substr($data, $pos));
977 977
 			}
978 978
 		}
979 979
 
980 980
 		if ($data == '') {
981 981
 			// have nothing left; just remove 100 header(s)
982 982
 			$data = $savedata;
983
-			while (preg_match('/^HTTP\/1.1 100/',$data)) {
984
-				if ($pos = strpos($data,"\r\n\r\n")) {
985
-					$data = ltrim(substr($data,$pos));
986
-				} elseif($pos = strpos($data,"\n\n") ) {
987
-					$data = ltrim(substr($data,$pos));
983
+			while (preg_match('/^HTTP\/1.1 100/', $data)) {
984
+				if ($pos = strpos($data, "\r\n\r\n")) {
985
+					$data = ltrim(substr($data, $pos));
986
+				} elseif ($pos = strpos($data, "\n\n")) {
987
+					$data = ltrim(substr($data, $pos));
988 988
 				}
989 989
 			}
990 990
 		}
991 991
 		
992 992
 		// separate content from HTTP headers
993
-		if ($pos = strpos($data,"\r\n\r\n")) {
993
+		if ($pos = strpos($data, "\r\n\r\n")) {
994 994
 			$lb = "\r\n";
995
-		} elseif( $pos = strpos($data,"\n\n")) {
995
+		} elseif ($pos = strpos($data, "\n\n")) {
996 996
 			$lb = "\n";
997 997
 		} else {
998 998
 			$this->debug('no proper separation of headers and document');
999 999
 			$this->setError('no proper separation of headers and document');
1000 1000
 			return false;
1001 1001
 		}
1002
-		$header_data = trim(substr($data,0,$pos));
1003
-		$header_array = explode($lb,$header_data);
1004
-		$data = ltrim(substr($data,$pos));
1002
+		$header_data = trim(substr($data, 0, $pos));
1003
+		$header_array = explode($lb, $header_data);
1004
+		$data = ltrim(substr($data, $pos));
1005 1005
 		$this->debug('found proper separation of headers and document');
1006
-		$this->debug('cleaned data, stringlen: '.strlen($data));
1006
+		$this->debug('cleaned data, stringlen: ' . strlen($data));
1007 1007
 		// clean headers
1008 1008
 		foreach ($header_array as $header_line) {
1009
-			$arr = explode(':',$header_line,2);
1010
-			if(count($arr) > 1){
1009
+			$arr = explode(':', $header_line, 2);
1010
+			if (count($arr) > 1) {
1011 1011
 				$header_name = strtolower(trim($arr[0]));
1012 1012
 				$this->incoming_headers[$header_name] = trim($arr[1]);
1013 1013
 				if ($header_name == 'set-cookie') {
@@ -1077,10 +1077,10 @@  discard block
 block discarded – undo
1077 1077
 		}
1078 1078
 
1079 1079
 		// decode content-encoding
1080
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
1081
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
1080
+		if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') {
1081
+			if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') {
1082 1082
     			// if decoding works, use it. else assume data wasn't gzencoded
1083
-    			if(function_exists('gzinflate')){
1083
+    			if (function_exists('gzinflate')) {
1084 1084
 					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
1085 1085
 					// this means there are no Zlib headers, although there should be
1086 1086
 					$this->debug('The gzinflate function exists');
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 					}
1121 1121
 					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
1122 1122
 					// set decoded payload
1123
-					$this->incoming_payload = $header_data.$lb.$lb.$data;
1123
+					$this->incoming_payload = $header_data . $lb . $lb . $data;
1124 1124
     			} else {
1125 1125
 					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
1126 1126
 					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 			$this->debug('No Content-Encoding header');
1134 1134
 		}
1135 1135
 		
1136
-		if(strlen($data) == 0){
1136
+		if (strlen($data) == 0) {
1137 1137
 			$this->debug('no data after headers!');
1138 1138
 			$this->setError('no data present after HTTP headers');
1139 1139
 			return false;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return	boolean whether the request was honored by this method.
1160 1160
 	 * @access	public
1161 1161
 	 */
1162
-	public function usePersistentConnection(){
1162
+	public function usePersistentConnection() {
1163 1163
 		if (isset($this->outgoing_headers['Accept-Encoding'])) {
1164 1164
 			return false;
1165 1165
 		}
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 		$cookie_param = 'path=';
1204 1204
 		$start = strpos($cookie_str, $cookie_param);
1205
-		if ( $start > 0 ) {
1205
+		if ($start > 0) {
1206 1206
 			$path = substr($cookie_str, $start + strlen($cookie_param));
1207 1207
 			$path = substr($path, 0, strpos($path, ';'));
1208 1208
 		} else {
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 		if ($sep_pos) {
1222 1222
 			$name = substr($value_str, 0, $sep_pos);
1223 1223
 			$value = substr($value_str, $sep_pos + 1);
1224
-			$cookie= array(	'name' => $name,
1224
+			$cookie = array('name' => $name,
1225 1225
 			                'value' => $value,
1226 1226
 							'domain' => $domain,
1227 1227
 							'path' => $path,
@@ -1241,35 +1241,35 @@  discard block
 block discarded – undo
1241 1241
 	 * @return	string for Cookie-HTTP-Header
1242 1242
 	 * @access	private
1243 1243
 	 */
1244
-	public function getCookiesForRequest($cookies, $secure=false) {
1244
+	public function getCookiesForRequest($cookies, $secure = false) {
1245 1245
 		$cookie_str = '';
1246
-		if ((! is_null($cookies)) && (is_array($cookies))) {
1246
+		if ((!is_null($cookies)) && (is_array($cookies))) {
1247 1247
 			foreach ($cookies as $cookie) {
1248
-				if (! is_array($cookie)) {
1248
+				if (!is_array($cookie)) {
1249 1249
 					continue;
1250 1250
 				}
1251
-	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
1252
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
1251
+	    		$this->debug("check cookie for validity: " . $cookie['name'] . '=' . $cookie['value']);
1252
+				if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
1253 1253
 					if (strtotime($cookie['expires']) <= time()) {
1254 1254
 						$this->debug('cookie has expired');
1255 1255
 						continue;
1256 1256
 					}
1257 1257
 				}
1258
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
1258
+				if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
1259 1259
 					$domain = preg_quote($cookie['domain']);
1260
-					if (! preg_match("'.*$domain$'i", $this->host)) {
1260
+					if (!preg_match("'.*$domain$'i", $this->host)) {
1261 1261
 						$this->debug('cookie has different domain');
1262 1262
 						continue;
1263 1263
 					}
1264 1264
 				}
1265
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
1265
+				if ((isset($cookie['path'])) && (!empty($cookie['path']))) {
1266 1266
 					$path = preg_quote($cookie['path']);
1267
-					if (! preg_match("'^$path.*'i", $this->path)) {
1267
+					if (!preg_match("'^$path.*'i", $this->path)) {
1268 1268
 						$this->debug('cookie is for a different path');
1269 1269
 						continue;
1270 1270
 					}
1271 1271
 				}
1272
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1272
+				if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1273 1273
 					$this->debug('cookie is secure, transport is not');
1274 1274
 					continue;
1275 1275
 				}
Please login to merge, or discard this patch.
libraries/nusoap/nusoap.php 1 patch
Spacing   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2217,8 +2217,8 @@  discard block
 block discarded – undo
2217 2217
 	public var $persistentConnection = false;
2218 2218
 	public var $ch = false; // cURL handle
2219 2219
 	public var $ch_options = array(); // cURL custom options
2220
-	public var $use_curl = false;  // force cURL use
2221
-	public var $proxy = null;   // proxy information (associative array)
2220
+	public var $use_curl = false; // force cURL use
2221
+	public var $proxy = null; // proxy information (associative array)
2222 2222
 	public var $username = '';
2223 2223
 	public var $password = '';
2224 2224
 	public var $authtype = '';
@@ -2654,7 +2654,7 @@  discard block
 block discarded – undo
2654 2654
 			$this->setHeader('Authorization', 'Basic ' . base64_encode(str_replace(':', '', $username) . ':' . $password));
2655 2655
 		} elseif ($authtype == 'digest') {
2656 2656
 			if (isset($digestRequest['nonce'])) {
2657
-				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc'] ++ : 1;
2657
+				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
2658 2658
 
2659 2659
 				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
2660 2660
 				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
@@ -4104,7 +4104,7 @@  discard block
 block discarded – undo
4104 4104
 			$call_arg = array($class, $method);
4105 4105
 		} else {
4106 4106
 			$this->debug('in invoke_method, calling instance method using call_user_func_array()');
4107
-			$instance = new $class ();
4107
+			$instance = new $class();
4108 4108
 			$call_arg = array(&$instance, $method);
4109 4109
 		}
4110 4110
 		if (is_array($this->methodparams)) {
@@ -4660,12 +4660,12 @@  discard block
 block discarded – undo
4660 4660
 	public var $timeout = 0;
4661 4661
 	public var $response_timeout = 30;
4662 4662
 	public var $curl_options = array(); // User-specified cURL options
4663
-	public var $use_curl = false;   // whether to always try to use cURL
4663
+	public var $use_curl = false; // whether to always try to use cURL
4664 4664
 	// for HTTP authentication
4665 4665
 	public var $username = ''; // Username for HTTP authentication
4666 4666
 	public var $password = ''; // Password for HTTP authentication
4667 4667
 	public var $authtype = ''; // Type of HTTP authentication
4668
-	public var $certRequest = array();  // Certificate for HTTP SSL authentication
4668
+	public var $certRequest = array(); // Certificate for HTTP SSL authentication
4669 4669
 
4670 4670
 	/**
4671 4671
 	 * constructor
@@ -4779,11 +4779,9 @@  discard block
 block discarded – undo
4779 4779
 				foreach ($bindingData['operations'] as $operation => $data) {
4780 4780
 					$this->debug('post-parse data gathering for ' . $operation);
4781 4781
 					$this->bindings[$binding]['operations'][$operation]['input'] = isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4782
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) :
4783
-						$this->portTypes[$bindingData['portType']][$operation]['input'];
4782
+						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input'];
4784 4783
 					$this->bindings[$binding]['operations'][$operation]['output'] = isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4785
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) :
4786
-						$this->portTypes[$bindingData['portType']][$operation]['output'];
4784
+						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output'];
4787 4785
 					if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) {
4788 4786
 						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']];
4789 4787
 					}
@@ -6303,7 +6301,7 @@  discard block
 block discarded – undo
6303 6301
 					}
6304 6302
 				}
6305 6303
 				// if user took advantage of a minOccurs=0, then only serialize named parameters
6306
-				if (isset($optionals) && (!isset($xvalue[$eName])) && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6304
+				if (isset($optionals) && (!isset($xvalue[$eName])) && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6307 6305
 				) {
6308 6306
 					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
6309 6307
 						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
@@ -6547,7 +6545,7 @@  discard block
 block discarded – undo
6547 6545
 	public var $root_struct_name = '';
6548 6546
 	public var $root_struct_namespace = '';
6549 6547
 	public var $root_header = '';
6550
-	public var $document = '';   // incoming SOAP body (text)
6548
+	public var $document = ''; // incoming SOAP body (text)
6551 6549
 	// determines where in the message we are (envelope,header,body,method)
6552 6550
 	public var $status = '';
6553 6551
 	public var $position = 0;
@@ -6563,7 +6561,7 @@  discard block
 block discarded – undo
6563 6561
 	public var $depth_array = array();
6564 6562
 	public var $debug_flag = true;
6565 6563
 	public var $soapresponse = NULL; // parsed SOAP Body
6566
-	public var $soapheader = NULL;  // parsed SOAP Header
6564
+	public var $soapheader = NULL; // parsed SOAP Header
6567 6565
 	public var $responseHeaders = ''; // incoming SOAP headers (text)
6568 6566
 	public var $body_position = 0;
6569 6567
 	// for multiref parsing:
Please login to merge, or discard this patch.
libraries/nusoap/class.soap_parser.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	public var $root_struct_name = '';
22 22
 	public var $root_struct_namespace = '';
23 23
 	public var $root_header = '';
24
-    var $document = '';			// incoming SOAP body (text)
24
+    var $document = ''; // incoming SOAP body (text)
25 25
 	// determines where in the message we are (envelope,header,body,method)
26 26
 	public var $status = '';
27 27
 	public var $position = 0;
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	public var $fault_detail = '';
37 37
 	public var $depth_array = array();
38 38
 	public var $debug_flag = true;
39
-	public var $soapresponse = NULL;	// parsed SOAP Body
40
-	public var $soapheader = NULL;		// parsed SOAP Header
41
-	public var $responseHeaders = '';	// incoming SOAP headers (text)
39
+	public var $soapresponse = NULL; // parsed SOAP Body
40
+	public var $soapheader = NULL; // parsed SOAP Header
41
+	public var $responseHeaders = ''; // incoming SOAP headers (text)
42 42
 	public var $body_position = 0;
43 43
 	// for multiref parsing:
44 44
 	// array of id => pos
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	* @param    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
58 58
 	* @access   public
59 59
 	*/
60
-	public function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
60
+	public function nusoap_parser($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true) {
61 61
 		parent::nusoap_base();
62 62
 		$this->xml = $xml;
63 63
 		$this->xml_encoding = $encoding;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$this->decode_utf8 = $decode_utf8;
66 66
 
67 67
 		// Check whether content has been read.
68
-		if(!empty($xml)){
68
+		if (!empty($xml)) {
69 69
 			// Check XML encoding
70 70
 			$pos_xml = strpos($xml, '<?xml');
71 71
 			if ($pos_xml !== false) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			} else {
90 90
 				$this->debug('No XML declaration');
91 91
 			}
92
-			$this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
92
+			$this->debug('Entering nusoap_parser(), length=' . strlen($xml) . ', encoding=' . $encoding);
93 93
 			// Create an XML parser - why not xml_parser_create_ns?
94 94
 			$this->parser = xml_parser_create($this->xml_encoding);
95 95
 			// Set the options for parsing the XML data.
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 			// Set the object for the parser.
100 100
 			xml_set_object($this->parser, $this);
101 101
 			// Set the element handlers for the parser.
102
-			xml_set_element_handler($this->parser, 'start_element','end_element');
103
-			xml_set_character_data_handler($this->parser,'character_data');
102
+			xml_set_element_handler($this->parser, 'start_element', 'end_element');
103
+			xml_set_character_data_handler($this->parser, 'character_data');
104 104
 
105 105
 			// Parse the XML file.
106
-			if(!xml_parse($this->parser,$xml,true)){
106
+			if (!xml_parse($this->parser, $xml, true)) {
107 107
 			    // Display an error message.
108 108
 			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
109 109
 			    xml_get_current_line_number($this->parser),
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 			} else {
115 115
 				$this->debug('in nusoap_parser ctor, message:');
116 116
 				$this->appendDebug($this->varDump($this->message));
117
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
117
+				$this->debug('parsed successfully, found root struct: ' . $this->root_struct . ' of name ' . $this->root_struct_name);
118 118
 				// get final value
119 119
 				$this->soapresponse = $this->message[$this->root_struct]['result'];
120 120
 				// get header value
121
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
121
+				if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
122 122
 					$this->soapheader = $this->message[$this->root_header]['result'];
123 123
 				}
124 124
 				// resolve hrefs/ids
125
-				if(sizeof($this->multirefs) > 0){
126
-					foreach($this->multirefs as $id => $hrefs){
127
-						$this->debug('resolving multirefs for id: '.$id);
125
+				if (sizeof($this->multirefs) > 0) {
126
+					foreach ($this->multirefs as $id => $hrefs) {
127
+						$this->debug('resolving multirefs for id: ' . $id);
128 128
 						$idVal = $this->buildVal($this->ids[$id]);
129 129
 						if (is_array($idVal) && isset($idVal['!id'])) {
130 130
 							unset($idVal['!id']);
131 131
 						}
132
-						foreach($hrefs as $refPos => $ref){
133
-							$this->debug('resolving href at pos '.$refPos);
132
+						foreach ($hrefs as $refPos => $ref) {
133
+							$this->debug('resolving href at pos ' . $refPos);
134 134
 							$this->multirefs[$id][$refPos] = $idVal;
135 135
 						}
136 136
 					}
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 		// update class level pos
157 157
 		$pos = $this->position++;
158 158
 		// and set mine
159
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
159
+		$this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>'');
160 160
 		// depth = how many levels removed from root?
161 161
 		// set mine as current global depth and increment global depth value
162 162
 		$this->message[$pos]['depth'] = $this->depth++;
163 163
 
164 164
 		// else add self as child to whoever the current parent is
165
-		if($pos != 0){
166
-			$this->message[$this->parent]['children'] .= '|'.$pos;
165
+		if ($pos != 0) {
166
+			$this->message[$this->parent]['children'] .= '|' . $pos;
167 167
 		}
168 168
 		// set my parent
169 169
 		$this->message[$pos]['parent'] = $this->parent;
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 		// set self as current value for this depth
173 173
 		$this->depth_array[$this->depth] = $pos;
174 174
 		// get element prefix
175
-		if(strpos($name,':')){
175
+		if (strpos($name, ':')) {
176 176
 			// get ns prefix
177
-			$prefix = substr($name,0,strpos($name,':'));
177
+			$prefix = substr($name, 0, strpos($name, ':'));
178 178
 			// get unqualified name
179
-			$name = substr(strstr($name,':'),1);
179
+			$name = substr(strstr($name, ':'), 1);
180 180
 		}
181 181
 		// set status
182 182
 		if ($name == 'Envelope' && $this->status == '') {
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 		} elseif ($name == 'Header' && $this->status == 'envelope') {
185 185
 			$this->root_header = $pos;
186 186
 			$this->status = 'header';
187
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
187
+		} elseif ($name == 'Body' && $this->status == 'envelope') {
188 188
 			$this->status = 'body';
189 189
 			$this->body_position = $pos;
190 190
 		// set method
191
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
191
+		} elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) {
192 192
 			$this->status = 'method';
193 193
 			$this->root_struct_name = $name;
194 194
 			$this->root_struct = $pos;
@@ -204,23 +204,23 @@  discard block
 block discarded – undo
204 204
 
205 205
 		// loop through atts, logging ns and type declarations
206 206
         $attstr = '';
207
-		foreach($attrs as $key => $value){
207
+		foreach ($attrs as $key => $value) {
208 208
         	$key_prefix = $this->getPrefix($key);
209 209
 			$key_localpart = $this->getLocalPart($key);
210 210
 			// if ns declarations, add to class level array of valid namespaces
211
-            if($key_prefix == 'xmlns'){
212
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
211
+            if ($key_prefix == 'xmlns') {
212
+				if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) {
213 213
 					$this->XMLSchemaVersion = $value;
214 214
 					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
215
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
215
+					$this->namespaces['xsi'] = $this->XMLSchemaVersion . '-instance';
216 216
 				}
217 217
                 $this->namespaces[$key_localpart] = $value;
218 218
 				// set method namespace
219
-				if($name == $this->root_struct_name){
219
+				if ($name == $this->root_struct_name) {
220 220
 					$this->methodNamespace = $value;
221 221
 				}
222 222
 			// if it's a type declaration, set type
223
-        } elseif($key_localpart == 'type'){
223
+        } elseif ($key_localpart == 'type') {
224 224
         		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
225 225
         			// do nothing: already processed arrayType
226 226
         		} else {
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	                $value_localpart = $this->getLocalPart($value);
229 229
 					$this->message[$pos]['type'] = $value_localpart;
230 230
 					$this->message[$pos]['typePrefix'] = $value_prefix;
231
-	                if(isset($this->namespaces[$value_prefix])){
231
+	                if (isset($this->namespaces[$value_prefix])) {
232 232
 	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
233
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
234
-						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
233
+	                } else if (isset($attrs['xmlns:' . $value_prefix])) {
234
+						$this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix];
235 235
 	                }
236 236
 					// should do something here with the namespace of specified type?
237 237
 				}
238
-			} elseif($key_localpart == 'arrayType'){
238
+			} elseif ($key_localpart == 'arrayType') {
239 239
 				$this->message[$pos]['type'] = 'array';
240 240
 				/* do arrayType ereg here
241 241
 				[1]    arrayTypeValue    ::=    atype asize
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
 				[6]    nextDimension    ::=    Digit+ ','
247 247
 				*/
248 248
 				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
249
-				if(preg_match($expr,$value,$regs)){
249
+				if (preg_match($expr, $value, $regs)) {
250 250
 					$this->message[$pos]['typePrefix'] = $regs[1];
251 251
 					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
252 252
 	                if (isset($this->namespaces[$regs[1]])) {
253 253
 	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
254
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
255
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
254
+	                } else if (isset($attrs['xmlns:' . $regs[1]])) {
255
+						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:' . $regs[1]];
256 256
 	                }
257 257
 					$this->message[$pos]['arrayType'] = $regs[2];
258 258
 					$this->message[$pos]['arraySize'] = $regs[3];
259 259
 					$this->message[$pos]['arrayCols'] = $regs[4];
260 260
 				}
261 261
 			// specifies nil value (or not)
262
-			} elseif ($key_localpart == 'nil'){
262
+			} elseif ($key_localpart == 'nil') {
263 263
 				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
264 264
 			// some other attribute
265 265
 			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 				$this->default_namespace = $value;
271 271
 			}
272 272
 			// log id
273
-			if($key == 'id'){
273
+			if ($key == 'id') {
274 274
 				$this->ids[$value] = $pos;
275 275
 			}
276 276
 			// root
277
-			if($key_localpart == 'root' && $value == 1){
277
+			if ($key_localpart == 'root' && $value == 1) {
278 278
 				$this->status = 'method';
279 279
 				$this->root_struct_name = $name;
280 280
 				$this->root_struct = $pos;
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
             $attstr .= " $key=\"$value\"";
285 285
 		}
286 286
         // get namespace - must be done after namespace atts are processed
287
-		if(isset($prefix)){
287
+		if (isset($prefix)) {
288 288
 			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
289 289
 			$this->default_namespace = $this->namespaces[$prefix];
290 290
 		} else {
291 291
 			$this->message[$pos]['namespace'] = $this->default_namespace;
292 292
 		}
293
-        if($this->status == 'header'){
293
+        if ($this->status == 'header') {
294 294
         	if ($this->root_header != $pos) {
295 295
 	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
296 296
 	        }
297
-        } elseif($this->root_struct_name != ''){
297
+        } elseif ($this->root_struct_name != '') {
298 298
         	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
299 299
         }
300 300
 	}
@@ -311,27 +311,27 @@  discard block
 block discarded – undo
311 311
 		$pos = $this->depth_array[$this->depth--];
312 312
 
313 313
         // get element prefix
314
-		if(strpos($name,':')){
314
+		if (strpos($name, ':')) {
315 315
 			// get ns prefix
316
-			$prefix = substr($name,0,strpos($name,':'));
316
+			$prefix = substr($name, 0, strpos($name, ':'));
317 317
 			// get unqualified name
318
-			$name = substr(strstr($name,':'),1);
318
+			$name = substr(strstr($name, ':'), 1);
319 319
 		}
320 320
 		
321 321
 		// build to native type
322
-		if(isset($this->body_position) && $pos > $this->body_position){
322
+		if (isset($this->body_position) && $pos > $this->body_position) {
323 323
 			// deal w/ multirefs
324
-			if(isset($this->message[$pos]['attrs']['href'])){
324
+			if (isset($this->message[$pos]['attrs']['href'])) {
325 325
 				// get id
326
-				$id = substr($this->message[$pos]['attrs']['href'],1);
326
+				$id = substr($this->message[$pos]['attrs']['href'], 1);
327 327
 				// add placeholder to href array
328 328
 				$this->multirefs[$id][$pos] = 'placeholder';
329 329
 				// add set a reference to it as the result value
330
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
330
+				$this->message[$pos]['result'] = & $this->multirefs[$id][$pos];
331 331
             // build complexType values
332
-			} elseif($this->message[$pos]['children'] != ''){
332
+			} elseif ($this->message[$pos]['children'] != '') {
333 333
 				// if result has already been generated (struct/array)
334
-				if(!isset($this->message[$pos]['result'])){
334
+				if (!isset($this->message[$pos]['result'])) {
335 335
 					$this->message[$pos]['result'] = $this->buildVal($pos);
336 336
 				}
337 337
 			// build complexType values of attributes and possibly simpleContent
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
 		}
381 381
 		
382 382
         // for doclit
383
-        if($this->status == 'header'){
383
+        if ($this->status == 'header') {
384 384
         	if ($this->root_header != $pos) {
385 385
 	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
386 386
 	        }
387
-        } elseif($pos >= $this->root_struct){
387
+        } elseif ($pos >= $this->root_struct) {
388 388
         	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389 389
         }
390 390
 		// switch status
391
-		if ($pos == $this->root_struct){
391
+		if ($pos == $this->root_struct) {
392 392
 			$this->status = 'body';
393 393
 			$this->root_struct_namespace = $this->message[$pos]['namespace'];
394 394
 		} elseif ($pos == $this->root_header) {
@@ -411,16 +411,16 @@  discard block
 block discarded – undo
411 411
 	* @param    string $data element content
412 412
 	* @access   private
413 413
 	*/
414
-	public function character_data($parser, $data){
414
+	public function character_data($parser, $data) {
415 415
 		$pos = $this->depth_array[$this->depth];
416
-		if ($this->xml_encoding=='UTF-8'){
417
-			if($this->decode_utf8){
416
+		if ($this->xml_encoding == 'UTF-8') {
417
+			if ($this->decode_utf8) {
418 418
 				$data = utf8_decode($data);
419 419
 			}
420 420
 		}
421 421
         $this->message[$pos]['cdata'] .= $data;
422 422
         // for doclit
423
-        if($this->status == 'header'){
423
+        if ($this->status == 'header') {
424 424
         	$this->responseHeaders .= $data;
425 425
         } else {
426 426
         	$this->document .= $data;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	* @access   public
435 435
 	* @deprecated	use get_soapbody instead
436 436
 	*/
437
-	public function get_response(){
437
+	public function get_response() {
438 438
 		return $this->soapresponse;
439 439
 	}
440 440
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	* @return	mixed
445 445
 	* @access   public
446 446
 	*/
447
-	public function get_soapbody(){
447
+	public function get_soapbody() {
448 448
 		return $this->soapresponse;
449 449
 	}
450 450
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	* @return	mixed
455 455
 	* @access   public
456 456
 	*/
457
-	public function get_soapheader(){
457
+	public function get_soapheader() {
458 458
 		return $this->soapheader;
459 459
 	}
460 460
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	* @return	string XML or empty if no Header
465 465
 	* @access   public
466 466
 	*/
467
-	public function getHeaders(){
467
+	public function getHeaders() {
468 468
 	    return $this->responseHeaders;
469 469
 	}
470 470
 
@@ -520,55 +520,55 @@  discard block
 block discarded – undo
520 520
 	* @return	mixed	PHP value
521 521
 	* @access   private
522 522
 	*/
523
-	public function buildVal($pos){
524
-		if(!isset($this->message[$pos]['type'])){
523
+	public function buildVal($pos) {
524
+		if (!isset($this->message[$pos]['type'])) {
525 525
 			$this->message[$pos]['type'] = '';
526 526
 		}
527
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
527
+		$this->debug('in buildVal() for ' . $this->message[$pos]['name'] . "(pos $pos) of type " . $this->message[$pos]['type']);
528 528
 		// if there are children...
529
-		if($this->message[$pos]['children'] != ''){
529
+		if ($this->message[$pos]['children'] != '') {
530 530
 			$this->debug('in buildVal, there are children');
531
-			$children = explode('|',$this->message[$pos]['children']);
531
+			$children = explode('|', $this->message[$pos]['children']);
532 532
 			array_shift($children); // knock off empty
533 533
 			// md array
534
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
535
-            	$r=0; // rowcount
536
-            	$c=0; // colcount
537
-            	foreach($children as $child_pos){
534
+			if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
535
+            	$r = 0; // rowcount
536
+            	$c = 0; // colcount
537
+            	foreach ($children as $child_pos) {
538 538
 					$this->debug("in buildVal, got an MD array element: $r, $c");
539 539
 					$params[$r][] = $this->message[$child_pos]['result'];
540 540
 				    $c++;
541
-				    if($c == $this->message[$pos]['arrayCols']){
541
+				    if ($c == $this->message[$pos]['arrayCols']) {
542 542
 				    	$c = 0;
543 543
 						$r++;
544 544
 				    }
545 545
                 }
546 546
             // array
547
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
548
-                $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
549
-                foreach($children as $child_pos){
547
+			} elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
548
+                $this->debug('in buildVal, adding array ' . $this->message[$pos]['name']);
549
+                foreach ($children as $child_pos) {
550 550
                 	$params[] = &$this->message[$child_pos]['result'];
551 551
                 }
552 552
             // apache Map type: java hashtable
553
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
554
-                $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
555
-                foreach($children as $child_pos){
556
-                	$kv = explode("|",$this->message[$child_pos]['children']);
553
+            } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
554
+                $this->debug('in buildVal, Java Map ' . $this->message[$pos]['name']);
555
+                foreach ($children as $child_pos) {
556
+                	$kv = explode("|", $this->message[$child_pos]['children']);
557 557
                    	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
558 558
                 }
559 559
             // generic compound type
560 560
             //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
561 561
 		    } else {
562 562
 	    		// Apache Vector type: treat as an array
563
-                $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
563
+                $this->debug('in buildVal, adding Java Vector or generic compound type ' . $this->message[$pos]['name']);
564 564
 				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
565 565
 					$notstruct = 1;
566 566
 				} else {
567 567
 					$notstruct = 0;
568 568
 	            }
569 569
             	//
570
-            	foreach($children as $child_pos){
571
-            		if($notstruct){
570
+            	foreach ($children as $child_pos) {
571
+            		if ($notstruct) {
572 572
             			$params[] = &$this->message[$child_pos]['result'];
573 573
             		} else {
574 574
             			if (isset($params[$this->message[$child_pos]['name']])) {
Please login to merge, or discard this patch.
libraries/freetag/freetag.class.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @access private
66 66
 	 * @param string Whether to prevent multiple vtiger_users from tagging the same object. By default, set to block (ala Upcoming.org)
67 67
 	 */
68
-	public var $_block_multiuser_tag_on_object =0;
68
+	public var $_block_multiuser_tag_on_object = 0;
69 69
 
70 70
 	/**
71 71
 	 * @access private
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return An array of Object ID numbers that reference your original objects.
152 152
 	 */ 
153 153
 	public function get_objects_with_tag($tag, $offset = 0, $limit = 100, $tagger_id = NULL) {
154
-		if(!isset($tag)) {
154
+		if (!isset($tag)) {
155 155
 			return false;
156 156
 		}		
157 157
 		$adb = PearDatabase::getInstance();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$where = "tag = ? ";
160 160
 		$params = array($tag);
161 161
 
162
-		if(isset($tagger_id) && ($tagger_id > 0)) {
162
+		if (isset($tagger_id) && ($tagger_id > 0)) {
163 163
 			$where .= "AND tagger_id = ? ";
164 164
 			array_push($params, $tagger_id);
165 165
 		} 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @return An array of Object ID numbers that reference your original objects.
198 198
 	 */ 
199 199
 	public function get_objects_with_tag_all($tag, $tagger_id = NULL) {
200
-		if(!isset($tag)) {
200
+		if (!isset($tag)) {
201 201
 			return false;
202 202
 		}		
203 203
 		$adb = PearDatabase::getInstance();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$where = "tag = ? ";
206 206
 		$params = array($tag);
207 207
 
208
-		if(isset($tagger_id) && ($tagger_id > 0)) {
208
+		if (isset($tagger_id) && ($tagger_id > 0)) {
209 209
 			$where .= "AND tagger_id = ? ";
210 210
 			array_push($params, $tagger_id);
211 211
 		} 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			return $retarr;
250 250
 		}
251 251
 		$params = array($tagArray);
252
-		if(isset($tagger_id) && ($tagger_id > 0)) {
252
+		if (isset($tagger_id) && ($tagger_id > 0)) {
253 253
 			$tagger_sql = "AND tagger_id = ?";
254 254
 			array_push($params, $tagger_id);
255 255
 		} else {
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$sql = "SELECT ${prefix}freetagged_objects.object_id, tag, COUNT(DISTINCT tag) AS uniques
271 271
 			FROM ${prefix}freetagged_objects 
272 272
 			INNER JOIN ${prefix}freetags ON (${prefix}freetagged_objects.tag_id = ${prefix}freetags.id)
273
-			WHERE ${prefix}freetags.tag IN (". generateQuestionMarks($tagArray) .")
273
+			WHERE ${prefix}freetags.tag IN (" . generateQuestionMarks($tagArray) . ")
274 274
 			$tagger_sql
275 275
 			GROUP BY ${prefix}freetagged_objects.object_id
276 276
 			HAVING uniques = $numTags
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return An array of Object ID numbers that reference your original objects.
301 301
 	 */ 
302 302
 	public function get_objects_with_tag_id($tag_id, $offset = 0, $limit = 100, $tagger_id = NULL) {
303
-		if(!isset($tag_id)) {
303
+		if (!isset($tag_id)) {
304 304
 			return false;
305 305
 		}		
306 306
 		$adb = PearDatabase::getInstance();
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		$where = "id = ? ";
309 309
 		$params = array($tag_id);
310 310
 		
311
-		if(isset($tagger_id) && ($tagger_id > 0)) {
311
+		if (isset($tagger_id) && ($tagger_id > 0)) {
312 312
 			$where .= "AND tagger_id = ?";
313 313
 			array_push($params, $tagger_id);
314 314
 		} 
@@ -349,19 +349,19 @@  discard block
 block discarded – undo
349 349
 	 *	 - 'tagger_id' => The unique ID of the person who tagged the object with this tag.
350 350
 	 */ 
351 351
 	public function get_tags_on_object($object_id, $offset = 0, $limit = 10, $tagger_id = NULL) {
352
-		if(!isset($object_id)) {
352
+		if (!isset($object_id)) {
353 353
 			return false;
354 354
 		}	
355 355
 		
356 356
 		$where = "object_id = ? ";
357 357
 		$params = array($object_id);
358 358
 			
359
-		if(isset($tagger_id) && ($tagger_id > 0)) {
359
+		if (isset($tagger_id) && ($tagger_id > 0)) {
360 360
 			$where .= "AND tagger_id = ? ";
361 361
 			array_push($params, $tagger_id);
362 362
 		} 
363 363
 
364
-		if($limit <= 0) {
364
+		if ($limit <= 0) {
365 365
 			$limit_sql = "";
366 366
 		} else {
367 367
 			$limit_sql = "LIMIT $offset, $limit";
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 */ 
407 407
 
408 408
 	public function safe_tag($tagger_id, $object_id, $tag, $module) {
409
-		if(!isset($tagger_id)||!isset($object_id)||!isset($tag)) {
409
+		if (!isset($tagger_id) || !isset($object_id) || !isset($tag)) {
410 410
 			die("safe_tag argument missing");
411 411
 			return false;
412 412
 		}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			
434 434
 		array_push($params, $object_id, $normalized_tag);
435 435
 		$rs = $adb->pquery($sql, $params);
436
-		if($rs->fields['count'] > 0) {
436
+		if ($rs->fields['count'] > 0) {
437 437
 			return true;
438 438
 		}
439 439
 		// Then see if a raw tag in this form exists.
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 			WHERE raw_tag = ? ";
443 443
 		$rs = $adb->pquery($sql, array($tag));
444 444
 		$row = $adb->fetch_array($rs);
445
-		if($row) {
445
+		if ($row) {
446 446
 			$tag_id = $row['id'];
447 447
 		} else {
448 448
 			// Add new tag! 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 			$rs = $adb->pquery($sql, $params);
453 453
 			
454 454
 		}
455
-		if(!($tag_id > 0)) {
455
+		if (!($tag_id > 0)) {
456 456
 			return false;
457 457
 		}
458 458
 		$sql = "INSERT INTO ${prefix}freetagged_objects
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
 	 * @return string Returns the tag in normalized form.
510 510
 	 */ 
511 511
 	public function delete_object_tag($tagger_id, $object_id, $tag) {
512
-		if(!isset($tagger_id)||!isset($object_id)||!isset($tag)) {
512
+		if (!isset($tagger_id) || !isset($object_id) || !isset($tag)) {
513 513
 			die("delete_object_tag argument missing");
514 514
 			return false;
515 515
 		}
516 516
 		$adb = PearDatabase::getInstance();
517 517
 		$tag_id = $this->get_raw_tag_id($tag);
518 518
 		$prefix = $this->_table_prefix;
519
-		if($tag_id > 0) {
519
+		if ($tag_id > 0) {
520 520
 
521 521
 			$sql = "DELETE FROM ${prefix}freetagged_objects
522 522
 				WHERE tagger_id = ? && object_id = ? && tag_id = ? LIMIT 1";
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	public function delete_all_object_tags($object_id) {
544 544
 		$adb = PearDatabase::getInstance();
545 545
 		$prefix = $this->_table_prefix;
546
-		if($object_id > 0) {
546
+		if ($object_id > 0) {
547 547
 			$sql = "DELETE FROM ${prefix}freetagged_objects
548 548
 				WHERE object_id = ? ";	
549 549
 				$rs = $adb->pquery($sql, array($object_id));	
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 	 */ 
571 571
 
572 572
 	public function delete_all_object_tags_for_user($tagger_id, $object_id) {
573
-		if(!isset($tagger_id)||!isset($object_id)) {
573
+		if (!isset($tagger_id) || !isset($object_id)) {
574 574
 			die("delete_all_object_tags_for_user argument missing");
575 575
 			return false;
576 576
 		}
577 577
 		$adb = PearDatabase::getInstance();
578 578
 		$prefix = $this->_table_prefix;
579
-		if($object_id > 0) {
579
+		if ($object_id > 0) {
580 580
 
581 581
 			$sql = "DELETE FROM ${prefix}freetagged_objects
582 582
 				WHERE tagger_id = ? && object_id = ?";	
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 * @return string Returns the tag in normalized form.
601 601
 	 */ 
602 602
 	public function get_tag_id($tag) {
603
-		if(!isset($tag)) {
603
+		if (!isset($tag)) {
604 604
 			die("get_tag_id argument missing");
605 605
 			return false;
606 606
 		}
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 */ 
629 629
 
630 630
 	public function get_raw_tag_id($tag) {
631
-		if(!isset($tag)) {
631
+		if (!isset($tag)) {
632 632
 			die("get_tag_id argument missing");
633 633
 			return false;
634 634
 		}
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	 * @return string Returns the tag in normalized form.
662 662
 	 */
663 663
 	public function tag_object($tagger_id, $object_id, $tag_string, $module, $skip_updates = 1) {
664
-		if($tag_string == '') {
664
+		if ($tag_string == '') {
665 665
 			// If an empty string was passed, just return true, don't die.
666 666
 			// die("Empty tag string passed");
667 667
 			return true;
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
 	 * @return boolean True if successful, false otherwise.
703 703
 	 */
704 704
 	public function _tag_object_array($tagger_id, $object_id, $tagArray, $module) {
705
-		foreach($tagArray as $tag) {
705
+		foreach ($tagArray as $tag) {
706 706
 			$tag = trim($tag);
707
-			if(($tag != '') && (strlen($tag) <= $this->_MAX_TAG_LENGTH)) {
708
-				if(get_magic_quotes_gpc()) {
707
+			if (($tag != '') && (strlen($tag) <= $this->_MAX_TAG_LENGTH)) {
708
+				if (get_magic_quotes_gpc()) {
709 709
 					$tag = addslashes($tag);
710 710
 				}
711 711
 				$this->safe_tag($tagger_id, $object_id, $tag, $module);
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 			return $newwords;
732 732
 		}
733 733
 		# Perform tag parsing
734
-		if(get_magic_quotes_gpc()) {
734
+		if (get_magic_quotes_gpc()) {
735 735
 			$query = stripslashes(trim($tag_string));
736 736
 		} else {
737 737
 			$query = trim($tag_string);
738 738
 		}
739
-		$words = preg_split('/(")/', $query,-1,PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
739
+		$words = preg_split('/(")/', $query, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
740 740
 		$delim = 0;
741 741
 		foreach ($words as $key => $word)
742 742
 		{
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 	public function get_most_popular_tags($tagger_id = NULL, $offset = 0, $limit = 25) {
783 783
 		$adb = PearDatabase::getInstance();
784 784
 		$params = array();
785
-		if(isset($tagger_id) && ($tagger_id > 0)) {
785
+		if (isset($tagger_id) && ($tagger_id > 0)) {
786 786
 			$tagger_sql = "AND tagger_id = ?";
787 787
 			array_push($params, $tagger_id);
788 788
 		} else {
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 	public function count_tags($tagger_id = NULL) {
827 827
 		$adb = PearDatabase::getInstance();
828 828
 		$params = array();
829
-		if(isset($tagger_id) && ($tagger_id > 0)) {
829
+		if (isset($tagger_id) && ($tagger_id > 0)) {
830 830
 			$tagger_sql = "AND tagger_id = ?";
831 831
 			array_push($params, $tagger_id);
832 832
 		} else {
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 	 * @return string Returns an HTML snippet that can be used directly as a tag cloud.
871 871
 	 */
872 872
 
873
-	public function get_tag_cloud_html($module="",$tagger_id = NULL,$obj_id= NULL,$num_tags = 100, $min_font_size = 10, $max_font_size = 20, $font_units = 'px', $span_class = '', $tag_page_url = '/tag/') {
873
+	public function get_tag_cloud_html($module = "", $tagger_id = NULL, $obj_id = NULL, $num_tags = 100, $min_font_size = 10, $max_font_size = 20, $font_units = 'px', $span_class = '', $tag_page_url = '/tag/') {
874 874
 		global $theme;
875
-		$theme_path="themes/".$theme."/";
876
-		$image_path=$theme_path."images/";	
877
-		$tag_list = $this->get_tag_cloud_tags($num_tags, $tagger_id,$module,$obj_id);
875
+		$theme_path = "themes/" . $theme . "/";
876
+		$image_path = $theme_path . "images/";	
877
+		$tag_list = $this->get_tag_cloud_tags($num_tags, $tagger_id, $module, $obj_id);
878 878
 		if (count($tag_list[0])) {
879 879
 			// Get the maximum qty of tagged objects in the set
880 880
 			$max_qty = max(array_values($tag_list[0]));
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 		if (0 == $spread) { // Divide by zero
891 891
 			$spread = 1;
892 892
 		}
893
-		$step = ($max_font_size - $min_font_size)/($spread);
893
+		$step = ($max_font_size - $min_font_size) / ($spread);
894 894
 
895 895
 		// Since the original tag_list is alphabetically ordered,
896 896
 		// we can now create the tag cloud by just putting a span
@@ -898,18 +898,18 @@  discard block
 block discarded – undo
898 898
 		// by $step.
899 899
 		$cloud_html = '';
900 900
 		$cloud_spans = array();
901
-		if($module =='')
901
+		if ($module == '')
902 902
 			$module = 'All';
903
-		if($module != 'All') {
903
+		if ($module != 'All') {
904 904
 			foreach ($tag_list[0] as $tag => $qty) {
905 905
 				$size = $min_font_size + ($qty - $min_qty) * $step;
906
-				$cloud_span[] = '<span id="tag_'.$tag_list[1][$tag].'" class="' . $span_class . '" onMouseOver=$("tagspan_'.$tag_list[1][$tag].'").style.display="inline"; onMouseOut=$("tagspan_'.$tag_list[1][$tag].'").style.display="none";><a class="tagit" href="index.php?module=Home&action=UnifiedSearch&search_module='.$module.'&search_tag=tag_search&query_string='. urlencode($tag) . '" style="font-size: '. $size . $font_units . '">' . htmlspecialchars(stripslashes($tag)) . '</a><span class="'. $span_class .'" id="tagspan_'.$tag_list[1][$tag].'" style="display:none;cursor:pointer;" onClick="DeleteTag('.$tag_list[1][$tag].','.$obj_id.');"><img src="' . vtiger_imageurl('del_tag.gif', $theme) . '"></span></span>';
906
+				$cloud_span[] = '<span id="tag_' . $tag_list[1][$tag] . '" class="' . $span_class . '" onMouseOver=$("tagspan_' . $tag_list[1][$tag] . '").style.display="inline"; onMouseOut=$("tagspan_' . $tag_list[1][$tag] . '").style.display="none";><a class="tagit" href="index.php?module=Home&action=UnifiedSearch&search_module=' . $module . '&search_tag=tag_search&query_string=' . urlencode($tag) . '" style="font-size: ' . $size . $font_units . '">' . htmlspecialchars(stripslashes($tag)) . '</a><span class="' . $span_class . '" id="tagspan_' . $tag_list[1][$tag] . '" style="display:none;cursor:pointer;" onClick="DeleteTag(' . $tag_list[1][$tag] . ',' . $obj_id . ');"><img src="' . vtiger_imageurl('del_tag.gif', $theme) . '"></span></span>';
907 907
 
908 908
 			}
909 909
 		} else {
910
-			foreach($tag_list[0] as $tag => $qty) {
910
+			foreach ($tag_list[0] as $tag => $qty) {
911 911
 				$size = $min_font_size + ($qty - $min_qty) * $step;
912
-				$cloud_span[] = '<span class="' . $span_class . '"><a class="tagit" href="index.php?module=Home&action=UnifiedSearch&search_module='.$module.'&search_tag=tag_search&query_string='. urlencode($tag) . '" style="font-size: '. $size . $font_units . '">' . htmlspecialchars(stripslashes($tag)) . '</a></span>';
912
+				$cloud_span[] = '<span class="' . $span_class . '"><a class="tagit" href="index.php?module=Home&action=UnifiedSearch&search_module=' . $module . '&search_tag=tag_search&query_string=' . urlencode($tag) . '" style="font-size: ' . $size . $font_units . '">' . htmlspecialchars(stripslashes($tag)) . '</a></span>';
913 913
 			}
914 914
 		}
915 915
 		$cloud_html = join("\n ", $cloud_span);
@@ -934,24 +934,24 @@  discard block
 block discarded – undo
934 934
 	 * values are numeric quantity of objects tagged with that tag.
935 935
 	 */
936 936
 
937
-	public function get_tag_cloud_tags($max = 100, $tagger_id = NULL,$module = "",$obj_id = NULL) {
937
+	public function get_tag_cloud_tags($max = 100, $tagger_id = NULL, $module = "", $obj_id = NULL) {
938 938
 		$adb = PearDatabase::getInstance();
939 939
 		$params = array();
940
-		if(isset($tagger_id) && ($tagger_id > 0)) {
940
+		if (isset($tagger_id) && ($tagger_id > 0)) {
941 941
 			$tagger_sql = " && tagger_id = ?";
942 942
 			array_push($params, $tagger_id);
943 943
 		} else {
944 944
 			$tagger_sql = "";
945 945
 		}
946 946
 
947
-		if($module != "") {
947
+		if ($module != "") {
948 948
 			$tagger_sql .= " && module = ?";
949 949
 			array_push($params, $module);
950 950
 		} else {
951 951
 			$tagger_sql .= "";
952 952
 		}
953 953
 
954
-		if(isset($obj_id) && $obj_id > 0) {
954
+		if (isset($obj_id) && $obj_id > 0) {
955 955
   			$tagger_sql .= " && object_id = ?";
956 956
 			array_push($params, $obj_id);
957 957
 		} else {
@@ -974,10 +974,10 @@  discard block
 block discarded – undo
974 974
 			$retarr[$row['tag']] = $row['quantity'];
975 975
 			$retarr1[$row['tag']] = $row['tag_id'];
976 976
 		}
977
-		if($retarr) ksort($retarr);
978
-		if($retarr1) ksort($retarr1);
979
-		$return_value[]=$retarr;
980
-		$return_value[]=$retarr1;
977
+		if ($retarr) ksort($retarr);
978
+		if ($retarr1) ksort($retarr1);
979
+		$return_value[] = $retarr;
980
+		$return_value[] = $retarr1;
981 981
 		return $return_value;
982 982
 
983 983
 	}
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 	public function similar_tags($tag, $max = 100) {
1012 1012
 		$retarr = array();
1013
-		if(!isset($tag)) {
1013
+		if (!isset($tag)) {
1014 1014
 			return $retarr;
1015 1015
 		}
1016 1016
 		$adb = PearDatabase::getInstance();
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		$sql = "SELECT matches.object_id, COUNT( matches.object_id ) AS num_common_tags
1100 1100
 			FROM ${prefix}freetagged_objects as matches
1101 1101
 			INNER JOIN ${prefix}freetags as tags ON ( tags.id = matches.tag_id )
1102
-			WHERE tags.tag IN (". generateQuestionMarks($tagArray) .")
1102
+			WHERE tags.tag IN (" . generateQuestionMarks($tagArray) . ")
1103 1103
 			GROUP BY matches.object_id
1104 1104
 			HAVING num_common_tags >= ?
1105 1105
 			ORDER BY num_common_tags DESC
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 		$rs = $adb->pquery($sql, array($tagArray, $threshold, $max_objects));
1109 1109
 		while ($row = $adb->fetch_array($rs)) {
1110
-			$retarr[] = array (
1110
+			$retarr[] = array(
1111 1111
 				'object_id' => $row['object_id'],
1112 1112
 				'strength' => ($row['num_common_tags'] / $numTags)
1113 1113
 				);
Please login to merge, or discard this patch.
vtlib/thirdparty/dUnzip2.inc.php 1 patch
Spacing   +11 added lines, -18 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	public var $fileName;
81 81
 	public var $compressedList; // You will problably use only this one!
82 82
 	public var $centralDirList; // Central dir list... It's a kind of 'extra attributes' for a set of files
83
-	public var $endOfCentral;   // End of central dir, contains ZIP Comments
83
+	public var $endOfCentral; // End of central dir, contains ZIP Comments
84 84
 	public var $debug;
85 85
 	// Private
86 86
 	public var $fh;
@@ -188,15 +188,13 @@  discard block
 block discarded – undo
188 188
 	{
189 189
 		return
190 190
 			isset($this->centralDirList[$compressedFileName]) ?
191
-			$this->centralDirList[$compressedFileName] :
192
-			false;
191
+			$this->centralDirList[$compressedFileName] : false;
193 192
 	}
194 193
 
195 194
 	public function getZipInfo($detail = false)
196 195
 	{
197 196
 		return $detail ?
198
-			$this->endOfCentral[$detail] :
199
-			$this->endOfCentral;
197
+			$this->endOfCentral[$detail] : $this->endOfCentral;
200 198
 	}
201 199
 
202 200
 	public function unzip($compressedFileName, $targetFileName = false, $applyChmod = 0644)
@@ -218,8 +216,7 @@  discard block
 block discarded – undo
218 216
 		if (!$fdetails['uncompressed_size']) {
219 217
 			$this->debugMsg(1, "File '<b>$compressedFileName</b>' is empty.");
220 218
 			return $targetFileName ?
221
-				file_put_contents($targetFileName, "") :
222
-				"";
219
+				file_put_contents($targetFileName, "") : "";
223 220
 		}
224 221
 
225 222
 		fseek($this->fh, $fdetails['contents-startOffset']);
@@ -263,8 +260,7 @@  discard block
 block discarded – undo
263 260
 					continue;
264 261
 
265 262
 				$maintainStructure ?
266
-						$this->unzip($fileName, "$targetDir/$fileName", $applyChmod) :
267
-						$this->unzip($fileName, "$targetDir/" . basename($fileName), $applyChmod);
263
+						$this->unzip($fileName, "$targetDir/$fileName", $applyChmod) : $this->unzip($fileName, "$targetDir/" . basename($fileName), $applyChmod);
268 264
 			}
269 265
 	}
270 266
 
@@ -286,8 +282,7 @@  discard block
 block discarded – undo
286 282
 			case 0:
287 283
 				// Not compressed
288 284
 				return $targetFileName ?
289
-					file_put_contents($targetFileName, $content) :
290
-					$content;
285
+					file_put_contents($targetFileName, $content) : $content;
291 286
 			case 1:
292 287
 				$this->debugMsg(2, "Shrunk mode is not supported... yet?");
293 288
 				return false;
@@ -306,8 +301,7 @@  discard block
 block discarded – undo
306 301
 			case 8:
307 302
 				// Deflate
308 303
 				return $targetFileName ?
309
-					file_put_contents($targetFileName, gzinflate($content, $uncompressedSize)) :
310
-					gzinflate($content, $uncompressedSize);
304
+					file_put_contents($targetFileName, gzinflate($content, $uncompressedSize)) : gzinflate($content, $uncompressedSize);
311 305
 			case 9:
312 306
 				$this->debugMsg(2, "Enhanced Deflating is not supported... yet?");
313 307
 				return false;
@@ -317,8 +311,7 @@  discard block
 block discarded – undo
317 311
 			case 12:
318 312
 				// Bzip2
319 313
 				return $targetFileName ?
320
-					file_put_contents($targetFileName, bzdecompress($content)) :
321
-					bzdecompress($content);
314
+					file_put_contents($targetFileName, bzdecompress($content)) : bzdecompress($content);
322 315
 			case 18:
323 316
 				$this->debugMsg(2, "IBM TERSE is not supported... yet?");
324 317
 				return false;
@@ -378,7 +371,7 @@  discard block
 block discarded – undo
378 371
 					$dir['compression_method'] = unpack("v", fread($fh, 2)); // compression method
379 372
 					$dir['lastmod_time'] = unpack("v", fread($fh, 2)); // last mod file time
380 373
 					$dir['lastmod_date'] = unpack("v", fread($fh, 2)); // last mod file date
381
-					$dir['crc-32'] = fread($fh, 4);	 // crc-32
374
+					$dir['crc-32'] = fread($fh, 4); // crc-32
382 375
 					$dir['compressed_size'] = unpack("V", fread($fh, 4)); // compressed size
383 376
 					$dir['uncompressed_size'] = unpack("V", fread($fh, 4)); // uncompressed size
384 377
 					$fileNameLength = unpack("v", fread($fh, 2)); // filename length
@@ -389,7 +382,7 @@  discard block
 block discarded – undo
389 382
 					$dir['external_attributes1'] = unpack("v", fread($fh, 2)); // external file attributes-byte2
390 383
 					$dir['external_attributes2'] = unpack("v", fread($fh, 2)); // external file attributes
391 384
 					$dir['relative_offset'] = unpack("V", fread($fh, 4)); // relative offset of local header
392
-					$dir['file_name'] = fread($fh, $fileNameLength[1]);		// filename
385
+					$dir['file_name'] = fread($fh, $fileNameLength[1]); // filename
393 386
 					$dir['extra_field'] = $extraFieldLength[1] ? fread($fh, $extraFieldLength[1]) : ''; // extra field
394 387
 					$dir['file_comment'] = $fileCommentLength[1] ? fread($fh, $fileCommentLength[1]) : ''; // file comment			
395 388
 					// Convert the date and time, from MS-DOS format to UNIX Timestamp
@@ -489,7 +482,7 @@  discard block
 block discarded – undo
489 482
 			$file['compression_method'] = unpack("v", fread($fh, 2)); // compression method
490 483
 			$file['lastmod_time'] = unpack("v", fread($fh, 2)); // last mod file time
491 484
 			$file['lastmod_date'] = unpack("v", fread($fh, 2)); // last mod file date
492
-			$file['crc-32'] = fread($fh, 4);	 // crc-32
485
+			$file['crc-32'] = fread($fh, 4); // crc-32
493 486
 			$file['compressed_size'] = unpack("V", fread($fh, 4)); // compressed size
494 487
 			$file['uncompressed_size'] = unpack("V", fread($fh, 4)); // uncompressed size
495 488
 			$fileNameLength = unpack("v", fread($fh, 2)); // filename length
Please login to merge, or discard this patch.