add clear
This commit is contained in:
+4
-17
@@ -35,26 +35,13 @@ class Help extends Miniprogarampage
|
||||
if (is_array($xml)) {
|
||||
return $xml;
|
||||
}
|
||||
if (($data = @simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)) !== false) {
|
||||
return json_decode(json_encode($data), TRUE);
|
||||
}
|
||||
if (!is_null($json = json_decode($xml, TRUE))) {
|
||||
return $json;
|
||||
}
|
||||
if (is_array($json)) {
|
||||
return $json;
|
||||
}
|
||||
if (!static::isXml($xml)) {
|
||||
return $xml;
|
||||
}
|
||||
$data = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
if (is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
return json_decode(json_encode($data), TRUE);
|
||||
}
|
||||
|
||||
|
||||
public static function isXml($body)
|
||||
{
|
||||
return preg_match('/^<[a-zA-Z_]+>(.*?)?<\/[a-zA-Z_]+>$/', $body);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user