diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:42:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:42:35 +0000 |
commit | 18db984057b83ca4962c89b6b79bdce6a660b58f (patch) | |
tree | 2c9f23c086b4dfcb3e7eb2ec69210206b0782d3c /library/vendor/php-diff/example/example.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-businessprocess-upstream.tar.xz icingaweb2-module-businessprocess-upstream.zip |
Adding upstream version 2.4.0.upstream/2.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/vendor/php-diff/example/example.php')
-rw-r--r-- | library/vendor/php-diff/example/example.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/library/vendor/php-diff/example/example.php b/library/vendor/php-diff/example/example.php new file mode 100644 index 0000000..234bc2c --- /dev/null +++ b/library/vendor/php-diff/example/example.php @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> + <title>PHP LibDiff - Examples</title> + <link rel="stylesheet" href="styles.css" type="text/css" charset="utf-8"/> + </head> + <body> + <h1>PHP LibDiff - Examples</h1> + <hr /> + <?php + + // Include the diff class + require_once dirname(__FILE__).'/../lib/Diff.php'; + + // Include two sample files for comparison + $a = explode("\n", file_get_contents(dirname(__FILE__).'/a.txt')); + $b = explode("\n", file_get_contents(dirname(__FILE__).'/b.txt')); + + // Options for generating the diff + $options = array( + //'ignoreWhitespace' => true, + //'ignoreCase' => true, + ); + + // Initialize the diff class + $diff = new Diff($a, $b, $options); + + ?> + <h2>Side by Side Diff</h2> + <?php + + // Generate a side by side diff + require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/SideBySide.php'; + $renderer = new Diff_Renderer_Html_SideBySide; + echo $diff->Render($renderer); + + ?> + <h2>Inline Diff</h2> + <?php + + // Generate an inline diff + require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/Inline.php'; + $renderer = new Diff_Renderer_Html_Inline; + echo $diff->render($renderer); + + ?> + <h2>Unified Diff</h2> + <pre><?php + + // Generate a unified diff + require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Unified.php'; + $renderer = new Diff_Renderer_Text_Unified; + echo htmlspecialchars($diff->render($renderer)); + + ?> + </pre> + <h2>Context Diff</h2> + <pre><?php + + // Generate a context diff + require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Context.php'; + $renderer = new Diff_Renderer_Text_Context; + echo htmlspecialchars($diff->render($renderer)); + ?> + </pre> + </body> +</html>
\ No newline at end of file |