mirror of
https://github.com/friendica/friendica
synced 2025-04-25 19:10:11 +00:00
move function deletenode() to the xml class
This commit is contained in:
parent
c96a53b4b4
commit
56e38dd6bd
3 changed files with 45 additions and 44 deletions
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file include/xml.php
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief This class contain functions to work with XML data
|
||||
* @brief This class contain methods to work with XML data
|
||||
*
|
||||
*/
|
||||
class xml {
|
||||
|
@ -372,5 +373,18 @@ class xml {
|
|||
|
||||
return($xml_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete a node in a XML object
|
||||
*
|
||||
* @param object $doc XML document
|
||||
* @param string $node Node name
|
||||
*/
|
||||
public static function deleteNode(&$doc, $node) {
|
||||
$xpath = new \DomXPath($doc);
|
||||
$list = $xpath->query("//".$node);
|
||||
foreach ($list as $child) {
|
||||
$child->parentNode->removeChild($child);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue