89da040689d07e5feeee9dffd1db52f07c6f9290
[yaffs-website] / vendor / mkalkbrenner / php-htmldiff-advanced / demo / index.php
1 <?php
2
3         require_once( '../vendor/autoload.php' );
4         $html1 = "<p><i>This is</i> some sample text to <strong>demonstrate</strong> the capability of the <strong>HTML diff tool</strong>.</p>
5                                 <p>It is based on the <b>Ruby</b> implementation found <a href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has no tooltip</p>
6                                 <table cellpadding='0' cellspacing='0'>
7                                 <tr><td>Some sample text</td><td>Some sample value</td></tr>
8                                 <tr><td>Data 1 (this row will be removed)</td><td>Data 2</td></tr>
9                                 </table>
10                                 Here is a number 2 32
11                                 <h2>Heading number one</h2>
12                                 <p>This paragraph will be deleted.</p>
13                                 <p>Another paragraph variant 1.</p>
14                                 <p>The last paragraph.</p>
15                                 <ul>
16                                   <li>Number 1</li>
17                                   <li>Number 2</li>
18                                   <li>Number 3</li>
19                                 </ul>
20                                 A table.
21                                 <table border='1'>
22                                   <tr>
23                                     <td>d1</td><td>d2</td>
24                                   </tr><tr>
25                                     <td>d3</td><td>d4</td>
26                                   </tr><tr>
27                                     <td>d5</td><td>d6</td>
28                                   </tr>
29                                 </table>
30                                 Another table.
31                                 <table border='1'>
32                                   <tr>
33                                     <td>d1</td><td>d2</td>
34                                   </tr><tr>
35                                     <td>d3</td><td>d4</td>
36                                   </tr><tr>
37                                     <td>d5</td><td>d6</td>
38                                   </tr>
39                                 </table>
40                                 ";
41         $html2 = "<p>This is some sample <strong>text to</strong> demonstrate the awesome capabilities of the <strong>HTML <u>diff</u> tool</strong>.</p><br/><br/>Extra spacing here that was not here before.
42                                 <p>It is <i>based</i> on the Ruby implementation found <a title='Cool tooltip' href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has a tooltip now and the HTML diff algorithm has preserved formatting.</p>
43                                 <table cellpadding='0' cellspacing='0'>
44                                 <tr><td>Some sample <strong>bold text</strong></td><td>Some sample value</td></tr>
45                                 </table>
46                                 Here is a number 2 <sup>32</sup>
47                                 <h2>Heading Number One</h2>
48                                 <p>Another paragraph variant 2.</p>
49                                 <p>The last paragraph.</p>
50                                 <ul>
51                                   <li>Number 1</li>
52                                   <li>Number 3</li>
53                                 </ul>
54                                 A table.
55                                 <table border='1'>
56                                   <tr>
57                                     <td>d1</td><td>d2</td><td>d3</td>
58                                   </tr><tr>
59                                     <td>d5</td><td>d6</td><td>d4</td>
60                                   </tr>
61                                 </table>
62                                 Another table.
63                                 <table border='1'>
64                                   <tr>
65                                     <td>d1</td><td>d2</td>
66                                   </tr><tr>
67                                     <td>d5</td><td>d6</td>
68                                   </tr>
69                                 </table>
70                                 ";
71         $diff = new HtmlDiffAdvanced();
72         $diff->setOldHtml($html1);
73         $diff->setNewHtml($html2);
74         echo "<h2>Old html</h2>";
75         echo $diff->getOldHtml();
76         echo "<hr><h2>New html</h2>";
77         echo $diff->getNewHtml();
78         echo "<hr><h2>Compared html</h2>";
79         echo $diff->getDifference();