@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
65 | 65 | { |
66 | 66 | // if invalid xmlrpc already detected, skip all processing |
67 | - if ($this->_xh['isf'] < 2) { |
|
67 | + if ($this->_xh['isf']<2) { |
|
68 | 68 | // check for correct element nesting |
69 | 69 | // top level element can only be of 2 types |
70 | 70 | /// @todo optimization creep: save this check into a bool variable, instead of using count() every time: |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->_xh['isf'] = 1; |
160 | 160 | break; |
161 | 161 | case 'MEMBER': |
162 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; // set member name to null, in case we do not find in the xml later on |
|
162 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; // set member name to null, in case we do not find in the xml later on |
|
163 | 163 | //$this->_xh['ac']=''; |
164 | 164 | // Drop trough intentionally |
165 | 165 | case 'PARAM': |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = true) |
213 | 213 | { |
214 | - if ($this->_xh['isf'] < 2) { |
|
214 | + if ($this->_xh['isf']<2) { |
|
215 | 215 | // push this element name from stack |
216 | 216 | // NB: if XML validates, correct opening/closing is guaranteed and |
217 | 217 | // we do not have to check for $name == $currElem. |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | // check if we are inside an array or struct: |
238 | 238 | // if value just built is inside an array, let's move it into array on the stack |
239 | 239 | $vscount = count($this->_xh['valuestack']); |
240 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
241 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $temp; |
|
240 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
241 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $temp; |
|
242 | 242 | } else { |
243 | 243 | $this->_xh['value'] = $temp; |
244 | 244 | } |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | // check if we are inside an array or struct: |
253 | 253 | // if value just built is inside an array, let's move it into array on the stack |
254 | 254 | $vscount = count($this->_xh['valuestack']); |
255 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
256 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
255 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
256 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | break; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $this->_xh['value'] = $this->_xh['ac']; |
272 | 272 | } elseif ($name == 'DATETIME.ISO8601') { |
273 | 273 | if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) { |
274 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); |
|
274 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']); |
|
275 | 275 | } |
276 | 276 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
277 | 277 | $this->_xh['value'] = $this->_xh['ac']; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } else { |
291 | 291 | // log if receiving something strange, even though we set the value to false anyway |
292 | 292 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { |
293 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); |
|
293 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']); |
|
294 | 294 | } |
295 | 295 | $this->_xh['value'] = false; |
296 | 296 | } |
@@ -300,37 +300,37 @@ discard block |
||
300 | 300 | // NOTE: regexp could be much stricter than this... |
301 | 301 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { |
302 | 302 | /// @todo: find a better way of throwing an error than this! |
303 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); |
|
303 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']); |
|
304 | 304 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
305 | 305 | } else { |
306 | 306 | // it's ok, add it on |
307 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
307 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
308 | 308 | } |
309 | 309 | } else { |
310 | 310 | // we have an I4/INT |
311 | 311 | // we must check that only 0123456789-<space> are characters here |
312 | 312 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { |
313 | 313 | /// @todo find a better way of throwing an error than this! |
314 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); |
|
314 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']); |
|
315 | 315 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
316 | 316 | } else { |
317 | 317 | // it's ok, add it on |
318 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
318 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | $this->_xh['lv'] = 3; // indicate we've found a value |
322 | 322 | break; |
323 | 323 | case 'NAME': |
324 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
324 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
325 | 325 | break; |
326 | 326 | case 'MEMBER': |
327 | 327 | // add to array in the stack the last element built, |
328 | 328 | // unless no VALUE was found |
329 | 329 | if ($this->_xh['vt']) { |
330 | 330 | $vscount = count($this->_xh['valuestack']); |
331 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
331 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
332 | 332 | } else { |
333 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
333 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
334 | 334 | } |
335 | 335 | break; |
336 | 336 | case 'DATA': |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $this->_xh['params'][] = $this->_xh['value']; |
354 | 354 | $this->_xh['pt'][] = $this->_xh['vt']; |
355 | 355 | } else { |
356 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
356 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
357 | 357 | } |
358 | 358 | break; |
359 | 359 | case 'METHODNAME': |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | public function xmlrpc_cd($parser, $data) |
396 | 396 | { |
397 | 397 | // skip processing if xml fault already detected |
398 | - if ($this->_xh['isf'] < 2) { |
|
398 | + if ($this->_xh['isf']<2) { |
|
399 | 399 | // "lookforvalue==3" means that we've found an entire value |
400 | 400 | // and should discard any further character data |
401 | 401 | if ($this->_xh['lv'] != 3) { |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | public function xmlrpc_dh($parser, $data) |
412 | 412 | { |
413 | 413 | // skip processing if xml fault already detected |
414 | - if ($this->_xh['isf'] < 2) { |
|
414 | + if ($this->_xh['isf']<2) { |
|
415 | 415 | if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') { |
416 | 416 | $this->_xh['ac'] .= $data; |
417 | 417 | } |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | // Details: |
483 | 483 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
484 | 484 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
485 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
486 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
485 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
486 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
487 | 487 | $xmlChunk, $matches)) { |
488 | 488 | return strtoupper(substr($matches[2], 1, -1)); |
489 | 489 | } |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
502 | 502 | // IANA also likes better US-ASCII, so go with it |
503 | 503 | if ($enc == 'ASCII') { |
504 | - $enc = 'US-' . $enc; |
|
504 | + $enc = 'US-'.$enc; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | return $enc; |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | // Details: |
537 | 537 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
538 | 538 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
539 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
540 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
539 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
540 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
541 | 541 | $xmlChunk, $matches)) { |
542 | 542 | return true; |
543 | 543 | } |