This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/lib/Moebooru/Diff.php

21 lines
530 B
PHP
Raw Normal View History

2013-10-27 01:06:58 +02:00
<?php
namespace Moebooru;
class Diff
{
static public function generate($fromText, $toText)
{
if (!is_array($fromText)) {
$fromText = preg_split('/\v/', $fromText);
}
if (!is_array($toText)) {
$toText = preg_split('/\v/', $toText);
}
$diff = new \Horde_Text_Diff('auto', [$fromText, $toText]);
$renderer = new \Horde_Text_Diff_Renderer_Inline();
$result = $renderer->render($diff);
return nl2br(trim($result));
}
}