コード例 #1
0
ファイル: EIConfig.php プロジェクト: harturch/easyinterface
     */
    public static function get_exsetXML($id)
    {
        EIConfig::load_exsetXML($id);
        return EIConfig::$exsetXML[$id];
    }
    /* this function convert an xml to array
       with all attributes and childs */
    static function xml2array($xmlObject, $out = array())
    {
        foreach ($xmlObject->attributes() as $attr => $val) {
            $out['@attr'][$attr] = (string) $val;
        }
        $has_childs = false;
        foreach ($xmlObject as $index => $node) {
            $has_childs = true;
            $out[$index][] = EIConfig::xml2array($node);
        }
        if (!$has_childs && ($val = (string) $xmlObject)) {
            $out['@value'] = $val;
        }
        foreach ($out as $key => $vals) {
            if (is_array($vals) && count($vals) === 1 && array_key_exists(0, $vals)) {
                $out[$key] = $vals[0];
            }
        }
        return $out;
    }
}
EIConfig::init();