X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FXML.php;h=7b4539ba8cdd10a066ba44c52730d432ddb90168;hb=aad7bac6866cade9c07bb152e658eb23c4e37426;hp=4eed3a85f84eb511b0859521d75be1a34a99a760;hpb=c853ea6aae00be0a9364d3183785ebc3c1c1f9cd;p=friendica.git diff --git a/src/Util/XML.php b/src/Util/XML.php index 4eed3a85f8..7b4539ba8c 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -1,6 +1,6 @@ attributes; } + public static function getFirstValue($xpath, $search, $context) + { + $result = $xpath->query($search, $context); + if (!is_object($result)) { + return ''; + } + + $first_item = $result->item(0); + if (!is_object($first_item)) { + return ''; + } + + return $first_item->nodeValue; + } + /** * escape text ($str) for XML transport *