示例#1
0
$to_text = '';
if (!empty($_REQUEST['from']) || !empty($_REQUEST['to'])) {
    if (!empty($_REQUEST['from'])) {
        $from_text = $_REQUEST['from'];
    }
    if (!empty($_REQUEST['to'])) {
        $to_text = $_REQUEST['to'];
    }
}
$diff = '';
$granularityStacks = array(FineDiff::$paragraphGranularity, FineDiff::$sentenceGranularity, FineDiff::$wordGranularity, FineDiff::$characterGranularity);
$from_len = strlen($from_text);
$to_len = strlen($to_text);
$start_time = gettimeofday(true);
$diff = new FineDiff($from_text, $to_text, $granularityStacks[$granularity]);
$edits = $diff->getOps();
$exec_time = gettimeofday(true) - $start_time;
$rendered_diff = $diff->renderDiffToHTML();
$rendering_time = gettimeofday(true) - $start_time;
$diff_len = strlen($diff->getOpcodes());
?>
<form action="viewdiff.php" method="post">
<div class="panecontainer" style="display:inline-block;width:49.5%"><p>From</p><div><textarea name="from" class="pane"><?php 
echo htmlentities($from_text);
?>
</textarea></div></div>
<div class="panecontainer" style="display:inline-block;width:49.5%"><p>To</p><div><textarea name="to" class="pane"><?php 
echo htmlentities($to_text);
?>
</textarea></div></div>
<p id="params">Granularity:<input name="granularity" type="radio" value="0"<?php