mirror of
https://github.com/friendica/friendica
synced 2025-04-25 07:50:10 +00:00
New function "queryValue"
This commit is contained in:
parent
cb647b5b6c
commit
20b25a1acd
2 changed files with 17 additions and 8 deletions
|
@ -488,6 +488,15 @@ class XML
|
|||
return $first_item->attributes;
|
||||
}
|
||||
|
||||
public static function queryValue($xpath, $search, $context)
|
||||
{
|
||||
$result = $xpath->query($search, $context)->item(0)->nodeValue;
|
||||
if (!is_object($result)) {
|
||||
return '';
|
||||
}
|
||||
return $result->nodeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape text ($str) for XML transport
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue