X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FXML.php;h=039247cc7503f74195dc3c0888b8a86587b276de;hb=11de5be0ae6d28880b12cc4b1fd65c56924b4aad;hp=4eed3a85f84eb511b0859521d75be1a34a99a760;hpb=238c079d112be7ce16aab4e1b975bebefee4980a;p=friendica.git diff --git a/src/Util/XML.php b/src/Util/XML.php index 4eed3a85f8..039247cc75 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -488,6 +488,21 @@ class XML return $first_item->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 *