pretty xml
This commit is contained in:
parent
50c7faa7cd
commit
cdd65d4c7f
|
@ -21,6 +21,7 @@ $buttons = [
|
||||||
'hash' => 'Hash',
|
'hash' => 'Hash',
|
||||||
'hex' => 'Hex',
|
'hex' => 'Hex',
|
||||||
'prettyjson' => 'Pretty JSON',
|
'prettyjson' => 'Pretty JSON',
|
||||||
|
'prettyxml' => 'Pretty XML',
|
||||||
'serializedtojson' => 'PHP Serialized to JSON',
|
'serializedtojson' => 'PHP Serialized to JSON',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -109,6 +110,15 @@ if ($action == 'reset') {
|
||||||
}
|
}
|
||||||
$help = 'https://www.php.net/json';
|
$help = 'https://www.php.net/json';
|
||||||
|
|
||||||
|
} elseif ($action == 'prettyxml') {
|
||||||
|
$dom = new DOMDocument('1.0');
|
||||||
|
$dom->preserveWhiteSpace = false;
|
||||||
|
$dom->formatOutput = true;
|
||||||
|
@$dom->loadXML($str);
|
||||||
|
|
||||||
|
$result = @$dom->saveXML();
|
||||||
|
$help = 'https://www.php.net/DOMDocument';
|
||||||
|
|
||||||
} elseif ($action == 'serializedtojson') {
|
} elseif ($action == 'serializedtojson') {
|
||||||
$stdClass = preg_replace('~O:[0-9]+:"[^"]+"~', 'O:8:"stdClass"', $str);
|
$stdClass = preg_replace('~O:[0-9]+:"[^"]+"~', 'O:8:"stdClass"', $str);
|
||||||
$unserialized = @unserialize($stdClass);
|
$unserialized = @unserialize($stdClass);
|
||||||
|
|
Loading…
Reference in New Issue