function html2xhtml($html)
{
    process_pagebreak_commands($html);
    // Remove SCRIPT tags from the page being processed, as script content may
    // mess the firther html-parsing utilities
    $html = process_script($html);
    // Remove STYLE tags for the same reason and store them in the temporary variable
    // later they will be added back to HEAD section
    $styles = process_style($html);
    // Convert HTML character references to their Unicode analogues
    process_character_references($html);
    remove_comments($html);
    fix_attrs_spaces($html);
    $html = quote_attrs($html);
    $html = escape_attrs_entities($html);
    $html = lowercase_tags($html);
    $html = lowercase_closing_tags($html);
    $html = fix_closing_tags($html);
    $html = close_tag("area", $html);
    $html = close_tag("base", $html);
    $html = close_tag("basefont", $html);
    $html = close_tag("br", $html);
    $html = close_tag("col", $html);
    $html = close_tag("embed", $html);
    $html = close_tag("frame", $html);
    $html = close_tag("hr", $html);
    $html = close_tag("img", $html);
    $html = close_tag("input", $html);
    $html = close_tag("isindex", $html);
    $html = close_tag("link", $html);
    $html = close_tag("meta", $html);
    $html = close_tag("param", $html);
    $html = make_attr_value("checked", $html);
    $html = make_attr_value("compact", $html);
    $html = make_attr_value("declare", $html);
    $html = make_attr_value("defer", $html);
    $html = make_attr_value("disabled", $html);
    $html = make_attr_value("ismap", $html);
    $html = make_attr_value("multiple", $html);
    $html = make_attr_value("nohref", $html);
    $html = make_attr_value("noresize", $html);
    $html = make_attr_value("noshade", $html);
    $html = make_attr_value("nowrap", $html);
    $html = make_attr_value("readonly", $html);
    $html = make_attr_value("selected", $html);
    $html = process_html($html);
    $html = process_body($html);
    $html = process_head($html);
    $html = process_p($html);
    $html = escape_amp($html);
    $html = escape_lt($html);
    $html = escape_gt($html);
    $html = escape_textarea_content($html);
    process_tables($html, 0);
    process_lists($html, 0);
    process_deflists($html, 0);
    process_selects($html, 0);
    $html = fix_tags($html);
    $html = fix_attrs($html);
    $html = insert_styles($html, $styles);
    return $html;
}
Exemple #2
0
if ($db2->schema) {
    if (!file_exists($db1->schema)) {
        error("schema file 2 does not exist");
    }
    $db2->database = "tmp_schema_" . uniqid();
}
if ($db1->host == $db2->host && $db1->database == $db2->database && !$db1->schema && !$db2->schema) {
    error("databases names must be different if they reside on the same host");
}
if ($options->output_file) {
    if (file_exists($options->output_file) && !$options->overwrite) {
        if (prompt("Output file {$options->output_file} exists. Overwrite it (y/n)? ") != 'y') {
            exit(0);
        }
    }
    $options->ofh = @fopen($options->output_file, 'w') or error("error creating output file {$options->output_file}");
}
$db1->link = @mysql_connect($db1->host, $db1->user, $db1->pwd, TRUE) or error(mysql_error());
create_schema_db($db1);
mysql_selectdb($db1->database, $db1->link) or error(mysql_error($db1->link));
$db2->link = @mysql_connect($db2->host, $db2->user, $db2->pwd, TRUE) or error(mysql_error());
create_schema_db($db2);
mysql_selectdb($db2->database, $db2->link) or error(mysql_error($db2->link));
load_schema_db($db1);
load_schema_db($db2);
populate_schemata_info($db1);
populate_schemata_info($db2);
process_database($db1, $db2);
process_tables($db1, $db2);
drop_schema_db($db1);
drop_schema_db($db2);