Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
ouwiki

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.
 
 ouwiki_diff_add_markers ($html, $words, $markerclass, $beforetext, $aftertext)
 Adds HTML span elements to $html around the words listed in $words.
 
 ouwiki_diff_find_last (&$V, &$E, $hash)
 
 ouwiki_diff_html ($html1, $html2)
 Compares two HTML files.
 
 ouwiki_diff_html_to_lines ($content)
 Prepares XHTML content for text difference comparison.
 
 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.
 
 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.
 

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
 
$candidates[0] b =0
 
*author s marshall open ac uk *license http
 
$E[0] last =true
 
$candidates[0] previous =null
 
$E[0] serial =0
 

Detailed Description

Function Documentation

◆ ouwiki_diff()

ouwiki_diff ( $file1,
$file2 )

Runs diff and interprets results into ouwiki_changes object.

Parameters
array$file1Array of lines in file 1. The first line in the file MUST BE INDEX 1 NOT ZERO!!
array$file2Array of lines in file 2, again starting from 1.
Return values
ouwiki_changesObject describing changes

◆ ouwiki_diff_add_markers()

ouwiki_diff_add_markers ( $html,
$words,
$markerclass,
$beforetext,
$aftertext )

Adds HTML span elements to $html around the words listed in $words.

Parameters
string$htmlHTML content
array$wordsArray of ouwiki_word to mark
string$markerclassName of class for span element
Return values
HTMLwith markup added

◆ ouwiki_diff_html()

ouwiki_diff_html ( $html1,
$html2 )

Compares two HTML files.

(This is the main function that everything else supports.)

Parameters
string$html1XHTML for file 1
string$html2XHTML for file 2
Return values
array($result1,$result2) to be displayed indicating the differences

◆ ouwiki_diff_html_to_lines()

ouwiki_diff_html_to_lines ( $content)

Prepares XHTML content for text difference comparison.

Parameters
string$contentXHTML content [NO SLASHES]
Return values
arrayArray of ouwiki_line objects

◆ ouwiki_diff_internal_flip()

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.

Parameters
array$diffArray of index1=>index2
int$count2Count of lines in file 2
Return values
arrayFlipped version

◆ ouwiki_diff_words()

ouwiki_diff_words ( $lines1,
$lines2 )

Compares two files based initially on lines and then on words within the lines that differ.

Parameters
array$lines1Array of ouwiki_line
array$lines2Array of ouwiki_line
Return values
array(deleted,added); deleted and added are arrays of ouwiki_word with position numbers from $lines1 and $lines2 respectively

Variable Documentation

◆ $file2

* author s marshall open ac uk* license $file2
Initial value:
{
$n=count($file2)