From 4d54821119ca368104aa76f7b0f1a14fec8a1feb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 16 Jun 2023 11:13:20 -0600 Subject: [PATCH] Add a is_xml function --- resources/functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/functions.php b/resources/functions.php index c45585cc26..3a4b195a0f 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -159,6 +159,13 @@ } } + if (!function_exists('is_xml')) { + function is_xml($string) { + $pattern = '/^<\?xml(?:\s+[^>]+\s*)?\?>\s*<(\w+)>.*<\/\1>\s*$/s'; + return preg_match($pattern, $string) === 1; + } + } + if (!function_exists('recursive_copy')) { if (file_exists('/bin/cp')) { function recursive_copy($source, $destination, $options = '') {