Habari\Pluggable::get_xml_text PHP Метод

get_xml_text() публичный статический Метод

Get the text associated to an info xml node, possibly using an href parameter
public static get_xml_text ( string $filename, SimpleXMLElement $node ) : mixed | string
$filename string The filename of the xml file
$node SimpleXMLElement The text node with value children to sift through
Результат mixed | string The result text
    public static function get_xml_text($filename, \SimpleXMLElement $node)
    {
        $values = $node->xpath('value[not(@lang)]');
        $value = reset($values);
        $filename = (string) $filename;
        if ($value['href']) {
            $href = dirname($filename) . '/' . str_replace('..', '', $value['href']);
            if (file_exists($href)) {
                $initial = file_get_contents($href);
                $result = Plugins::filter('get_xml_text', $initial, $filename);
                if ($initial == $result) {
                    $result = Format::autop($initial);
                }
                return $result;
            }
        }
        return (string) $value;
    }