예제 #1
0
파일: diff.php 프로젝트: shen0834/util
function diff2($page1, $page2)
{
    $page1 = split("\n", $page1);
    $page2 = split("\n", $page2);
    $z = new WikiDiff($page1, $page2);
    if ($z->isEmpty()) {
        $html = '<hr><br />[' . tra("Versions are identical") . ']<br /><br />';
    } else {
        //$fmt = new WikiDiffFormatter;
        $fmt = new WikiUnifiedDiffFormatter();
        $html = $fmt->format($z, $page1);
    }
    return $html;
}
예제 #2
0
    $aText = $aLang == "en" ? "Archived page:" : "Page archivée :";
    $html .= "<dl><dt>{$aText}</dt>";
    if (is_array($archive)) {
        $html .= "\n<dd>";
        $html .= sprintf(gettext("Version %s"), $archive['version']);
        $html .= "\n</dd><dd>";
        $aText = $aLang == "en" ? "Last modified on %s" : "Dernière modification : %s";
        $html .= sprintf($aText, date($datetimeformat, $archive['lastmodified']));
        $html .= "\n</dd><dd>";
        $aText = $aLang == "en" ? "By %s" : "Par %s";
        $html .= sprintf($aText, $archive['author']);
        $html .= "</dd>";
    } else {
        $html .= "<dd><em>";
        $html .= $aLang == "en" ? "None" : "Aucune";
        $html .= "</em></dd>";
    }
    $html .= "</dl></div>\n";
    if (is_array($wiki) && is_array($archive)) {
        $diff = new WikiDiff($archive['content'], $wiki['content']);
        if ($diff->isEmpty()) {
            $aText = $aLang == "en" ? "Versions are identical" : "Les versions sont identiques";
            $html .= '<hr>[' . $aText . ']';
        } else {
            //$fmt = new WikiDiffFormatter;
            $fmt = new WikiUnifiedDiffFormatter();
            $html .= $fmt->format($diff, $archive['content']);
        }
    }
    GeneratePage('MESSAGE2', $html, sprintf("Diff %s", htmlspecialchars($pagename)), 0);
}