Exemple #1
0
 function format($diff)
 {
     // Preserve whitespaces by converting some to non-breaking spaces.
     // Do not convert all of them to allow word-wrap.
     $val = parent::format($diff);
     $val = str_replace('  ', '  ', $val);
     $val = preg_replace('/ (?=<)|(?<=[ >]) /', '&nbsp;', $val);
     return $val;
 }
Exemple #2
0
         $output .= "<br />\n" . T_("No Differences");
     }
 } else {
     // extract text from bodies
     $textA = $this->htmlspecialchars_ent($pageB['body']);
     $textB = $this->htmlspecialchars_ent($pageA['body']);
     $sideA = new Side($textA);
     $sideB = new Side($textB);
     $bodyA = '';
     $sideA->split_file_into_words($bodyA);
     $bodyB = '';
     $sideB->split_file_into_words($bodyB);
     // diff on these two file
     $diff = new Diff(split("\n", $bodyA), split("\n", $bodyB));
     // format output
     $fmt = new DiffFormatter();
     $sideO = new Side($fmt->format($diff));
     $resync_left = 0;
     $resync_right = 0;
     $count_total_right = $sideB->getposition();
     $sideA->init();
     $sideB->init();
     $info .= '<div class="revisioninfo">' . "\n";
     $info .= '<h3>' . sprintf(T_("Comparing %s for %s"), '<a title="' . sprintf(T_("Display the revision list for %s"), $pageA['tag']) . '" href="' . $this->Href('revisions') . '">' . T_("revisions") . '</a>', '<a title="' . T_("Return to the latest version of this page") . '" href="' . $this->Href() . '">' . $pageA['tag'] . '</a>') . '</h3>' . "\n";
     $info .= '<ul style="margin: 10px 0">' . "\n";
     $info .= '	<li><a href="' . $this->Href('show', '', 'time=' . urlencode($pageA['time'])) . '">[' . $pageA['id'] . ']</a> ' . sprintf(T_("%s by %s"), '<a class="datetime" href="' . $this->Href('show', '', 'time=' . urlencode($pageA["time"])) . '">' . $pageA['time'] . '</a>', $pageA_edited_by) . ' <span class="pagenote smaller">' . $noteA . '</span></li>' . "\n";
     $info .= '	<li><a href="' . $this->Href('show', '', 'time=' . urlencode($pageB['time'])) . '">[' . $pageB['id'] . ']</a> ' . sprintf(T_("%s by %s"), '<a class="datetime" href="' . $this->Href('show', '', 'time=' . urlencode($pageB["time"])) . '">' . $pageB['time'] . '</a>', $pageB_edited_by) . ' <span class="pagenote smaller">' . $noteB . '</span></li>' . "\n";
     $info .= '</ul>' . "\n";
     $info .= $this->FormOpen('diff', '', 'GET');
     $info .= '<input type="hidden" name="fastdiff" value="1" />' . "\n";
     $info .= '<input type="hidden" name="a" value="' . $this->GetSafeVar('a', 'get') . '" />' . "\n";