本文整理匯總了PHP中UnifiedDiffFormatter類的典型用法代碼示例。如果您正苦於以下問題:PHP UnifiedDiffFormatter類的具體用法?PHP UnifiedDiffFormatter怎麽用?PHP UnifiedDiffFormatter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了UnifiedDiffFormatter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: diff_compute
function diff_compute($text1, $text2)
{
$text1 = explode("\n", "\n" . $text1);
$text2 = explode("\n", "\n" . $text2);
$diff = new Diff($text1, $text2);
$formatter = new UnifiedDiffFormatter();
return $formatter->format($diff);
}
示例2: test1
public function test1()
{
$x1 = "din hatt har en kant\nDin med!\n";
$x2 = "min hatt har en kant\nDin med!\n";
$df = new Diff($x1, $x2);
//$form = new TableDiffFormatter();
$form = new UnifiedDiffFormatter();
$expected = "@@ -1,3 +1,3 @@\n" . "- din hatt har en kant\n" . "+ min hatt har en kant\n" . " Din med!\n" . " \n";
$this->assertEquals($expected, $form->format($df));
}
示例3: showDiff
protected function showDiff($str1, $str2)
{
$diff = new Diff(explode("\n", $str1), explode("\n", $str2));
if ($diff->isEmpty()) {
$this->fail("No difference ???");
} else {
$fmt = new UnifiedDiffFormatter();
$this->fail($fmt->format($diff));
}
}
示例4: paintDiff
function paintDiff($stringA, $stringB)
{
$diff = new Diff(explode("\n", $stringA), explode("\n", $stringB));
if ($diff->isEmpty()) {
$this->_response->addContent('<p>Erreur diff : bizarre, aucune différence d\'aprés la difflib...</p>');
} else {
$fmt = new UnifiedDiffFormatter();
$this->_response->addContent($fmt->format($diff));
}
}
示例5: git_diff
function git_diff($proj, $from, $from_name, $to, $to_name)
{
$fromdata = $from ? $proj->GetObject($from)->data : "";
$todata = $to ? $proj->GetObject($to)->data : "";
$fromdata = str_replace("\r\n", "\n", $fromdata);
$todata = str_replace("\r\n", "\n", $todata);
$diff = new Diff(explode("\n", $fromdata), explode("\n", $todata));
$diffFormatter = new UnifiedDiffFormatter();
$diffFormatter->leading_context_lines = 3;
$diffFormatter->trailing_context_lines = 3;
$out = "--- {$from_name}\n+++ {$to_name}\n" . $diffFormatter->format($diff);
return $out;
}
示例6: generateDiffBodyTxt
/**
* Generates a diff txt
* @param Title $title
* @return string
*/
function generateDiffBodyTxt( $title ) {
$revision = Revision::newFromTitle( $title, 0 );
$diff = new DifferenceEngine( $title, $revision->getId(), 'prev' );
// The getDiffBody() method generates html, so let's generate the txt diff manualy:
global $wgContLang;
$diff->loadText();
$otext = str_replace( "\r\n", "\n", $diff->mOldtext );
$ntext = str_replace( "\r\n", "\n", $diff->mNewtext );
$ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
$nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
// We use here the php diff engine included in MediaWiki
$diffs = new Diff( $ota, $nta );
// And we ask for a txt formatted diff
$formatter = new UnifiedDiffFormatter();
$diff_text = $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) );
return $diff_text;
}
示例7: sendPageChangeNotification
/**
* Send udiff for a changed page to multiple users.
* See rename and remove methods also
*/
function sendPageChangeNotification(&$wikitext, $version, &$meta)
{
global $request;
if (@is_array($request->_deferredPageChangeNotification)) {
// collapse multiple changes (loaddir) into one email
$request->_deferredPageChangeNotification[] = array($this->pagename, $this->emails, $this->userids);
return;
}
$backend =& $request->_dbi->_backend;
$subject = _("Page change") . ' ' . $this->pagename;
$previous = $backend->get_previous_version($this->pagename, $version);
if (!isset($meta['mtime'])) {
$meta['mtime'] = time();
}
if ($previous) {
$difflink = WikiURL($this->pagename, array('action' => 'diff'), true);
$cache =& $request->_dbi->_cache;
$this_content = explode("\n", $wikitext);
$prevdata = $cache->get_versiondata($this->pagename, $previous, true);
if (empty($prevdata['%content'])) {
$prevdata = $backend->get_versiondata($this->pagename, $previous, true);
}
$other_content = explode("\n", $prevdata['%content']);
include_once "lib/difflib.php";
$diff2 = new Diff($other_content, $this_content);
//$context_lines = max(4, count($other_content) + 1,
// count($this_content) + 1);
$fmt = new UnifiedDiffFormatter();
$content = $this->pagename . " " . $previous . " " . Iso8601DateTime($prevdata['mtime']) . "\n";
$content .= $this->pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= $fmt->format($diff2);
} else {
$difflink = WikiURL($this->pagename, array(), true);
$content = $this->pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= _("New page");
$content .= "\n\n";
$content .= $wikitext;
}
$editedby = sprintf(_("Edited by: %s"), $this->from);
$summary = sprintf(_("Summary: %s"), $meta['summary']);
$this->sendMail($subject, $editedby . "\n" . $summary . "\n" . $difflink . "\n\n" . $content);
}
示例8: sendPageChangeNotification
/**
* Send udiff for a changed page to multiple users.
* See rename and remove methods also
*/
function sendPageChangeNotification(&$wikitext, $version, $meta, $emails, $userids)
{
global $request;
if (@is_array($request->_deferredPageChangeNotification)) {
// collapse multiple changes (loaddir) into one email
$request->_deferredPageChangeNotification[] = array($this->_pagename, $emails, $userids);
return;
}
$backend =& $this->_wikidb->_backend;
//$backend = &$request->_dbi->_backend;
$subject = _("Page change") . ' ' . $this->_pagename;
$previous = $backend->get_previous_version($this->_pagename, $version);
if (!isset($meta['mtime'])) {
$meta['mtime'] = time();
}
if ($previous) {
$difflink = WikiURL($this->_pagename, array('action' => 'diff'), true);
$difflink .= "&versions%5b%5d=" . $previous . "&versions%5b%5d=" . $version;
$cache =& $this->_wikidb->_cache;
//$cache = &$request->_dbi->_cache;
$this_content = explode("\n", $wikitext);
$prevdata = $cache->get_versiondata($this->_pagename, $previous, true);
if (empty($prevdata['%content'])) {
$prevdata = $backend->get_versiondata($this->_pagename, $previous, true);
}
$other_content = explode("\n", $prevdata['%content']);
include_once "lib/difflib.php";
$diff2 = new Diff($other_content, $this_content);
//$context_lines = max(4, count($other_content) + 1,
// count($this_content) + 1);
$fmt = new UnifiedDiffFormatter();
$content = $this->_pagename . " " . $previous . " " . Iso8601DateTime($prevdata['mtime']) . "\n";
$content .= $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= $fmt->format($diff2);
} else {
$difflink = WikiURL($this->_pagename, array(), true);
$content = $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= _("New page");
}
// Codendi specific
$from = user_getemail(user_getid());
$body = $subject . "\n" . sprintf(_("Edited by: %s"), $from) . "\n" . $difflink;
$m = new Mail();
$m->setFrom($from);
$m->setSubject("[" . WIKI_NAME . "] " . $subject);
$m->setBcc(join(',', $emails));
$m->setBody($body);
if ($m->send()) {
trigger_error(sprintf(_("PageChange Notification of %s sent to %s"), $this->_pagename, join(',', $userids)), E_USER_NOTICE);
} else {
trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"), $this->_pagename, join(',', $userids)), E_USER_WARNING);
}
}
示例9: sendPageChangeNotification
/**
* Send udiff for a changed page to multiple users.
* See rename and remove methods also
*/
function sendPageChangeNotification(&$wikitext, $version, $meta, $emails, $userids)
{
global $request;
if (@is_array($request->_deferredPageChangeNotification)) {
// collapse multiple changes (loaddir) into one email
$request->_deferredPageChangeNotification[] = array($this->_pagename, $emails, $userids);
return;
}
$backend =& $this->_wikidb->_backend;
//$backend = &$request->_dbi->_backend;
$subject = _("Page change") . ' ' . urlencode($this->_pagename);
$previous = $backend->get_previous_version($this->_pagename, $version);
if (!isset($meta['mtime'])) {
$meta['mtime'] = time();
}
if ($previous) {
$difflink = WikiURL($this->_pagename, array('action' => 'diff'), true);
$cache =& $this->_wikidb->_cache;
//$cache = &$request->_dbi->_cache;
$this_content = explode("\n", $wikitext);
$prevdata = $cache->get_versiondata($this->_pagename, $previous, true);
if (empty($prevdata['%content'])) {
$prevdata = $backend->get_versiondata($this->_pagename, $previous, true);
}
$other_content = explode("\n", $prevdata['%content']);
include_once "lib/difflib.php";
$diff2 = new Diff($other_content, $this_content);
//$context_lines = max(4, count($other_content) + 1,
// count($this_content) + 1);
$fmt = new UnifiedDiffFormatter();
$content = $this->_pagename . " " . $previous . " " . Iso8601DateTime($prevdata['mtime']) . "\n";
$content .= $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= $fmt->format($diff2);
} else {
$difflink = WikiURL($this->_pagename, array(), true);
$content = $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n";
$content .= _("New page");
}
$from = $request->_user->getId();
$editedby = sprintf(_("Edited by: %s"), $from);
$emails = join(',', $emails);
$headers = "From: {$from} <nobody>\r\n" . "Bcc: {$emails}\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/plain; charset=" . CHARSET . "; format=flowed\r\n" . "Content-Transfer-Encoding: 8bit";
if (mail("<undisclosed-recipients>", "[" . WIKI_NAME . "] " . $subject, $subject . "\n" . $editedby . "\n" . $difflink . "\n\n" . $content, $headers)) {
trigger_error(sprintf(_("PageChange Notification of %s sent to %s"), $this->_pagename, join(',', $userids)), E_USER_NOTICE);
} else {
trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"), $this->_pagename, join(',', $userids)), E_USER_WARNING);
}
}
示例10: send_diff
/**
* Send the diff for some page change
*
* @param string $subscriber_mail The target mail address
* @param string $template Mail template ('subscr_digest', 'subscr_single', 'mailtext', ...)
* @param string $id Page for which the notification is
* @param int|null $rev Old revision if any
* @param string $summary Change summary if any
* @return bool true if successfully sent
*/
public function send_diff($subscriber_mail, $template, $id, $rev = null, $summary = '')
{
global $DIFF_INLINESTYLES;
// prepare replacements (keys not set in hrep will be taken from trep)
$trep = array('PAGE' => $id, 'NEWPAGE' => wl($id, '', true, '&'), 'SUMMARY' => $summary, 'SUBSCRIBE' => wl($id, array('do' => 'subscribe'), true, '&'));
$hrep = array();
if ($rev) {
$subject = 'changed';
$trep['OLDPAGE'] = wl($id, "rev={$rev}", true, '&');
$old_content = rawWiki($id, $rev);
$new_content = rawWiki($id);
$df = new Diff(explode("\n", $old_content), explode("\n", $new_content));
$dformat = new UnifiedDiffFormatter();
$tdiff = $dformat->format($df);
$DIFF_INLINESTYLES = true;
$df = new Diff(explode("\n", $old_content), explode("\n", $new_content));
$dformat = new InlineDiffFormatter();
$hdiff = $dformat->format($df);
$hdiff = '<table>' . $hdiff . '</table>';
$DIFF_INLINESTYLES = false;
} else {
$subject = 'newpage';
$trep['OLDPAGE'] = '---';
$tdiff = rawWiki($id);
$hdiff = nl2br(hsc($tdiff));
}
$trep['DIFF'] = $tdiff;
$hrep['DIFF'] = $hdiff;
$headers = array('Message-Id' => $this->getMessageID($id));
if ($rev) {
$headers['In-Reply-To'] = $this->getMessageID($id, $rev);
}
return $this->send($subscriber_mail, $subject, $id, $template, $trep, $hrep, $headers);
}
示例11: do_msgfmt
//.........這裏部分代碼省略.........
}
$formatter->send_footer('', $options);
return;
}
$msgkeys = array_keys($options);
$msgids = preg_grep('/^msgid-/', $msgkeys);
$msgstrs = preg_grep('/^msgstr-/', $msgkeys);
if (sizeof($msgids) != sizeof($msgstrs)) {
print "Invalid request.";
return;
}
$rawpo = $formatter->page->_get_raw_body();
$lines = explode("\n", $rawpo);
$po = '';
$comment = '';
$msgid = array();
$msgstr = array();
foreach ($lines as $l) {
if ($l[0] != 'm' and !preg_match('/^\\s*"/', $l)) {
if ($msgstr) {
$mid = implode("\n", $msgid);
$id = md5($mid);
$msg = preg_replace("/(\r\n|\r)/", "\n", _stripslashes($options['msgstr-' . $id]));
$sid = md5(rtrim($msg));
if ($options['md5sum-' . $id] and $options['md5sum-' . $id] != $sid) {
$comment = preg_replace('/#, fuzzy\\n/m', '', $comment);
$comment = str_replace(', fuzzy', '', $comment);
}
# fix msgstr
#$msg=preg_replace('/(?!<\\\\)"/','\\"',$msg);
$po .= $comment;
$po .= 'msgid ' . preg_replace('/(\\r\\n|\\r)/', "\n", _stripslashes($options['msgid-' . $id])) . "\n";
$po .= 'msgstr ' . $msg . "\n";
# init
$msgid = array();
$msgstr = array();
$comment = '';
}
if ($l[0] == '#' and $l[1] == ',') {
if ($comment) {
$po .= $comment;
$comment = '';
}
$comment .= $l . "\n";
} else {
if ($comment) {
$po .= $comment;
$comment = '';
}
$po .= $l . "\n";
continue;
}
} else {
if (preg_match('/^(msgid|msgstr)\\s+(".*")\\s*$/', $l, $m)) {
if ($m[1] == 'msgid') {
$msgid[] = $m[2];
continue;
}
$msgstr[] = $m[2];
} else {
if (preg_match('/^\\s*(".*")\\s*$/', $l, $m)) {
if ($msgstr) {
$msgstr[] = $m[1];
} else {
$msgid[] = $m[1];
}
} else {
$po .= $l . "\n";
}
}
}
}
$formatter->send_header('', $options);
$formatter->send_title(sprintf(_("Translation of %s"), $options['page']), '', $options);
$e = _pocheck($po);
#if ($e != true) return;
#print $po;
$url = $formatter->link_url($formatter->page->urlname);
print "<form method='post' action='{$url}'>\n" . "<input type='hidden' name='action' value='msgfmt' />\n";
print "<input type='submit' name='btn' value='Save Translation ?' /> ";
print "Summary:" . " <input type='text' size='60' name='comment' value='Translations are updated' />" . "<br />\n";
if ($options['patch']) {
include_once 'lib/difflib.php';
$rawpo = array_map(create_function('$a', 'return $a."\\n";'), explode("\n", $rawpo));
$newpo = array_map(create_function('$a', 'return $a."\\n";'), explode("\n", $po));
$diff = new Diff($rawpo, $newpo);
$f = new UnifiedDiffFormatter();
$f->trailing_cr = "";
$diffs = $f->format($diff);
$sz = sizeof(explode("\n", $diffs));
print "<textarea cols='80' rows='{$sz}' style='width:80%'>";
print $diffs;
print "</textarea>\n";
}
$po = _html_escape($po);
print "<input type='hidden' name='po' value=\"{$po}\" />\n";
print "</form>";
$formatter->send_footer('', $options);
return;
}
示例12: notify
/**
* Sends a notify mail on page change
*
* @param string $id The changed page
* @param string $who Who to notify (admin|subscribers)
* @param int $rev Old page revision
* @param string $summary What changed
* @param boolean $minor Is this a minor edit?
* @param array $replace Additional string substitutions, @KEY@ to be replaced by value
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = array())
{
global $lang;
global $conf;
// decide if there is something to do
if ($who == 'admin') {
if (empty($conf['notify'])) {
return;
}
//notify enabled?
$text = rawLocale('mailtext');
$to = $conf['notify'];
$bcc = '';
} elseif ($who == 'subscribers') {
if (!$conf['subscribers']) {
return;
}
//subscribers enabled?
if ($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) {
return;
}
//skip minors
$bcc = subscriber_addresslist($id);
if (empty($bcc)) {
return;
}
$to = '';
$text = rawLocale('subscribermail');
} elseif ($who == 'register') {
if (empty($conf['registernotify'])) {
return;
}
$text = rawLocale('registermail');
$to = $conf['registernotify'];
$bcc = '';
} else {
return;
//just to be safe
}
$text = str_replace('@DATE@', date($conf['dformat']), $text);
$text = str_replace('@BROWSER@', $_SERVER['HTTP_USER_AGENT'], $text);
$text = str_replace('@IPADDRESS@', $_SERVER['REMOTE_ADDR'], $text);
$text = str_replace('@HOSTNAME@', gethostbyaddr($_SERVER['REMOTE_ADDR']), $text);
$text = str_replace('@NEWPAGE@', wl($id, '', true), $text);
$text = str_replace('@PAGE@', $id, $text);
$text = str_replace('@TITLE@', $conf['title'], $text);
$text = str_replace('@DOKUWIKIURL@', DOKU_URL, $text);
$text = str_replace('@SUMMARY@', $summary, $text);
$text = str_replace('@USER@', $_SERVER['REMOTE_USER'], $text);
foreach ($replace as $key => $substitution) {
$text = str_replace('@' . strtoupper($key) . '@', $substitution, $text);
}
if ($who == 'register') {
$subject = $lang['mail_new_user'] . ' ' . $summary;
} elseif ($rev) {
$subject = $lang['mail_changed'] . ' ' . $id;
$text = str_replace('@OLDPAGE@', wl($id, "rev={$rev}", true), $text);
require_once DOKU_INC . 'inc/DifferenceEngine.php';
$df = new Diff(split("\n", rawWiki($id, $rev)), split("\n", rawWiki($id)));
$dformat = new UnifiedDiffFormatter();
$diff = $dformat->format($df);
} else {
$subject = $lang['mail_newpage'] . ' ' . $id;
$text = str_replace('@OLDPAGE@', 'none', $text);
$diff = rawWiki($id);
}
$text = str_replace('@DIFF@', $diff, $text);
$subject = '[' . $conf['title'] . '] ' . $subject;
mail_send($to, $subject, $text, $conf['mailfrom'], '', $bcc);
}
示例13: rss_buildItems
//.........這裏部分代碼省略.........
}
if ($rev && ($size = media_image_preview_size($id, $rev, new JpegMeta(mediaFN($id, $rev)), 300))) {
$more = 'rev=' . $rev . '&w=' . $size[0] . '&h=' . $size[1];
$src_l = ml($id, $more);
}
$content = '';
if ($src_r) {
$content = '<table>';
$content .= '<tr><th width="50%">' . $rev . '</th>';
$content .= '<th width="50%">' . $lang['current'] . '</th></tr>';
$content .= '<tr align="center"><td><img src="' . $src_l . '" alt="" /></td><td>';
$content .= '<img src="' . $src_r . '" alt="' . $id . '" /></td></tr>';
$content .= '</table>';
}
} else {
require_once DOKU_INC . 'inc/DifferenceEngine.php';
$revs = getRevisions($id, 0, 1);
$rev = $revs[0];
if ($rev) {
$df = new Diff(explode("\n", rawWiki($id, $rev)), explode("\n", rawWiki($id, '')));
} else {
$df = new Diff(array(''), explode("\n", rawWiki($id, '')));
}
if ($opt['item_content'] == 'htmldiff') {
// note: no need to escape diff output, TableDiffFormatter provides 'safe' html
$tdf = new TableDiffFormatter();
$content = '<table>';
$content .= '<tr><th colspan="2" width="50%">' . $rev . '</th>';
$content .= '<th colspan="2" width="50%">' . $lang['current'] . '</th></tr>';
$content .= $tdf->format($df);
$content .= '</table>';
} else {
// note: diff output must be escaped, UnifiedDiffFormatter provides plain text
$udf = new UnifiedDiffFormatter();
$content = "<pre>\n" . hsc($udf->format($df)) . "\n</pre>";
}
}
break;
case 'html':
if ($ditem['media']) {
if ($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)))) {
$more = 'w=' . $size[0] . '&h=' . $size[1] . 't=' . @filemtime(mediaFN($id));
$src = ml($id, $more);
$content = '<img src="' . $src . '" alt="' . $id . '" />';
} else {
$content = '';
}
} else {
if (@filemtime(wikiFN($id)) === $date) {
$content = p_wiki_xhtml($id, '', false);
} else {
$content = p_wiki_xhtml($id, $date, false);
}
// no TOC in feeds
$content = preg_replace('/(<!-- TOC START -->).*(<!-- TOC END -->)/s', '', $content);
// add alignment for images
$content = preg_replace('/(<img .*?class="medialeft")/s', '\\1 align="left"', $content);
$content = preg_replace('/(<img .*?class="mediaright")/s', '\\1 align="right"', $content);
// make URLs work when canonical is not set, regexp instead of rerendering!
if (!$conf['canonical']) {
$base = preg_quote(DOKU_REL, '/');
$content = preg_replace('/(<a href|<img src)="(' . $base . ')/s', '$1="' . DOKU_URL, $content);
}
}
break;
case 'abstract':
示例14: get_diff
function get_diff($text, $rev = '')
{
global $DBInfo;
if (!isset($text[0])) {
$text = "\n";
}
if (!empty($DBInfo->use_external_diff)) {
$tmpf2 = tempnam($DBInfo->vartmp_dir, 'DIFF_NEW');
$fp = fopen($tmpf2, 'w');
if (!is_resource($fp)) {
return '';
}
// ignore
fwrite($fp, $text);
fclose($fp);
$fp = popen('diff -u ' . $this->page->filename . ' ' . $tmpf2 . $this->NULL, 'r');
if (!is_resource($fp)) {
unlink($tmpf2);
return '';
}
$out = '';
while (!feof($fp)) {
$line = fgets($fp, 1024);
$out .= $line;
}
pclose($fp);
unlink($tmpf2);
} else {
require_once 'lib/difflib.php';
$orig = $this->page->_get_raw_body();
$olines = explode("\n", $orig);
$tmp = array_pop($olines);
if ($tmp != '') {
$olines[] = $tmp;
}
$nlines = explode("\n", $text);
$tmp = array_pop($nlines);
if ($tmp != '') {
$nlines[] = $tmp;
}
$diff = new Diff($olines, $nlines);
$unified = new UnifiedDiffFormatter();
$unified->trailing_cr = " \n";
// hack to see inserted empty lines
$out .= $unified->format($diff);
}
return $out;
}
示例15: _approval_form
function _approval_form(&$request, $args, $moderation, $pass = 'approve')
{
$header = HTML::h3(_("Please approve or reject this request:"));
$loader = new WikiPluginLoader();
$BackendInfo = $loader->getPlugin("_BackendInfo");
$table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
$content = $table;
$diff = '';
if ($moderation['args']['action'] == 'edit') {
$pagename = $moderation['args']['pagename'];
$p = $request->_dbi->getPage($pagename);
$rev = $p->getCurrentRevision(true);
$curr_content = $rev->getPackedContent();
$new_content = $moderation['args']['edit']['content'];
include_once "lib/difflib.php";
$diff2 = new Diff($curr_content, $new_content);
$fmt = new UnifiedDiffFormatter();
$diff = $pagename . " Current Version " . Iso8601DateTime($p->get('mtime')) . "\n";
$diff .= $pagename . " Edited Version " . Iso8601DateTime($moderation['timestamp']) . "\n";
$diff .= $fmt->format($diff2);
}
$content->pushContent($BackendInfo->_showhash("Request", array('User' => $moderation['userid'], 'When' => CTime($moderation['timestamp']), 'Pagename' => $pagename, 'Action' => $moderation['args']['action'], 'Diff' => HTML::pre($diff))));
$content_dbg = $table;
$myargs = $args;
$BackendInfo->_fixupData($myargs);
$content_dbg->pushContent($BackendInfo->_showhash("raw request args", $myargs));
$BackendInfo->_fixupData($moderation);
$content_dbg->pushContent($BackendInfo->_showhash("raw moderation data", $moderation));
$reason = HTML::div(_("Reason: "), HTML::textarea(array('name' => 'reason')));
$approve = Button('submit:ModeratedPage[approve]', _("Approve"), $pass == 'approve' ? 'wikiadmin' : 'button');
$reject = Button('submit:ModeratedPage[reject]', _("Reject"), $pass == 'reject' ? 'wikiadmin' : 'button');
$args['action'] = _("ModeratedPage");
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $content, HTML::p(""), $content_dbg, $reason, ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), HiddenInputs($args), $pass == 'approve' ? HTML::p($approve, $reject) : HTML::p($reject, $approve));
}