<nav class="contentHeaderNavigation">
<ul>
{content}
- {if $diff}
+ {if $diff !== null}
{if $parent->templateGroupID}
<li><a href="{link controller='TemplateEdit' id=$parent->templateID}{/link}" class="button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.global.button.edit{/lang}</span></a></li>
{/if}
</div>
</form>
-{if $diff}
+{if $diff !== null}
<div id="fullscreenContainer">
<div class="sideBySide">
<div class="section">
<pre id="left" class="monospace" style="overflow: auto; height: 700px;">{*
*}<span style="display: inline-block;">{* <-- wrapper span to prevent content from overflowing the <li>
*}<ol class="nativeList">{*
- *}{foreach from=$diff->getRawDiff() item='line'}{*
+ *}{foreach from=$diff item='line'}{*
*}{if $line[0] == ' '}{*
*}{assign var=removeOffset value=0}{assign var=lineNo value=$lineNo + 1}{*
*}<li value="{@$lineNo}" style="margin: 0">{$line[1]}</li>{*
<pre id="right" class="monospace" style="overflow: auto; height: 700px;">{*
*}<span style="display: inline-block;">{* <-- wrapper span to prevent content from overflowing the <li>
*}<ol class="nativeList">{*
- *}{foreach from=$diff->getRawDiff() item='line'}{*
+ *}{foreach from=$diff item='line'}{*
*}{if $line[0] == ' '}{*
*}{if $removeOffset > 0}{*
*}{@'<li style="list-style-type: none;margin: 0"> </li>'|str_repeat:$removeOffset}{*
namespace wcf\acp\page;
+use SebastianBergmann\Diff\Differ;
use wcf\data\template\group\TemplateGroupList;
use wcf\data\template\Template;
use wcf\data\template\TemplateList;
/**
* differences between both templates
- * @var Diff
+ * @var array
*/
public $diff;
if ($this->parent->templateID) {
$a = \explode("\n", StringUtil::unifyNewlines($this->parent->getSource()));
$b = \explode("\n", StringUtil::unifyNewlines($this->template->getSource()));
- $this->diff = new Diff($a, $b);
+ $differ = new Differ();
+ $this->diff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b));
}
}
namespace wcf\acp\page;
+use SebastianBergmann\Diff\Differ;
use wcf\data\IVersionTrackerObject;
use wcf\data\language\Language;
use wcf\page\AbstractPage;
/**
* differences between both versions
- * @var Diff[]
+ * @var array
*/
public $diffs = [];
{
parent::readData();
+ $differ = new Differ();
+
// valid IDs were given, calculate diff
if ($this->old && $this->new) {
$languageIDs = $this->new->getLanguageIDs();
continue;
}
- $diff = new Diff($a, $b);
- $rawDiff = $diff->getRawDiff();
+ $rawDiff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b));
// create word diff for small changes (only one consecutive paragraph modified)
for ($i = 0, $max = \count($rawDiff); $i < $max;) {
$a = \preg_split('/(\\W)/u', $rawDiff[$i][1], -1, \PREG_SPLIT_DELIM_CAPTURE);
$b = \preg_split('/(\\W)/u', $rawDiff[$i + 1][1], -1, \PREG_SPLIT_DELIM_CAPTURE);
- $diff = new Diff($a, $b);
+ $diff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b));
$rawDiff[$i][1] = '';
$rawDiff[$i + 1][1] = '';
- foreach ($diff->getRawDiff() as $entry) {
+ foreach ($diff as $entry) {
$entry[1] = StringUtil::encodeHTML($entry[1]);
if ($entry[0] === Diff::SAME) {
namespace wcf\page;
+use SebastianBergmann\Diff\Differ;
use wcf\data\DatabaseObjectList;
use wcf\data\edit\history\entry\EditHistoryEntry;
use wcf\data\edit\history\entry\EditHistoryEntryList;
/**
* differences between both versions
- * @var Diff
+ * @var array
*/
public $diff;
$this->objectList->getConditionBuilder()->add('objectID = ?', [$this->objectID]);
$this->objectList->readObjects();
+ $differ = new Differ();
+
// valid IDs were given, calculate diff
if ($this->old && $this->new) {
$a = \explode("\n", StringUtil::unifyNewlines(StringUtil::trim($this->old->getMessage())));
$b = \explode("\n", StringUtil::unifyNewlines(StringUtil::trim($this->new->getMessage())));
- $diff = new Diff($a, $b);
- $this->diff = $diff->getRawDiff();
+ $this->diff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b));
// create word diff for small changes (only one consecutive paragraph modified)
for ($i = 0, $max = \count($this->diff); $i < $max;) {
$a = \preg_split('/(\\W)/u', $this->diff[$i][1], -1, \PREG_SPLIT_DELIM_CAPTURE);
$b = \preg_split('/(\\W)/u', $this->diff[$i + 1][1], -1, \PREG_SPLIT_DELIM_CAPTURE);
- $diff = new Diff($a, $b);
+ $diff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b));
$this->diff[$i][1] = '';
$this->diff[$i + 1][1] = '';
- foreach ($diff->getRawDiff() as $entry) {
+ foreach ($diff as $entry) {
$entry[1] = StringUtil::encodeHTML($entry[1]);
if ($entry[0] === Diff::SAME) {