Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

File Size: 1103 lines (33 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 14 classes

_WikiDiffOp:: (3 methods):
  reverse()
  norig()
  nclosing()

_WikiDiffOp_Copy:: (2 methods):
  __construct()
  reverse()

_WikiDiffOp_Delete:: (2 methods):
  __construct()
  reverse()

_WikiDiffOp_Add:: (2 methods):
  __construct()
  reverse()

_WikiDiffOp_Change:: (2 methods):
  __construct()
  reverse()

_WikiDiffEngine:: (5 methods):
  diff()
  _diag()
  _lcs_pos()
  _compareseq()
  _shift_boundaries()

WikiDiff:: (2 methods):
  __construct()
  WikiDiff()

name:: (6 methods):
  reverse()
  isEmpty()
  lcs()
  orig()
  closing()
  _check()

MappedWikiDiff:: (1 method):
  __construct()

WikiDiffFormatter:: (12 methods):
  format()
  _block()
  _start_diff()
  _end_diff()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  _context()
  _added()
  _deleted()
  _changed()

_WikiHWLDF_WordAccumulator:: (5 methods):
  __construct()
  _flushGroup()
  _flushLine()
  addWords()
  getLines()

WordLevelWikiDiff:: (4 methods):
  __construct()
  _split()
  orig()
  closing()

TableWikiDiffFormatter:: (10 methods):
  __construct()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  _added()
  _deleted()
  _context()
  _changed()
  get_result()

TableWikiDiffFormatterOld:: (13 methods):
  TableWikiDiffFormatter()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  addedLine()
  deletedLine()
  emptyLine()
  contextLine()
  _added()
  _deleted()
  _context()
  _changed()


Class: _WikiDiffOp  - X-Ref

reverse()   X-Ref
No description

norig()   X-Ref
No description

nclosing()   X-Ref
No description

Class: _WikiDiffOp_Copy  - X-Ref

__construct($orig, $closing = false)   X-Ref
No description

reverse()   X-Ref
No description

Class: _WikiDiffOp_Delete  - X-Ref

__construct($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: _WikiDiffOp_Add  - X-Ref

__construct($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: _WikiDiffOp_Change  - X-Ref

__construct($orig, $closing)   X-Ref
No description

reverse()   X-Ref
No description

Class: _WikiDiffEngine  - X-Ref

Class used internally by Diff to actually compute the diffs.

The algorithm used here is mostly lifted from the perl module
Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip

More ideas are taken from:
http://www.ics.uci.edu/~eppstein/161/960229.html

Some ideas are (and a bit of code) are from from analyze.c, from GNU
diffutils-2.7, which can be found at:
ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz

closingly, some ideas (subdivision by NCHUNKS > 2, and some optimizations)
are my own.

diff($from_lines, $to_lines)   X-Ref
No description

_diag($xoff, $xlim, $yoff, $ylim, $nchunks)   X-Ref
No description

_lcs_pos($ypos)   X-Ref
No description

_compareseq($xoff, $xlim, $yoff, $ylim)   X-Ref
No description

_shift_boundaries($lines, &$changed, $other_changed)   X-Ref
No description

Class: WikiDiff  - X-Ref

Class representing a 'diff' between two sequences of strings.

__construct($from_lines, $to_lines)   X-Ref
Constructor.
Computes diff between sequences of strings.

param: $from_lines array An array of strings.
param: $to_lines array An array of strings.

WikiDiff($from_lines, $to_lines)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

reverse()   X-Ref
Compute reversed WikiDiff.

SYNOPSIS:

$diff = new WikiDiff($lines1, $lines2);
$rev = $diff->reverse();
return: object A WikiDiff object representing the inverse of the

isEmpty()   X-Ref
Check for empty diff.

return: bool True iff two sequences were identical.

lcs()   X-Ref
Compute the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposed.

return: int The length of the LCS.

orig()   X-Ref
Get the original set of lines.

This reconstructs the $from_lines parameter passed to the
constructor.

return: array The original sequence of strings.

closing()   X-Ref
Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the
constructor.

return: array The sequence of strings.

_check($from_lines, $to_lines)   X-Ref
Check a WikiDiff for validity.

This is here only for debugging purposes.

Class: MappedWikiDiff  - X-Ref

FIXME: bad name.

__construct($from_lines, $to_lines,$mapped_from_lines, $mapped_to_lines)   X-Ref
Constructor.

Computes diff between sequences of strings.

This can be used to compute things like
case-insensitve diffs, or diffs which ignore
changes in white-space.

param: $from_lines array An array of strings.
param: $to_lines array An array of strings.
param: $mapped_from_lines array This array should
param: $mapped_to_lines array This array should

Class: WikiDiffFormatter  - X-Ref

A class to format WikiDiffs

This class formats the diff in classic diff format.
It is intended that this class be customized via inheritance,
to obtain fancier outputs.
format($diff)   X-Ref
Format a diff.

param: $diff object A WikiDiff object.
return: string The formatted output.

_block($xbeg, $xlen, $ybeg, $ylen, &$edits)   X-Ref
No description

_start_diff()   X-Ref
No description

_end_diff()   X-Ref
No description

_block_header($xbeg, $xlen, $ybeg, $ylen)   X-Ref
No description

_start_block($header)   X-Ref
No description

_end_block()   X-Ref
No description

_lines($lines, $prefix = ' ')   X-Ref
No description

_context($lines)   X-Ref
No description

_added($lines)   X-Ref
No description

_deleted($lines)   X-Ref
No description

_changed($orig, $closing)   X-Ref
No description

Class: _WikiHWLDF_WordAccumulator  - X-Ref

__construct()   X-Ref
No description

_flushGroup($new_tag)   X-Ref
No description

_flushLine($new_tag)   X-Ref
No description

addWords($words, $tag = '')   X-Ref
No description

getLines()   X-Ref
No description

Class: WordLevelWikiDiff  - X-Ref

__construct($orig_lines, $closing_lines)   X-Ref
No description

_split($lines)   X-Ref
No description

orig()   X-Ref
No description

closing()   X-Ref
No description

Class: TableWikiDiffFormatter  - X-Ref


__construct()   X-Ref
No description

_block_header( $xbeg, $xlen, $ybeg, $ylen)   X-Ref
No description

_start_block($header)   X-Ref
No description

_end_block()   X-Ref
No description

_lines($lines, $prefix=' ', $color="white")   X-Ref
No description

_added($lines)   X-Ref
No description

_deleted($lines)   X-Ref
No description

_context($lines)   X-Ref
No description

_changed( $orig, $closing )   X-Ref
No description

get_result()   X-Ref
No description

Class: TableWikiDiffFormatterOld  - X-Ref

Wikipedia Table style diff formatter.

TableWikiDiffFormatter()   X-Ref
No description

_block_header( $xbeg, $xlen, $ybeg, $ylen )   X-Ref
No description

_start_block( $header )   X-Ref
No description

_end_block()   X-Ref
No description

_lines( $lines, $prefix=' ', $color="white" )   X-Ref
No description

addedLine( $line )   X-Ref
No description

deletedLine( $line )   X-Ref
No description

emptyLine()   X-Ref
No description

contextLine( $line )   X-Ref
No description

_added($lines)   X-Ref
No description

_deleted($lines)   X-Ref
No description

_context( $lines )   X-Ref
No description

_changed( $orig, $closing )   X-Ref
No description