mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
update diff engine to Text_Diff 1.1.0
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9251 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0b313ad333
commit
507d8b0385
3 changed files with 45 additions and 3 deletions
|
@ -17,7 +17,7 @@ if (!defined('IN_PHPBB'))
|
|||
}
|
||||
|
||||
/**
|
||||
* Code from pear.php.net, Text_Diff-1.0.0 package
|
||||
* Code from pear.php.net, Text_Diff-1.1.0 package
|
||||
* http://pear.php.net/package/Text_Diff/
|
||||
*
|
||||
* Modified by phpBB Group to meet our coding standards
|
||||
|
@ -60,6 +60,48 @@ class diff
|
|||
return $this->_edits;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the number of new (added) lines in a given diff.
|
||||
*
|
||||
* @since Text_Diff 1.1.0
|
||||
*
|
||||
* @return integer The number of new lines
|
||||
*/
|
||||
function count_added_lines()
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->_edits as $edit)
|
||||
{
|
||||
if (is_a($edit, 'diff_op_add') || is_a($edit, 'diff_op_change'))
|
||||
{
|
||||
$count += $edit->nfinal();
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of deleted (removed) lines in a given diff.
|
||||
*
|
||||
* @since Text_Diff 1.1.0
|
||||
*
|
||||
* @return integer The number of deleted lines
|
||||
*/
|
||||
function count_deleted_lines()
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->_edits as $edit)
|
||||
{
|
||||
if (is_a($edit, 'diff_op_delete') || is_a($edit, 'diff_op_change'))
|
||||
{
|
||||
$count += $edit->norig();
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a reversed diff.
|
||||
*
|
||||
|
|
|
@ -17,7 +17,7 @@ if (!defined('IN_PHPBB'))
|
|||
}
|
||||
|
||||
/**
|
||||
* Code from pear.php.net, Text_Diff-1.0.0 package
|
||||
* Code from pear.php.net, Text_Diff-1.1.0 package
|
||||
* http://pear.php.net/package/Text_Diff/ (native engine)
|
||||
*
|
||||
* Modified by phpBB Group to meet our coding standards
|
||||
|
|
|
@ -17,7 +17,7 @@ if (!defined('IN_PHPBB'))
|
|||
}
|
||||
|
||||
/**
|
||||
* Code from pear.php.net, Text_Diff-1.0.0 package
|
||||
* Code from pear.php.net, Text_Diff-1.1.0 package
|
||||
* http://pear.php.net/package/Text_Diff/
|
||||
*
|
||||
* Modified by phpBB Group to meet our coding standards
|
||||
|
|
Loading…
Add table
Reference in a new issue