Skip to content

Commit 483bb3e

Browse files
authored
Add files via upload
1 parent 1cc50b1 commit 483bb3e

File tree

3 files changed

+789
-0
lines changed

3 files changed

+789
-0
lines changed

SoapZkClient.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace ZK;
4+
5+
class SoapZkClient extends \SoapClient {
6+
7+
private $filter_enabled = false;
8+
9+
public function getFilter_enabled() {
10+
return $this->filter_enable;
11+
}
12+
13+
public function setFilter_enabled($filter_enabled) {
14+
$this->filter_enabled = $filter_enabled;
15+
}
16+
17+
public function correctXml($data) {
18+
19+
20+
$allowChar = array("\r", "\n", " ");
21+
22+
23+
for ($i = 0; $i < strlen($data); $i++) {
24+
if ($data[$i] == ">") {
25+
for ($j = $i + 1; $j < strlen($data); $j++) {
26+
if (($data[$j] == "<" && $data[$j + 1] == "/") || ($data[$j] == "<" && ($data[$j - 1] == ">" || $data[$j - 1] == "\n"))) {
27+
break;
28+
} else if (!ctype_alnum($data[$j]) && !in_array($data[$j], $allowChar)) {
29+
$data[$j] = "*";
30+
}
31+
}
32+
}
33+
}
34+
return $data;
35+
}
36+
37+
public function __doRequest($req, $location, $action, $version = SOAP_1_1) {
38+
39+
$original_response = (parent::__doRequest($req, $location, $action, $version));
40+
if ($this->filter_enabled) {
41+
return str_replace("*", "", $this->correctXml($original_response));
42+
}
43+
return $original_response;
44+
}
45+
46+
}

0 commit comments

Comments
 (0)