Ejemplo n.º 1
0
        $control = $controls->addChild("control");
        foreach ($oldControl->children() as $k => $v) {
            if ($k == "options") {
                $options = $control->addChild("options");
                foreach ($v as $ko => $vo) {
                    $options->addChild($ko, $vo);
                }
                continue;
            }
            if (($k == "midino" || $k == "midichan") && !preg_match('/0x\\d*/', $v)) {
                $v = sprintf("0x%02x", (int) $v);
            }
            $control->addChild($k, $v);
        }
    }
    if (isset($old->lights)) {
        // Add outputs to the new XML file
        $outputs = $new->controller->addChild("outputs");
        $lights = $old->lights->children();
        foreach ($lights as $light) {
            $output = $outputs->addChild("output");
            foreach ($light as $k => $v) {
                $output->addChild($k, $v);
            }
        }
    }
    return indent($new);
}
// Print out the files conversion
print convert_xml($argv[1]);
Ejemplo n.º 2
0
function link_xml($result, $query, $urlquery, $start_all)
{
    global $db_con, $clear;
    $xml_result = array();
    $num_rows = count($result);
    if ($num_rows == 1) {
        //      No links found
        $xml_result['query'] = $query;
        $xml_result['time'] = $endtime;
        $xml_result['total_results'] = '1';
        // only the calling URL is available
    } else {
        // prepare the XML media output
        $xml_result['query'] = $query;
        $xml_result['time'] = round(getmicrotime() - $start_all, 3);
        $xml_result['total_results'] = $num_rows;
        $i = 0;
        while ($i < $num_rows) {
            $xml_result[$i]['num'] = $i + 1;
            $xml_result[$i]['link'] = $result["{$i}"]["url"];
            $xml_result[$i]['title'] = $result["{$i}"]["title"];
            $xml_result[$i]['description'] = $result["{$i}"]["description"];
            $xml_result[$i]['size'] = $result["{$i}"]["size"];
            $xml_result[$i]['url'] = $urlquery;
            $i++;
        }
    }
    convert_xml($xml_result, 'link');
    if ($clear == 1) {
        $xml_result = array();
    }
    return;
}