@@ -10,6 +10,9 @@ |
||
| 10 | 10 | |
| 11 | 11 | require_once("include/Webservices/QueryParser.php"); |
| 12 | 12 | |
| 13 | +/** |
|
| 14 | + * @param string $q |
|
| 15 | + */ |
|
| 13 | 16 | function vtws_query($q, $user) |
| 14 | 17 | { |
| 15 | 18 | |
@@ -21,8 +21,9 @@ |
||
| 21 | 21 | // Cache the instance for re-use |
| 22 | 22 | $moduleRegex = "/[fF][rR][Oo][Mm]\s+([^\s;]+)/"; |
| 23 | 23 | $moduleName = ''; |
| 24 | - if (preg_match($moduleRegex, $q, $m)) |
|
| 25 | - $moduleName = trim($m[1]); |
|
| 24 | + if (preg_match($moduleRegex, $q, $m)) { |
|
| 25 | + $moduleName = trim($m[1]); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | if (!isset($vtws_create_cache[$moduleName]['webserviceobject'])) { |
| 28 | 29 | $webserviceObject = VtigerWebserviceObject::fromQuery($adb, $q); |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | include_once 'include/Webservices/Query.php'; |
| 13 | 13 | include_once 'include/Webservices/RelatedTypes.php'; |
| 14 | 14 | |
| 15 | +/** |
|
| 16 | + * @param string $query |
|
| 17 | + */ |
|
| 15 | 18 | function vtws_query_related($query, $id, $relatedLabel, $user, $filterClause = null) |
| 16 | 19 | { |
| 17 | 20 | |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | if (!empty($filterClause)) { |
| 72 | 72 | $query .= " " . $filterClause; |
| 73 | 73 | } |
| 74 | - $query.=";"; |
|
| 74 | + $query .= ";"; |
|
| 75 | 75 | $relatedRecords = vtws_query($query, $user); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -46,6 +46,9 @@ |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | + /** |
|
| 50 | + * @param integer $relationId |
|
| 51 | + */ |
|
| 49 | 52 | private function getRelationMetaInfo($relationId) |
| 50 | 53 | { |
| 51 | 54 | return [ |
@@ -112,6 +112,9 @@ discard block |
||
| 112 | 112 | return HTTP_Session::id(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | + /** |
|
| 116 | + * @param string $var_name |
|
| 117 | + */ |
|
| 115 | 118 | public function set($var_name, $var_value) |
| 116 | 119 | { |
| 117 | 120 | //TODO test setRef and getRef combination |
@@ -119,6 +122,9 @@ discard block |
||
| 119 | 122 | HTTP_Session::set($var_name, $var_value); |
| 120 | 123 | } |
| 121 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $name |
|
| 127 | + */ |
|
| 122 | 128 | public function get($name) |
| 123 | 129 | { |
| 124 | 130 | //echo "<br> getting for: ",$name," :value: ",HTTP_Session::get($name); |
@@ -5,6 +5,9 @@ discard block |
||
| 5 | 5 | $in_started = false; |
| 6 | 6 | $count = false; |
| 7 | 7 | |
| 8 | +/** |
|
| 9 | + * @param integer $count |
|
| 10 | + */ |
|
| 8 | 11 | function incrementN($lexer, $count) |
| 9 | 12 | { |
| 10 | 13 | $i = 0; |
@@ -160,6 +163,9 @@ discard block |
||
| 160 | 163 | } |
| 161 | 164 | } |
| 162 | 165 | |
| 166 | +/** |
|
| 167 | + * @param VTQL_Lexer $lexer |
|
| 168 | + */ |
|
| 163 | 169 | function handleend($lexer, $val) |
| 164 | 170 | { |
| 165 | 171 | return VTQL_Parser::SEMICOLON; |
@@ -179,6 +185,9 @@ discard block |
||
| 179 | 185 | public $mandatory; |
| 180 | 186 | public $current_state; |
| 181 | 187 | |
| 188 | + /** |
|
| 189 | + * @param string $data |
|
| 190 | + */ |
|
| 182 | 191 | public function __construct($data) |
| 183 | 192 | { |
| 184 | 193 | $this->index = 0; |
@@ -159,6 +159,9 @@ |
||
| 159 | 159 | private $syntax_error; |
| 160 | 160 | private $user; |
| 161 | 161 | |
| 162 | + /** |
|
| 163 | + * @param VTQL_Lexer $lex |
|
| 164 | + */ |
|
| 162 | 165 | public function __construct($user, $lex, $out) |
| 163 | 166 | { |
| 164 | 167 | if (!is_array($out)) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | |
| 91 | 91 | public $stateno; /* The state-number */ |
| 92 | - public $major; /* The major token value. This is the code |
|
| 92 | + public $major; /* The major token value. This is the code |
|
| 93 | 93 | * * number for the token at this stack level */ |
| 94 | 94 | public $minor; /* The user-supplied minor token value. This |
| 95 | 95 | * * is the value of the token */ |
@@ -663,17 +663,17 @@ discard block |
||
| 663 | 663 | /** |
| 664 | 664 | * @var int |
| 665 | 665 | */ |
| 666 | - public $yyidx; /* Index of top element in stack */ |
|
| 666 | + public $yyidx; /* Index of top element in stack */ |
|
| 667 | 667 | |
| 668 | 668 | /** |
| 669 | 669 | * @var int |
| 670 | 670 | */ |
| 671 | - public $yyerrcnt; /* Shifts left before out of the error */ |
|
| 671 | + public $yyerrcnt; /* Shifts left before out of the error */ |
|
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * @var array |
| 675 | 675 | */ |
| 676 | - public $yystack = []; /* The parser's stack */ |
|
| 676 | + public $yystack = []; /* The parser's stack */ |
|
| 677 | 677 | |
| 678 | 678 | /** |
| 679 | 679 | * For tracing shifts, the names of all terminals and nonterminals |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | * * which appear on the RHS of the rule, but which are not used |
| 783 | 783 | * * inside the C code. |
| 784 | 784 | */ |
| 785 | - default: break; /* If no destructor action specified: do nothing */ |
|
| 785 | + default: break; /* If no destructor action specified: do nothing */ |
|
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | { |
| 1609 | 1609 | // $yyact; /* The parser action. */ |
| 1610 | 1610 | // $yyendofinput; /* True if we are at the end of input */ |
| 1611 | - $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
| 1611 | + $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
| 1612 | 1612 | |
| 1613 | 1613 | /* (re)initialize the parser, if necessary */ |
| 1614 | 1614 | if ($this->yyidx === null || $this->yyidx < 0) { |
@@ -19,6 +19,11 @@ |
||
| 19 | 19 | return false; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param Vtiger_Request $request |
|
| 24 | + * |
|
| 25 | + * @return Vtiger_Request |
|
| 26 | + */ |
|
| 22 | 27 | public function setLanguage($request) |
| 23 | 28 | { |
| 24 | 29 | if (!$request->get('lang')) { |
@@ -87,8 +87,9 @@ |
||
| 87 | 87 | public function process(Vtiger_Request $request) |
| 88 | 88 | { |
| 89 | 89 | $default_charset = AppConfig::main('default_charset'); |
| 90 | - if (empty($default_charset)) |
|
| 91 | - $default_charset = 'UTF-8'; |
|
| 90 | + if (empty($default_charset)) { |
|
| 91 | + $default_charset = 'UTF-8'; |
|
| 92 | + } |
|
| 92 | 93 | $mode = $request->getMode(); |
| 93 | 94 | if (!empty($mode) && $this->isMethodExposed($mode)) { |
| 94 | 95 | return $this->$mode($request); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | * gets the current debug data for this instance |
| 308 | 308 | * |
| 309 | - * @return debug data |
|
| 309 | + * @return string data |
|
| 310 | 310 | * @access public |
| 311 | 311 | */ |
| 312 | 312 | public function &getDebug() { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * gets the current debug data for this instance as an XML comment |
| 320 | 320 | * this may change the contents of the debug data |
| 321 | 321 | * |
| 322 | - * @return debug data as an XML comment |
|
| 322 | + * @return string data as an XML comment |
|
| 323 | 323 | * @access public |
| 324 | 324 | */ |
| 325 | 325 | public function &getDebugAsXMLComment() { |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | /** |
| 353 | 353 | * returns error string if present |
| 354 | 354 | * |
| 355 | - * @return mixed error string or false |
|
| 355 | + * @return string|false error string or false |
|
| 356 | 356 | * @access public |
| 357 | 357 | */ |
| 358 | 358 | public function getError(){ |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | /** |
| 366 | 366 | * sets error string |
| 367 | 367 | * |
| 368 | - * @return boolean $string error string |
|
| 368 | + * @return boolean|null $string error string |
|
| 369 | 369 | * @access private |
| 370 | 370 | */ |
| 371 | 371 | public function setError($str){ |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | * returns false, if not prefixed |
| 801 | 801 | * |
| 802 | 802 | * @param string $str The prefixed string |
| 803 | - * @return mixed The prefix or false if there is no prefix |
|
| 803 | + * @return string|false The prefix or false if there is no prefix |
|
| 804 | 804 | * @access public |
| 805 | 805 | */ |
| 806 | 806 | public function getPrefix($str){ |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | * or false if no prefixes registered for the given namespace |
| 831 | 831 | * |
| 832 | 832 | * @param string $ns The namespace |
| 833 | - * @return mixed The prefix, false if the namespace has no prefixes |
|
| 833 | + * @return string The prefix, false if the namespace has no prefixes |
|
| 834 | 834 | * @access public |
| 835 | 835 | */ |
| 836 | 836 | public function getPrefixFromNamespace($ns) { |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | * |
| 897 | 897 | * @param int $timestamp Unix time stamp |
| 898 | 898 | * @param boolean $utc Whether the time stamp is UTC or local |
| 899 | -* @return mixed ISO 8601 date string or false |
|
| 899 | +* @return string|false ISO 8601 date string or false |
|
| 900 | 900 | * @access public |
| 901 | 901 | */ |
| 902 | 902 | function timestamp_to_iso8601($timestamp,$utc=true){ |
@@ -104,21 +104,21 @@ discard block |
||
| 104 | 104 | * @access private |
| 105 | 105 | */ |
| 106 | 106 | public $revision = '$Revision: 1.57 $'; |
| 107 | - /** |
|
| 108 | - * Current error string (manipulated by getError/setError) |
|
| 107 | + /** |
|
| 108 | + * Current error string (manipulated by getError/setError) |
|
| 109 | 109 | * |
| 110 | 110 | * @var string |
| 111 | 111 | * @access private |
| 112 | 112 | */ |
| 113 | 113 | public $error_str = ''; |
| 114 | - /** |
|
| 115 | - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) |
|
| 114 | + /** |
|
| 115 | + * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) |
|
| 116 | 116 | * |
| 117 | 117 | * @var string |
| 118 | 118 | * @access private |
| 119 | 119 | */ |
| 120 | - public $debug_str = ''; |
|
| 121 | - /** |
|
| 120 | + public $debug_str = ''; |
|
| 121 | + /** |
|
| 122 | 122 | * toggles automatic encoding of special characters as entities |
| 123 | 123 | * (should always be true, I think) |
| 124 | 124 | * |
@@ -134,31 +134,31 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public $debugLevel; |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * set schema version |
|
| 139 | - * |
|
| 140 | - * @var string |
|
| 141 | - * @access public |
|
| 142 | - */ |
|
| 137 | + /** |
|
| 138 | + * set schema version |
|
| 139 | + * |
|
| 140 | + * @var string |
|
| 141 | + * @access public |
|
| 142 | + */ |
|
| 143 | 143 | public $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; |
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * charset encoding for outgoing messages |
|
| 147 | - * |
|
| 148 | - * @var string |
|
| 149 | - * @access public |
|
| 150 | - */ |
|
| 151 | - public $soap_defencoding = 'UTF-8'; |
|
| 145 | + /** |
|
| 146 | + * charset encoding for outgoing messages |
|
| 147 | + * |
|
| 148 | + * @var string |
|
| 149 | + * @access public |
|
| 150 | + */ |
|
| 151 | + public $soap_defencoding = 'UTF-8'; |
|
| 152 | 152 | //var $soap_defencoding = 'UTF-8'; |
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | - * namespaces in an array of prefix => uri |
|
| 156 | - * |
|
| 157 | - * this is "seeded" by a set of constants, but it may be altered by code |
|
| 158 | - * |
|
| 159 | - * @var array |
|
| 160 | - * @access public |
|
| 161 | - */ |
|
| 155 | + * namespaces in an array of prefix => uri |
|
| 156 | + * |
|
| 157 | + * this is "seeded" by a set of constants, but it may be altered by code |
|
| 158 | + * |
|
| 159 | + * @var array |
|
| 160 | + * @access public |
|
| 161 | + */ |
|
| 162 | 162 | public $namespaces = array( |
| 163 | 163 | 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', |
| 164 | 164 | 'xsd' => 'http://www.w3.org/2001/XMLSchema', |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | - * namespaces used in the current context, e.g. during serialization |
|
| 171 | - * |
|
| 172 | - * @var array |
|
| 173 | - * @access private |
|
| 174 | - */ |
|
| 170 | + * namespaces used in the current context, e.g. during serialization |
|
| 171 | + * |
|
| 172 | + * @var array |
|
| 173 | + * @access private |
|
| 174 | + */ |
|
| 175 | 175 | public $usedNamespaces = array(); |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * XML Schema types in an array of uri => (array of xml type => php type) |
|
| 179 | - * is this legacy yet? |
|
| 180 | - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. |
|
| 181 | - * @var array |
|
| 182 | - * @access public |
|
| 183 | - */ |
|
| 178 | + * XML Schema types in an array of uri => (array of xml type => php type) |
|
| 179 | + * is this legacy yet? |
|
| 180 | + * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. |
|
| 181 | + * @var array |
|
| 182 | + * @access public |
|
| 183 | + */ |
|
| 184 | 184 | public $typemap = array( |
| 185 | 185 | 'http://www.w3.org/2001/XMLSchema' => array( |
| 186 | 186 | 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', |
@@ -203,75 +203,75 @@ discard block |
||
| 203 | 203 | 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), |
| 204 | 204 | 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), |
| 205 | 205 | 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), |
| 206 | - 'http://xml.apache.org/xml-soap' => array('Map') |
|
| 206 | + 'http://xml.apache.org/xml-soap' => array('Map') |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | - * XML entities to convert |
|
| 211 | - * |
|
| 212 | - * @var array |
|
| 213 | - * @access public |
|
| 214 | - * @deprecated |
|
| 215 | - * @see expandEntities |
|
| 216 | - */ |
|
| 210 | + * XML entities to convert |
|
| 211 | + * |
|
| 212 | + * @var array |
|
| 213 | + * @access public |
|
| 214 | + * @deprecated |
|
| 215 | + * @see expandEntities |
|
| 216 | + */ |
|
| 217 | 217 | public $xmlEntities = array('quot' => '"','amp' => '&', |
| 218 | 218 | 'lt' => '<','gt' => '>','apos' => "'"); |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * constructor |
|
| 222 | - * |
|
| 223 | - * @access public |
|
| 224 | - */ |
|
| 221 | + * constructor |
|
| 222 | + * |
|
| 223 | + * @access public |
|
| 224 | + */ |
|
| 225 | 225 | public function nusoap_base() { |
| 226 | 226 | $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * gets the global debug level, which applies to future instances |
|
| 231 | - * |
|
| 232 | - * @return integer Debug level 0-9, where 0 turns off |
|
| 233 | - * @access public |
|
| 234 | - */ |
|
| 230 | + * gets the global debug level, which applies to future instances |
|
| 231 | + * |
|
| 232 | + * @return integer Debug level 0-9, where 0 turns off |
|
| 233 | + * @access public |
|
| 234 | + */ |
|
| 235 | 235 | public function getGlobalDebugLevel() { |
| 236 | 236 | return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | - * sets the global debug level, which applies to future instances |
|
| 241 | - * |
|
| 242 | - * @param int $level Debug level 0-9, where 0 turns off |
|
| 243 | - * @access public |
|
| 244 | - */ |
|
| 240 | + * sets the global debug level, which applies to future instances |
|
| 241 | + * |
|
| 242 | + * @param int $level Debug level 0-9, where 0 turns off |
|
| 243 | + * @access public |
|
| 244 | + */ |
|
| 245 | 245 | public function setGlobalDebugLevel($level) { |
| 246 | 246 | $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * gets the debug level for this instance |
|
| 251 | - * |
|
| 252 | - * @return int Debug level 0-9, where 0 turns off |
|
| 253 | - * @access public |
|
| 254 | - */ |
|
| 250 | + * gets the debug level for this instance |
|
| 251 | + * |
|
| 252 | + * @return int Debug level 0-9, where 0 turns off |
|
| 253 | + * @access public |
|
| 254 | + */ |
|
| 255 | 255 | public function getDebugLevel() { |
| 256 | 256 | return $this->debugLevel; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | - * sets the debug level for this instance |
|
| 261 | - * |
|
| 262 | - * @param int $level Debug level 0-9, where 0 turns off |
|
| 263 | - * @access public |
|
| 264 | - */ |
|
| 260 | + * sets the debug level for this instance |
|
| 261 | + * |
|
| 262 | + * @param int $level Debug level 0-9, where 0 turns off |
|
| 263 | + * @access public |
|
| 264 | + */ |
|
| 265 | 265 | public function setDebugLevel($level) { |
| 266 | 266 | $this->debugLevel = $level; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | - * adds debug data to the instance debug string with formatting |
|
| 271 | - * |
|
| 272 | - * @param string $string debug data |
|
| 273 | - * @access private |
|
| 274 | - */ |
|
| 270 | + * adds debug data to the instance debug string with formatting |
|
| 271 | + * |
|
| 272 | + * @param string $string debug data |
|
| 273 | + * @access private |
|
| 274 | + */ |
|
| 275 | 275 | public function debug($string){ |
| 276 | 276 | if ($this->debugLevel > 0) { |
| 277 | 277 | $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * adds debug data to the instance debug string without formatting |
|
| 283 | - * |
|
| 284 | - * @param string $string debug data |
|
| 285 | - * @access public |
|
| 286 | - */ |
|
| 282 | + * adds debug data to the instance debug string without formatting |
|
| 283 | + * |
|
| 284 | + * @param string $string debug data |
|
| 285 | + * @access public |
|
| 286 | + */ |
|
| 287 | 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 |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | - * clears the current debug data for this instance |
|
| 297 | - * |
|
| 298 | - * @access public |
|
| 299 | - */ |
|
| 296 | + * clears the current debug data for this instance |
|
| 297 | + * |
|
| 298 | + * @access public |
|
| 299 | + */ |
|
| 300 | 300 | public function clearDebug() { |
| 301 | 301 | // it would be nice to use a memory stream here to use |
| 302 | 302 | // memory more efficiently |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | - * gets the current debug data for this instance |
|
| 308 | - * |
|
| 309 | - * @return debug data |
|
| 310 | - * @access public |
|
| 311 | - */ |
|
| 307 | + * gets the current debug data for this instance |
|
| 308 | + * |
|
| 309 | + * @return debug data |
|
| 310 | + * @access public |
|
| 311 | + */ |
|
| 312 | 312 | public function &getDebug() { |
| 313 | 313 | // it would be nice to use a memory stream here to use |
| 314 | 314 | // memory more efficiently |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | - * gets the current debug data for this instance as an XML comment |
|
| 320 | - * this may change the contents of the debug data |
|
| 321 | - * |
|
| 322 | - * @return debug data as an XML comment |
|
| 323 | - * @access public |
|
| 324 | - */ |
|
| 319 | + * gets the current debug data for this instance as an XML comment |
|
| 320 | + * this may change the contents of the debug data |
|
| 321 | + * |
|
| 322 | + * @return debug data as an XML comment |
|
| 323 | + * @access public |
|
| 324 | + */ |
|
| 325 | 325 | public function &getDebugAsXMLComment() { |
| 326 | 326 | // it would be nice to use a memory stream here to use |
| 327 | 327 | // memory more efficiently |
@@ -329,32 +329,32 @@ discard block |
||
| 329 | 329 | $this->debug_str = str_replace('--', '- -', $this->debug_str); |
| 330 | 330 | } |
| 331 | 331 | $ret = "<!--\n" . $this->debug_str . "\n-->"; |
| 332 | - return $ret; |
|
| 332 | + return $ret; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | - * expands entities, e.g. changes '<' to '<'. |
|
| 337 | - * |
|
| 338 | - * @param string $val The string in which to expand entities. |
|
| 339 | - * @access private |
|
| 340 | - */ |
|
| 336 | + * expands entities, e.g. changes '<' to '<'. |
|
| 337 | + * |
|
| 338 | + * @param string $val The string in which to expand entities. |
|
| 339 | + * @access private |
|
| 340 | + */ |
|
| 341 | 341 | public function expandEntities($val) { |
| 342 | 342 | if ($this->charencoding) { |
| 343 | - $val = str_replace('&', '&', $val); |
|
| 344 | - $val = str_replace("'", ''', $val); |
|
| 345 | - $val = str_replace('"', '"', $val); |
|
| 346 | - $val = str_replace('<', '<', $val); |
|
| 347 | - $val = str_replace('>', '>', $val); |
|
| 348 | - } |
|
| 349 | - return $val; |
|
| 343 | + $val = str_replace('&', '&', $val); |
|
| 344 | + $val = str_replace("'", ''', $val); |
|
| 345 | + $val = str_replace('"', '"', $val); |
|
| 346 | + $val = str_replace('<', '<', $val); |
|
| 347 | + $val = str_replace('>', '>', $val); |
|
| 348 | + } |
|
| 349 | + return $val; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | - * returns error string if present |
|
| 354 | - * |
|
| 355 | - * @return mixed error string or false |
|
| 356 | - * @access public |
|
| 357 | - */ |
|
| 353 | + * returns error string if present |
|
| 354 | + * |
|
| 355 | + * @return mixed error string or false |
|
| 356 | + * @access public |
|
| 357 | + */ |
|
| 358 | 358 | public function getError(){ |
| 359 | 359 | if($this->error_str != ''){ |
| 360 | 360 | return $this->error_str; |
@@ -363,24 +363,24 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | - * sets error string |
|
| 367 | - * |
|
| 368 | - * @return boolean $string error string |
|
| 369 | - * @access private |
|
| 370 | - */ |
|
| 366 | + * sets error string |
|
| 367 | + * |
|
| 368 | + * @return boolean $string error string |
|
| 369 | + * @access private |
|
| 370 | + */ |
|
| 371 | 371 | public function setError($str){ |
| 372 | 372 | $this->error_str = $str; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
| 376 | - * detect if array is a simple array or a struct (associative array) |
|
| 377 | - * |
|
| 378 | - * @param mixed $val The PHP array |
|
| 379 | - * @return string (arraySimple|arrayStruct) |
|
| 380 | - * @access private |
|
| 381 | - */ |
|
| 376 | + * detect if array is a simple array or a struct (associative array) |
|
| 377 | + * |
|
| 378 | + * @param mixed $val The PHP array |
|
| 379 | + * @return string (arraySimple|arrayStruct) |
|
| 380 | + * @access private |
|
| 381 | + */ |
|
| 382 | 382 | public function isArraySimpleOrStruct($val) { |
| 383 | - $keyList = array_keys($val); |
|
| 383 | + $keyList = array_keys($val); |
|
| 384 | 384 | foreach ($keyList as $keyListValue) { |
| 385 | 385 | if (!is_int($keyListValue)) { |
| 386 | 386 | return 'arrayStruct'; |
@@ -390,33 +390,33 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
| 393 | - * serializes PHP values in accordance w/ section 5. Type information is |
|
| 394 | - * not serialized if $use == 'literal'. |
|
| 395 | - * |
|
| 396 | - * @param mixed $val The value to serialize |
|
| 397 | - * @param string $name The name (local part) of the XML element |
|
| 398 | - * @param string $type The XML schema type (local part) for the element |
|
| 399 | - * @param string $name_ns The namespace for the name of the XML element |
|
| 400 | - * @param string $type_ns The namespace for the type of the element |
|
| 401 | - * @param array $attributes The attributes to serialize as name=>value pairs |
|
| 402 | - * @param string $use The WSDL "use" (encoded|literal) |
|
| 403 | - * @param boolean $soapval Whether this is called from soapval. |
|
| 404 | - * @return string The serialized element, possibly with child elements |
|
| 405 | - * @access public |
|
| 406 | - */ |
|
| 393 | + * serializes PHP values in accordance w/ section 5. Type information is |
|
| 394 | + * not serialized if $use == 'literal'. |
|
| 395 | + * |
|
| 396 | + * @param mixed $val The value to serialize |
|
| 397 | + * @param string $name The name (local part) of the XML element |
|
| 398 | + * @param string $type The XML schema type (local part) for the element |
|
| 399 | + * @param string $name_ns The namespace for the name of the XML element |
|
| 400 | + * @param string $type_ns The namespace for the type of the element |
|
| 401 | + * @param array $attributes The attributes to serialize as name=>value pairs |
|
| 402 | + * @param string $use The WSDL "use" (encoded|literal) |
|
| 403 | + * @param boolean $soapval Whether this is called from soapval. |
|
| 404 | + * @return string The serialized element, possibly with child elements |
|
| 405 | + * @access public |
|
| 406 | + */ |
|
| 407 | 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)) { |
|
| 413 | - $this->debug("serialize_val: serialize soapval"); |
|
| 414 | - $xml = $val->serialize($use); |
|
| 412 | + if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { |
|
| 413 | + $this->debug("serialize_val: serialize soapval"); |
|
| 414 | + $xml = $val->serialize($use); |
|
| 415 | 415 | $this->appendDebug($val->getDebug()); |
| 416 | 416 | $val->clearDebug(); |
| 417 | 417 | $this->debug("serialize_val of soapval returning $xml"); |
| 418 | 418 | return $xml; |
| 419 | - } |
|
| 419 | + } |
|
| 420 | 420 | // force valid name if necessary |
| 421 | 421 | if (is_numeric($name)) { |
| 422 | 422 | $name = '__numeric_' . $name; |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | // if name has ns, add ns prefix to name |
| 427 | 427 | $xmlns = ''; |
| 428 | - if($name_ns){ |
|
| 428 | + if($name_ns){ |
|
| 429 | 429 | $prefix = 'nu'.rand(1000,9999); |
| 430 | 430 | $name = $prefix.':'.$name; |
| 431 | 431 | $xmlns .= " xmlns:$prefix=\"$name_ns\""; |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | // if type is prefixed, create type prefix |
| 434 | 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 | - // w/o checking against typemap |
|
| 436 | + // w/o checking against typemap |
|
| 437 | 437 | $type_prefix = 'xsd'; |
| 438 | 438 | } elseif($type_ns){ |
| 439 | 439 | $type_prefix = 'ns'.rand(1000,9999); |
@@ -448,12 +448,12 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | // serialize null value |
| 450 | 450 | if (is_null($val)) { |
| 451 | - $this->debug("serialize_val: serialize null"); |
|
| 451 | + $this->debug("serialize_val: serialize null"); |
|
| 452 | 452 | if ($use == 'literal') { |
| 453 | 453 | $xml = "<$name$xmlns$atts/>"; |
| 454 | 454 | $this->debug("serialize_val returning $xml"); |
| 455 | - return $xml; |
|
| 456 | - } else { |
|
| 455 | + return $xml; |
|
| 456 | + } else { |
|
| 457 | 457 | if (isset($type) && isset($type_prefix)) { |
| 458 | 458 | $type_str = " xsi:type=\"$type_prefix:$type\""; |
| 459 | 459 | } else { |
@@ -461,41 +461,41 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; |
| 463 | 463 | $this->debug("serialize_val returning $xml"); |
| 464 | - return $xml; |
|
| 465 | - } |
|
| 464 | + return $xml; |
|
| 465 | + } |
|
| 466 | 466 | } |
| 467 | - // serialize if an xsd built-in primitive type |
|
| 468 | - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ |
|
| 469 | - $this->debug("serialize_val: serialize xsd built-in primitive type"); |
|
| 470 | - if (is_bool($val)) { |
|
| 471 | - if ($type == 'boolean') { |
|
| 472 | - $val = $val ? 'true' : 'false'; |
|
| 473 | - } elseif (! $val) { |
|
| 474 | - $val = 0; |
|
| 475 | - } |
|
| 467 | + // serialize if an xsd built-in primitive type |
|
| 468 | + if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ |
|
| 469 | + $this->debug("serialize_val: serialize xsd built-in primitive type"); |
|
| 470 | + if (is_bool($val)) { |
|
| 471 | + if ($type == 'boolean') { |
|
| 472 | + $val = $val ? 'true' : 'false'; |
|
| 473 | + } elseif (! $val) { |
|
| 474 | + $val = 0; |
|
| 475 | + } |
|
| 476 | 476 | } else if (is_string($val)) { |
| 477 | 477 | $val = $this->expandEntities($val); |
| 478 | 478 | } |
| 479 | 479 | if ($use == 'literal') { |
| 480 | 480 | $xml = "<$name$xmlns$atts>$val</$name>"; |
| 481 | 481 | $this->debug("serialize_val returning $xml"); |
| 482 | - return $xml; |
|
| 483 | - } else { |
|
| 482 | + return $xml; |
|
| 483 | + } else { |
|
| 484 | 484 | $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val</$name>"; |
| 485 | 485 | $this->debug("serialize_val returning $xml"); |
| 486 | - return $xml; |
|
| 487 | - } |
|
| 488 | - } |
|
| 486 | + return $xml; |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | 489 | // detect type and serialize |
| 490 | 490 | $xml = ''; |
| 491 | 491 | switch(true) { |
| 492 | 492 | case (is_bool($val) || $type == 'boolean'): |
| 493 | 493 | $this->debug("serialize_val: serialize boolean"); |
| 494 | - if ($type == 'boolean') { |
|
| 495 | - $val = $val ? 'true' : 'false'; |
|
| 496 | - } elseif (! $val) { |
|
| 497 | - $val = 0; |
|
| 498 | - } |
|
| 494 | + if ($type == 'boolean') { |
|
| 495 | + $val = $val ? 'true' : 'false'; |
|
| 496 | + } elseif (! $val) { |
|
| 497 | + $val = 0; |
|
| 498 | + } |
|
| 499 | 499 | if ($use == 'literal') { |
| 500 | 500 | $xml .= "<$name$xmlns$atts>$val</$name>"; |
| 501 | 501 | } else { |
@@ -529,12 +529,12 @@ discard block |
||
| 529 | 529 | break; |
| 530 | 530 | case is_object($val): |
| 531 | 531 | $this->debug("serialize_val: serialize object"); |
| 532 | - if (get_class($val) == 'soapval') { |
|
| 533 | - $this->debug("serialize_val: serialize soapval object"); |
|
| 534 | - $pXml = $val->serialize($use); |
|
| 532 | + if (get_class($val) == 'soapval') { |
|
| 533 | + $this->debug("serialize_val: serialize soapval object"); |
|
| 534 | + $pXml = $val->serialize($use); |
|
| 535 | 535 | $this->appendDebug($val->getDebug()); |
| 536 | 536 | $val->clearDebug(); |
| 537 | - } else { |
|
| 537 | + } else { |
|
| 538 | 538 | if (! $name) { |
| 539 | 539 | $name = get_class($val); |
| 540 | 540 | $this->debug("In serialize_val, used class name $name as element name"); |
@@ -560,19 +560,19 @@ discard block |
||
| 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 | 566 | if(is_array($val) && count($val)> 0){ |
| 567 | 567 | foreach($val as $v){ |
| 568 | - if(is_object($v) && get_class($v) == 'soapval'){ |
|
| 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)) { |
| 572 | 572 | $tt = $this->isArraySimpleOrStruct($v); |
| 573 | 573 | } else { |
| 574 | 574 | $tt = gettype($v); |
| 575 | - } |
|
| 575 | + } |
|
| 576 | 576 | $array_types[$tt] = 1; |
| 577 | 577 | $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); |
| 578 | 578 | ++$i; |
@@ -655,19 +655,19 @@ discard block |
||
| 655 | 655 | return $xml; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - /** |
|
| 659 | - * serializes a message |
|
| 660 | - * |
|
| 661 | - * @param string $body the XML of the SOAP body |
|
| 662 | - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array |
|
| 663 | - * @param array $namespaces optional the namespaces used in generating the body and headers |
|
| 664 | - * @param string $style optional (rpc|document) |
|
| 665 | - * @param string $use optional (encoded|literal) |
|
| 666 | - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
| 667 | - * @return string the message |
|
| 668 | - * @access public |
|
| 669 | - */ |
|
| 670 | - public function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ |
|
| 658 | + /** |
|
| 659 | + * serializes a message |
|
| 660 | + * |
|
| 661 | + * @param string $body the XML of the SOAP body |
|
| 662 | + * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array |
|
| 663 | + * @param array $namespaces optional the namespaces used in generating the body and headers |
|
| 664 | + * @param string $style optional (rpc|document) |
|
| 665 | + * @param string $use optional (encoded|literal) |
|
| 666 | + * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
| 667 | + * @return string the message |
|
| 668 | + * @access public |
|
| 669 | + */ |
|
| 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:"); |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | $this->appendDebug($this->varDump($namespaces)); |
| 677 | 677 | |
| 678 | 678 | // serialize namespaces |
| 679 | - $ns_string = ''; |
|
| 679 | + $ns_string = ''; |
|
| 680 | 680 | foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ |
| 681 | 681 | $ns_string .= " xmlns:$k=\"$v\""; |
| 682 | 682 | } |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $body. |
| 710 | 710 | "</SOAP-ENV:Body>". |
| 711 | 711 | "</SOAP-ENV:Envelope>"; |
| 712 | - } |
|
| 712 | + } |
|
| 713 | 713 | |
| 714 | 714 | /** |
| 715 | 715 | * formats a string to be inserted into an HTML stream |
@@ -719,18 +719,18 @@ discard block |
||
| 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 | + } |
|
| 726 | 726 | |
| 727 | 727 | /** |
| 728 | - * contracts (changes namespace to prefix) a qualified name |
|
| 729 | - * |
|
| 730 | - * @param string $qname qname |
|
| 731 | - * @return string contracted qname |
|
| 732 | - * @access private |
|
| 733 | - */ |
|
| 728 | + * contracts (changes namespace to prefix) a qualified name |
|
| 729 | + * |
|
| 730 | + * @param string $qname qname |
|
| 731 | + * @return string contracted qname |
|
| 732 | + * @access private |
|
| 733 | + */ |
|
| 734 | 734 | public function contractQname($qname){ |
| 735 | 735 | // get element namespace |
| 736 | 736 | if (strrpos($qname, ':')) { |
@@ -749,12 +749,12 @@ discard block |
||
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | - * expands (changes prefix to namespace) a qualified name |
|
| 753 | - * |
|
| 754 | - * @param string $qname qname |
|
| 755 | - * @return string expanded qname |
|
| 756 | - * @access private |
|
| 757 | - */ |
|
| 752 | + * expands (changes prefix to namespace) a qualified name |
|
| 753 | + * |
|
| 754 | + * @param string $qname qname |
|
| 755 | + * @return string expanded qname |
|
| 756 | + * @access private |
|
| 757 | + */ |
|
| 758 | 758 | public function expandQname($qname){ |
| 759 | 759 | // get element prefix |
| 760 | 760 | if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ |
@@ -772,14 +772,14 @@ discard block |
||
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - /** |
|
| 776 | - * returns the local part of a prefixed string |
|
| 777 | - * returns the original string, if not prefixed |
|
| 778 | - * |
|
| 779 | - * @param string $str The prefixed string |
|
| 780 | - * @return string The local part |
|
| 781 | - * @access public |
|
| 782 | - */ |
|
| 775 | + /** |
|
| 776 | + * returns the local part of a prefixed string |
|
| 777 | + * returns the original string, if not prefixed |
|
| 778 | + * |
|
| 779 | + * @param string $str The prefixed string |
|
| 780 | + * @return string The local part |
|
| 781 | + * @access public |
|
| 782 | + */ |
|
| 783 | 783 | public function getLocalPart($str){ |
| 784 | 784 | if($sstr = strrchr($str,':')){ |
| 785 | 785 | // get unqualified name |
@@ -790,13 +790,13 @@ discard block |
||
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /** |
| 793 | - * returns the prefix part of a prefixed string |
|
| 794 | - * returns false, if not prefixed |
|
| 795 | - * |
|
| 796 | - * @param string $str The prefixed string |
|
| 797 | - * @return mixed The prefix or false if there is no prefix |
|
| 798 | - * @access public |
|
| 799 | - */ |
|
| 793 | + * returns the prefix part of a prefixed string |
|
| 794 | + * returns false, if not prefixed |
|
| 795 | + * |
|
| 796 | + * @param string $str The prefixed string |
|
| 797 | + * @return mixed The prefix or false if there is no prefix |
|
| 798 | + * @access public |
|
| 799 | + */ |
|
| 800 | 800 | public function getPrefix($str){ |
| 801 | 801 | if($pos = strrpos($str,':')){ |
| 802 | 802 | // get prefix |
@@ -806,12 +806,12 @@ discard block |
||
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | - * pass it a prefix, it returns a namespace |
|
| 810 | - * |
|
| 811 | - * @param string $prefix The prefix |
|
| 812 | - * @return mixed The namespace, false if no namespace has the specified prefix |
|
| 813 | - * @access public |
|
| 814 | - */ |
|
| 809 | + * pass it a prefix, it returns a namespace |
|
| 810 | + * |
|
| 811 | + * @param string $prefix The prefix |
|
| 812 | + * @return mixed The namespace, false if no namespace has the specified prefix |
|
| 813 | + * @access public |
|
| 814 | + */ |
|
| 815 | 815 | public function getNamespaceFromPrefix($prefix){ |
| 816 | 816 | if (isset($this->namespaces[$prefix])) { |
| 817 | 817 | return $this->namespaces[$prefix]; |
@@ -820,17 +820,17 @@ discard block |
||
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | /** |
| 823 | - * returns the prefix for a given namespace (or prefix) |
|
| 824 | - * or false if no prefixes registered for the given namespace |
|
| 825 | - * |
|
| 826 | - * @param string $ns The namespace |
|
| 827 | - * @return mixed The prefix, false if the namespace has no prefixes |
|
| 828 | - * @access public |
|
| 829 | - */ |
|
| 823 | + * returns the prefix for a given namespace (or prefix) |
|
| 824 | + * or false if no prefixes registered for the given namespace |
|
| 825 | + * |
|
| 826 | + * @param string $ns The namespace |
|
| 827 | + * @return mixed The prefix, false if the namespace has no prefixes |
|
| 828 | + * @access public |
|
| 829 | + */ |
|
| 830 | 830 | public function getPrefixFromNamespace($ns) { |
| 831 | 831 | foreach ($this->namespaces as $p => $n) { |
| 832 | 832 | if ($ns == $n || $ns == $p) { |
| 833 | - $this->usedNamespaces[$p] = $n; |
|
| 833 | + $this->usedNamespaces[$p] = $n; |
|
| 834 | 834 | return $p; |
| 835 | 835 | } |
| 836 | 836 | } |
@@ -838,11 +838,11 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | - * returns the time in ODBC canonical form with microseconds |
|
| 842 | - * |
|
| 843 | - * @return string The time in ODBC canonical form with microseconds |
|
| 844 | - * @access public |
|
| 845 | - */ |
|
| 841 | + * returns the time in ODBC canonical form with microseconds |
|
| 842 | + * |
|
| 843 | + * @return string The time in ODBC canonical form with microseconds |
|
| 844 | + * @access public |
|
| 845 | + */ |
|
| 846 | 846 | public function getmicrotime() { |
| 847 | 847 | if (function_exists('gettimeofday')) { |
| 848 | 848 | $tod = gettimeofday(); |
@@ -862,17 +862,17 @@ discard block |
||
| 862 | 862 | * @return string The output of var_dump |
| 863 | 863 | * @access public |
| 864 | 864 | */ |
| 865 | - public function varDump($data) { |
|
| 865 | + public function varDump($data) { |
|
| 866 | 866 | $ret_val = var_export($data, true); |
| 867 | 867 | return $ret_val; |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
| 871 | - * represents the object as a string |
|
| 872 | - * |
|
| 873 | - * @return string |
|
| 874 | - * @access public |
|
| 875 | - */ |
|
| 871 | + * represents the object as a string |
|
| 872 | + * |
|
| 873 | + * @return string |
|
| 874 | + * @access public |
|
| 875 | + */ |
|
| 876 | 876 | public function __toString() { |
| 877 | 877 | return $this->varDump($this); |
| 878 | 878 | } |
@@ -183,26 +183,26 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public $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 |
||
| 214 | 214 | * @deprecated |
| 215 | 215 | * @see expandEntities |
| 216 | 216 | */ |
| 217 | - public $xmlEntities = array('quot' => '"','amp' => '&', |
|
| 218 | - 'lt' => '<','gt' => '>','apos' => "'"); |
|
| 217 | + public $xmlEntities = array('quot' => '"', 'amp' => '&', |
|
| 218 | + 'lt' => '<', 'gt' => '>', 'apos' => "'"); |
|
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * constructor |
@@ -272,9 +272,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) |
| 44 | 44 | * @param string $faultactor only used when msg routed between multiple actors |
| 45 | 45 | * @param string $faultstring human readable error message |
| 46 | - * @param mixed $faultdetail detail, typically a string or array of string |
|
| 46 | + * @param string $faultdetail detail, typically a string or array of string |
|
| 47 | 47 | */ |
| 48 | 48 | public function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ |
| 49 | 49 | parent::nusoap_base(); |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | var $faultdetail; |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * constructor |
|
| 42 | - * |
|
| 43 | - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) |
|
| 44 | - * @param string $faultactor only used when msg routed between multiple actors |
|
| 45 | - * @param string $faultstring human readable error message |
|
| 46 | - * @param mixed $faultdetail detail, typically a string or array of string |
|
| 47 | - */ |
|
| 41 | + * constructor |
|
| 42 | + * |
|
| 43 | + * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) |
|
| 44 | + * @param string $faultactor only used when msg routed between multiple actors |
|
| 45 | + * @param string $faultstring human readable error message |
|
| 46 | + * @param mixed $faultdetail detail, typically a string or array of string |
|
| 47 | + */ |
|
| 48 | 48 | public function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ |
| 49 | 49 | parent::nusoap_base(); |
| 50 | 50 | $this->faultcode = $faultcode; |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * serialize a fault |
|
| 58 | - * |
|
| 59 | - * @return string The serialization of the fault instance. |
|
| 60 | - * @access public |
|
| 61 | - */ |
|
| 57 | + * serialize a fault |
|
| 58 | + * |
|
| 59 | + * @return string The serialization of the fault instance. |
|
| 60 | + * @access public |
|
| 61 | + */ |
|
| 62 | 62 | public function serialize(){ |
| 63 | 63 | $ns_string = ''; |
| 64 | 64 | foreach($this->namespaces as $k => $v){ |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $faultstring human readable error message |
| 46 | 46 | * @param mixed $faultdetail detail, typically a string or array of string |
| 47 | 47 | */ |
| 48 | - public function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ |
|
| 48 | + public function nusoap_fault($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '') { |
|
| 49 | 49 | parent::nusoap_base(); |
| 50 | 50 | $this->faultcode = $faultcode; |
| 51 | 51 | $this->faultactor = $faultactor; |
@@ -59,22 +59,22 @@ discard block |
||
| 59 | 59 | * @return string The serialization of the fault instance. |
| 60 | 60 | * @access public |
| 61 | 61 | */ |
| 62 | - public function serialize(){ |
|
| 62 | + public function serialize() { |
|
| 63 | 63 | $ns_string = ''; |
| 64 | - foreach($this->namespaces as $k => $v){ |
|
| 64 | + foreach ($this->namespaces as $k => $v) { |
|
| 65 | 65 | $ns_string .= "\n xmlns:$k=\"$v\""; |
| 66 | 66 | } |
| 67 | 67 | $return_msg = |
| 68 | - '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'. |
|
| 69 | - '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n". |
|
| 70 | - '<SOAP-ENV:Body>'. |
|
| 71 | - '<SOAP-ENV:Fault>'. |
|
| 72 | - $this->serialize_val($this->faultcode, 'faultcode'). |
|
| 73 | - $this->serialize_val($this->faultactor, 'faultactor'). |
|
| 74 | - $this->serialize_val($this->faultstring, 'faultstring'). |
|
| 75 | - $this->serialize_val($this->faultdetail, 'detail'). |
|
| 76 | - '</SOAP-ENV:Fault>'. |
|
| 77 | - '</SOAP-ENV:Body>'. |
|
| 68 | + '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?>' . |
|
| 69 | + '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string . ">\n" . |
|
| 70 | + '<SOAP-ENV:Body>' . |
|
| 71 | + '<SOAP-ENV:Fault>' . |
|
| 72 | + $this->serialize_val($this->faultcode, 'faultcode') . |
|
| 73 | + $this->serialize_val($this->faultactor, 'faultactor') . |
|
| 74 | + $this->serialize_val($this->faultstring, 'faultstring') . |
|
| 75 | + $this->serialize_val($this->faultdetail, 'detail') . |
|
| 76 | + '</SOAP-ENV:Fault>' . |
|
| 77 | + '</SOAP-ENV:Body>' . |
|
| 78 | 78 | '</SOAP-ENV:Envelope>'; |
| 79 | 79 | return $return_msg; |
| 80 | 80 | } |