Ejemplo n.º 1
0
function parse_config_file($filename)
{
    // Save old magic_quotes_runtime value and disable it
    $mq_runtime = get_magic_quotes_runtime();
    set_magic_quotes_runtime(0);
    $doc = TreeBuilder::build(file_get_contents($filename));
    $root = $doc->document_element();
    $child = $root->first_child();
    do {
        if ($child->node_type() == XML_ELEMENT_NODE) {
            switch ($child->tagname()) {
                case "fonts":
                    global $g_font_resolver;
                    parse_fonts_node_config_file($child, $g_font_resolver);
                    break;
                case "fonts-pdf":
                    global $g_font_resolver_pdf;
                    parse_fonts_node_config_file($child, $g_font_resolver_pdf);
                    break;
                case "media":
                    add_predefined_media($child->get_attribute('name'), (double) $child->get_attribute('height'), (double) $child->get_attribute('width'));
                    break;
            }
        }
    } while ($child = $child->next_sibling());
    // Restore old magic_quotes_runtime values
    set_magic_quotes_runtime($mq_runtime);
}
Ejemplo n.º 2
0
function parse_config_file($filename)
{
    $doc = TreeBuilder::build(file_get_contents($filename));
    $root = $doc->document_element();
    $child = $root->first_child();
    do {
        if ($child->node_type() == XML_ELEMENT_NODE) {
            switch ($child->tagname()) {
                case "fonts":
                    global $g_font_resolver;
                    parse_fonts_node_config_file($child, $g_font_resolver);
                    break;
                case "fonts-pdf":
                    global $g_font_resolver_pdf;
                    parse_fonts_node_config_file($child, $g_font_resolver_pdf);
                    break;
                case "media":
                    add_predefined_media($child->get_attribute('name'), (int) $child->get_attribute('height'), (int) $child->get_attribute('width'));
                    break;
            }
        }
    } while ($child = $child->next_sibling());
}