Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Classes | |
class | ouwiki_change_range |
Represents a changed area of file and where it is located in the two source files. More... | |
class | ouwiki_changes |
A more logical representation of the results from ouwiki_internal_diff() More... | |
class | ouwiki_line |
Class representing one 'line' of HTML content for the purpose of text comparison. More... | |
class | ouwiki_word |
Represents single word for html comparison. More... | |
Functions | |
ouwiki_diff ($file1, $file2) | |
Runs diff and interprets results into ouwiki_changes object. More... | |
ouwiki_diff_add_markers ($html, $words, $markerclass, $beforetext, $aftertext) | |
Adds HTML span elements to $html around the words listed in $words. More... | |
ouwiki_diff_find_last (&$V, &$E, $hash) | |
ouwiki_diff_html ($html1, $html2) | |
Compares two HTML files. More... | |
ouwiki_diff_html_to_lines ($content) | |
Prepares XHTML content for text difference comparison. More... | |
ouwiki_diff_internal_flip ($diff, $count2) | |
Flips around the array returned by ouwiki_diff_internal so that it refers to lines from the other file. More... | |
ouwiki_diff_merge (&$K, &$k, $i, &$E, $p, &$candidates) | |
ouwiki_diff_sort_v ($a, $b) | |
ouwiki_diff_words ($lines1, $lines2) | |
Compares two files based initially on lines and then on words within the lines that differ. More... | |
Variables | |
for($i=1;$i<=$m;$i++) | $candidates =array() |
$candidates [0] =new StdClass | |
$candidates [1] =new StdClass | |
$E =array() | |
$E [0] =new StdClass | |
*author s marshall open ac uk *license | $file2 |
for($i=1;$i<=$m;$i++) | $index =$K[$k] |
for($i=1;$i<=$m;$i++) | $J =array() |
$K =array() | |
$K [0] =0 | |
$K [1] =1 | |
$k =0 | |
$m =count($file1) | |
for($j=1;$j<=$n;$j++) | $P =array() |
if($n==0) | $V =array() |
$candidates[0] | a =0 |
particular time, 0 if no time set - from course_modules table | |
$candidates[0] | b =0 |
*author s marshall open ac uk *license | http |
$E[0] | last =true |
$candidates[0] | previous =null |
$E[0] | serial =0 |
ouwiki_diff | ( | $file1, | |
$file2 | |||
) |
Runs diff and interprets results into ouwiki_changes object.
array | $file1 | Array of lines in file 1. The first line in the file MUST BE INDEX 1 NOT ZERO!! |
array | $file2 | Array of lines in file 2, again starting from 1. |
ouwiki_changes | Object describing changes |
ouwiki_diff_add_markers | ( | $html, | |
$words, | |||
$markerclass, | |||
$beforetext, | |||
$aftertext | |||
) |
Adds HTML span elements to $html around the words listed in $words.
string | $html | HTML content |
array | $words | Array of ouwiki_word to mark |
string | $markerclass | Name of class for span element |
HTML | with markup added |
ouwiki_diff_html | ( | $html1, | |
$html2 | |||
) |
Compares two HTML files.
(This is the main function that everything else supports.)
string | $html1 | XHTML for file 1 |
string | $html2 | XHTML for file 2 |
array | ($result1,$result2) to be displayed indicating the differences |
ouwiki_diff_html_to_lines | ( | $content | ) |
Prepares XHTML content for text difference comparison.
string | $content | XHTML content [NO SLASHES] |
array | Array of ouwiki_line objects |
ouwiki_diff_internal_flip | ( | $diff, | |
$count2 | |||
) |
Flips around the array returned by ouwiki_diff_internal so that it refers to lines from the other file.
array | $diff | Array of index1=>index2 |
int | $count2 | Count of lines in file 2 |
array | Flipped version |
ouwiki_diff_words | ( | $lines1, | |
$lines2 | |||
) |
Compares two files based initially on lines and then on words within the lines that differ.
array | $lines1 | Array of ouwiki_line |
array | $lines2 | Array of ouwiki_line |
array | (deleted,added); deleted and added are arrays of ouwiki_word with position numbers from $lines1 and $lines2 respectively |
* author s marshall open ac uk* license $file2 |