Functions

cms/diff.lib.php File Reference

Go to the source code of this file.

Functions

if(!defined('__PRAGYAN_CMS')) diff ($original, $updated)
 patch ($original, $patch)

Function Documentation

if (!defined('__PRAGYAN_CMS')) diff ( original,
updated 
)

Diff and patch functions created using the documentation from the Wikipedia article at http://en.wikipedia.org/wiki/Longest_common_subsequence_problem

Copyright (c) 2007, Joshua Thompson <http://www.schmalls.com> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Joshua Thompson nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2007 Joshua Thompson <http://www.schmalls.com> http://www.opensource.org/licenses/bsd-license.php BSD License

Author:
Joshua Thompson <spam.goes.in.here@gmail.com>
Version:
1.0.0 Finds the Least Common Subsequence of the two inputs, then uses it to generate the diff, and returns the diff as a string. string $original string $updated array

Returns the diff as a string.

Parameters:
array $c the LCS
array $x the original
array $y the updated
int $i
int $j
string $last
boolean $change
int $end_i
int $end_j
int $add_i
int $add_j
Returns:
string

Definition at line 61 of file diff.lib.php.

patch ( original,
patch 
)

Applies the patch to the original document and returns the patched document.

Parameters:
string $original
string $patch
Returns:
string

Definition at line 157 of file diff.lib.php.