[ Index ]

WordPress Cross Reference

title

Body

[close]

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

(no description)

File Size: 450 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 7 classes

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

Text_MappedDiff:: (1 method):
  Text_MappedDiff()

Text_Diff_Op:: (3 methods):
  reverse()
  norig()
  nfinal()

Text_Diff_Op_copy:: (2 methods):
  Text_Diff_Op_copy()
  reverse()

Text_Diff_Op_delete:: (2 methods):
  Text_Diff_Op_delete()
  reverse()

Text_Diff_Op_add:: (2 methods):
  Text_Diff_Op_add()
  reverse()

Text_Diff_Op_change:: (2 methods):
  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 http://opensource.org/licenses/lgpl-license.php.

Text_Diff($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.

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


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

return: integer The number of new lines

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

return: integer 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: boolean  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: integer  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: integer $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


Text_MappedDiff($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-insensitve 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

Class: Text_Diff_Op  - X-Ref


reverse()   X-Ref
No description

norig()   X-Ref
No description

nfinal()   X-Ref
No description

Class: Text_Diff_Op_copy  - X-Ref


Text_Diff_Op_copy($orig, $final = false)   X-Ref
No description

reverse()   X-Ref
No description

Class: Text_Diff_Op_delete  - X-Ref


Text_Diff_Op_delete($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: Text_Diff_Op_add  - X-Ref


Text_Diff_Op_add($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: Text_Diff_Op_change  - X-Ref


Text_Diff_Op_change($orig, $final)   X-Ref
No description

reverse()   X-Ref
No description



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu