[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Text/ -> Diff.php (summary)

(no description)

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

Defines 6 classes

Text_Diff:: (13 methods):
  __construct()
  Text_Diff()
  getDiff()
  countAddedLines()
  countDeletedLines()
  reverse()
  isEmpty()
  lcs()
  getOriginal()
  getFinal()
  trimNewlines()
  _getTempDir()
  _check()

Text_MappedDiff:: (4 methods):
  __construct()
  Text_MappedDiff()
  norig()
  nfinal()

Text_Diff_Op_copy:: (3 methods):
  __construct()
  Text_Diff_Op_copy()
  reverse()

Text_Diff_Op_delete:: (3 methods):
  __construct()
  Text_Diff_Op_delete()
  reverse()

Text_Diff_Op_add:: (3 methods):
  __construct()
  Text_Diff_Op_add()
  reverse()

Text_Diff_Op_change:: (3 methods):
  __construct()
  Text_Diff_Op_change()
  reverse()


Class: Text_Diff  - X-Ref

General API for generating and formatting diffs - the differences between
two sequences of strings.

The original PHP version of this code was written by Geoffrey T. Dairiki
<dairiki@dairiki.org>, and is used/adapted with his permission.

Copyright 2004 Geoffrey T. Dairiki <dairiki@dairiki.org>
Copyright 2004-2010 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did
not receive this file, see https://opensource.org/license/lgpl-2-1/.

__construct( $engine, $params )   X-Ref
Computes diffs between sequences of strings.

param: string $engine     Name of the diffing engine to use.  'auto'
param: array $params      Parameters to pass to the diffing engine.

Text_Diff( $engine, $params )   X-Ref
PHP4 constructor.


getDiff()   X-Ref
Returns the array of differences.


countAddedLines()   X-Ref
returns the number of new (added) lines in a given diff.

return: int The number of new lines

countDeletedLines()   X-Ref
Returns the number of deleted (removed) lines in a given diff.

return: int The number of deleted lines

reverse()   X-Ref
Computes a reversed diff.

Example:
<code>
$diff = new Text_Diff($lines1, $lines2);
$rev = $diff->reverse();
</code>

return: Text_Diff  A Diff object representing the inverse of the

isEmpty()   X-Ref
Checks for an empty diff.

return: bool True if two sequences were identical.

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

This is mostly for diagnostic purposes.

return: int The length of the LCS.

getOriginal()   X-Ref
Gets the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

return: array  The original sequence of strings.

getFinal()   X-Ref
Gets the final set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

return: array  The sequence of strings.

trimNewlines(&$line, $key)   X-Ref
Removes trailing newlines from a line of text. This is meant to be used
with array_walk().

param: string $line  The line to trim.
param: int    $key   The index of the line in the array. Not used.

_getTempDir()   X-Ref
Determines the location of the system temporary directory.

return: string  A directory name which can be used for temp files.

_check($from_lines, $to_lines)   X-Ref
Checks a diff for validity.

This is here only for debugging purposes.

Class: Text_MappedDiff  - X-Ref


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

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

param: array $from_lines         An array of strings.
param: array $to_lines           An array of strings.
param: array $mapped_from_lines  This array should have the same size
param: array $mapped_to_lines    This array should have the same number

Text_MappedDiff( $from_lines, $to_lines,$mapped_from_lines, $mapped_to_lines )   X-Ref
PHP4 constructor.


norig()   X-Ref

author: Geoffrey T. Dairiki <dairiki@dairiki.org>

nfinal()   X-Ref
No description

Class: Text_Diff_Op_copy  - X-Ref


__construct( $orig, $final = false )   X-Ref
PHP5 constructor.


Text_Diff_Op_copy( $orig, $final = false )   X-Ref
PHP4 constructor.


reverse()   X-Ref
No description

Class: Text_Diff_Op_delete  - X-Ref


__construct( $lines )   X-Ref
PHP5 constructor.


Text_Diff_Op_delete( $lines )   X-Ref
PHP4 constructor.


reverse()   X-Ref
No description

Class: Text_Diff_Op_add  - X-Ref


__construct( $lines )   X-Ref
PHP5 constructor.


Text_Diff_Op_add( $lines )   X-Ref
PHP4 constructor.


reverse()   X-Ref
No description

Class: Text_Diff_Op_change  - X-Ref


__construct( $orig, $final )   X-Ref
PHP5 constructor.


Text_Diff_Op_change( $orig, $final )   X-Ref
PHP4 constructor.


reverse()   X-Ref
No description



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref