当前位置: 首页>>代码示例>>PHP>>正文


PHP xml::load_file方法代码示例

本文整理汇总了PHP中xml::load_file方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::load_file方法的具体用法?PHP xml::load_file怎么用?PHP xml::load_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml的用法示例。


在下文中一共展示了xml::load_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_agents

function test_agents()
{
    require "conf/_conf.php";
    $res = true;
    if (file_exists($agent_conf)) {
        if (file_exists("/var/ossec/bin/verify-agent-conf")) {
            exec("sudo /var/ossec/bin/verify-agent-conf > /tmp/ossec-agent-conf 2>&1", $result, $res);
            $result = file('/tmp/ossec-agent-conf', FILE_IGNORE_NEW_LINES);
            if (!is_array($result)) {
                $res = _("Error to read {$agent_conf}");
            } else {
                if (is_array($result) && count($result) > 0) {
                    $res = implode("<br/><br/>", $result);
                } else {
                    $res = true;
                }
            }
            @unlink('/tmp/ossec-agent-conf');
        } else {
            $agent_file = @file_get_contents($agent_conf);
            if (!empty($agent_file)) {
                $xml_obj = new xml("_level_key");
                $xml_obj->load_file($agent_conf);
                if ($xml_obj->errors['status'] == false) {
                    $res = implode("", $xml_obj->errors['msg']);
                }
            }
        }
    }
    return $res;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:utils.php

示例2: basename

    $result = test_conf();
    if ($result !== true) {
        $error = true;
        $link_txt = _("Configuration error in file") . " " . basename($ossec_conf) . " " . _("and/or") . " " . $editable_files[0];
        $info_conf = "<span style='font-weight: bold;'>{$link_txt}<a onclick=\"\$('#msg_errors').toggle();\"> [" . _("View errors") . "]</a><br/></span>";
        $info_conf .= "<div id='msg_errors'>{$result}</div>";
        $error_conf = "<div id='parse_errors' class='oss_error'>{$info_conf}</div>";
    } else {
        $file_xml = @file_get_contents($filename, false);
        if ($file_xml === false) {
            $error = true;
        } else {
            $_level_key_name = set_key_name($_level_key_name, $file_xml);
            $_SESSION['_level_key_name'] = $_level_key_name;
            $xml_obj = new xml($_level_key_name);
            $xml_obj->load_file($filename);
            $array_xml = $xml_obj->xml2array();
            $tree_json = array2json($array_xml, $filename);
            $_SESSION['_tree_json'] = $tree_json;
            $_SESSION['_tree'] = $array_xml;
            $file_xml = clean_string($file_xml);
        }
    }
} else {
    $error = true;
}
if ($error == true) {
    $file_xml = '';
    $tree_json = "{title:'<span>" . $filename . "</span>', icon:'../../pixmaps/theme/any.png', addClass:'size12', isFolder:'true', key:'1', children:[{title: '<span>" . _("No Valid XML File") . "</span>', icon:'../../pixmaps/theme/ltError.gif', addClass:'bold_red', key:'load_error'}]}";
    $_SESSION['_tree_json'] = $tree_json;
    $_SESSION['_tree'] = array();
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:index.php

示例3: xml

$error = false;
if (@copy($path, $path_tmp) == false) {
    echo "2###" . _("Failure to update XML File") . " (1)";
    exit;
}
$result = test_conf();
if ($result !== true) {
    echo "4###" . $result;
    exit;
}
$file_to_text = file_get_contents($path, false);
$_level_key_name = set_key_name($_level_key_name, $file_to_text);
$new_rule['rule'] = $child['tree'];
//Tree local_rules.xml
$xml_obj = new xml($_level_key_name);
$xml_obj->load_file($path);
$tree_lr = $xml_obj->xml2array();
foreach ($tree_lr as $k => $v) {
    if (isset($tree_lr[$k]['group'])) {
        $__level_key = $tree_lr[$k]['group']['@attributes']['__level_key'];
        $child = getChild($tree_lr, $__level_key);
        $keys = array_keys($child['tree']);
        if (is_numeric($keys[count($keys) - 1])) {
            $aux_key = $keys[count($keys) - 1] + 1;
            $new_key = !in_array($aux_key, $keys) ? $aux_key : uniqid(mt_rand("1", mt_getrandmax()));
        } else {
            $new_key = uniqid(mt_rand("1", mt_getrandmax()));
        }
        break;
    }
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:copy_rule.php

示例4: foreach

    echo "<tr>";
    echo "<td style='padding: 3px 0px 20px 0px;'><form name='cnf_form_rules' id='cnf_form_rules' method='POST'><select id='rules_added' class='multiselect' multiple='multiple' name='rules_added[]'>";
    foreach ($rules_enabled as $k => $v) {
        echo "<option value='{$v}' selected='selected'>{$v}</option>";
    }
    foreach ($no_added_rules as $k => $v) {
        echo "<option value='{$v}' >{$v}</option>";
    }
    echo "</select></form></td>";
    echo "</tr>";
    echo "<tr><td style='padding-bottom:10px;'><input type='button' class='button' id='send' value='" . _('Update') . "' onclick=\"save_config_tab();\"/></td></tr>";
    echo "</table></div>";
} else {
    if ($tab == '#tab2') {
        $xml_obj = new xml("key");
        $xml_obj->load_file($ossec_conf);
        $array_oss_cnf = $xml_obj->xml2array();
        $syscheck = get_nodes($array_oss_cnf, 'syscheck');
        $directories = get_nodes($syscheck, 'directories');
        $wentries = get_nodes($syscheck, 'windows_registry');
        $reg_ignores = get_nodes($syscheck, 'registry_ignore');
        $ignores = get_nodes($syscheck, 'ignore');
        $frequency = get_nodes($syscheck, 'frequency');
        $frequency = $frequency[0][0];
        $scan_day = get_nodes($syscheck, 'scan_day');
        $scan_day = $scan_day[0][0];
        $scan_time = get_nodes($syscheck, 'scan_time');
        $scan_time = $scan_time[0][0];
        $st = !empty($scan_time) ? explode(":", $scan_time) : array();
        $auto_ignore = get_nodes($syscheck, 'auto_ignore');
        $auto_ignore = empty($auto_ignore[0][0]) ? "no" : $auto_ignore[0][0];
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:load_config_tab.php


注:本文中的xml::load_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。