Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib/Diff/Renderer/Html
File: SideBySide.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Side by Side HTML diff generator for PHP DiffLib.
[2] Fix | Delete
*
[3] Fix | Delete
* PHP version 5
[4] Fix | Delete
*
[5] Fix | Delete
* Copyright (c) 2009 Chris Boulton <chris.boulton@interspire.com>
[6] Fix | Delete
*
[7] Fix | Delete
* All rights reserved.
[8] Fix | Delete
*
[9] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[10] Fix | Delete
* modification, are permitted provided that the following conditions are met:
[11] Fix | Delete
*
[12] Fix | Delete
* - Redistributions of source code must retain the above copyright notice,
[13] Fix | Delete
* this list of conditions and the following disclaimer.
[14] Fix | Delete
* - Redistributions in binary form must reproduce the above copyright notice,
[15] Fix | Delete
* this list of conditions and the following disclaimer in the documentation
[16] Fix | Delete
* and/or other materials provided with the distribution.
[17] Fix | Delete
* - Neither the name of the Chris Boulton nor the names of its contributors
[18] Fix | Delete
* may be used to endorse or promote products derived from this software
[19] Fix | Delete
* without specific prior written permission.
[20] Fix | Delete
*
[21] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
[22] Fix | Delete
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
[23] Fix | Delete
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
[24] Fix | Delete
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
[25] Fix | Delete
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
[26] Fix | Delete
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
[27] Fix | Delete
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
[28] Fix | Delete
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
[29] Fix | Delete
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
[30] Fix | Delete
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
[31] Fix | Delete
* POSSIBILITY OF SUCH DAMAGE.
[32] Fix | Delete
*
[33] Fix | Delete
* @package DiffLib
[34] Fix | Delete
* @author Chris Boulton <chris.boulton@interspire.com>
[35] Fix | Delete
* @copyright (c) 2009 Chris Boulton
[36] Fix | Delete
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
[37] Fix | Delete
* @version 1.1
[38] Fix | Delete
* @link http://github.com/chrisboulton/php-diff
[39] Fix | Delete
*/
[40] Fix | Delete
[41] Fix | Delete
require_once(dirname(__FILE__) . '/Array.php');
[42] Fix | Delete
[43] Fix | Delete
class Diff_Renderer_Html_SideBySide extends Diff_Renderer_Html_Array
[44] Fix | Delete
{
[45] Fix | Delete
/**
[46] Fix | Delete
* Render a and return diff with changes between the two sequences
[47] Fix | Delete
* displayed side by side.
[48] Fix | Delete
*
[49] Fix | Delete
* @return string The generated side by side diff.
[50] Fix | Delete
*/
[51] Fix | Delete
public function render()
[52] Fix | Delete
{
[53] Fix | Delete
$changes = parent::render();
[54] Fix | Delete
[55] Fix | Delete
$html = '';
[56] Fix | Delete
if(empty($changes)) {
[57] Fix | Delete
return $html;
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
$html .= '<table class="Differences DifferencesSideBySide">';
[61] Fix | Delete
$html .= '<thead>';
[62] Fix | Delete
$html .= '<tr>';
[63] Fix | Delete
$html .= '<th colspan="2" width="50%">The Original Version of the file</th>';
[64] Fix | Delete
$html .= '<th colspan="2" width="50%">The Modified Version on your WordPress system</th>';
[65] Fix | Delete
$html .= '</tr>';
[66] Fix | Delete
$html .= '</thead>';
[67] Fix | Delete
foreach($changes as $i => $blocks) {
[68] Fix | Delete
if($i > 0) {
[69] Fix | Delete
$html .= '<tbody class="Skipped">';
[70] Fix | Delete
$html .= '<th>&hellip;</th><td>&nbsp;</td>';
[71] Fix | Delete
$html .= '<th>&hellip;</th><td>&nbsp;</td>';
[72] Fix | Delete
$html .= '</tbody>';
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
foreach($blocks as $change) {
[76] Fix | Delete
$html .= '<tbody class="Change'.ucfirst($change['tag']).'">';
[77] Fix | Delete
// Equal changes should be shown on both sides of the diff
[78] Fix | Delete
if($change['tag'] == 'equal') {
[79] Fix | Delete
foreach($change['base']['lines'] as $no => $line) {
[80] Fix | Delete
$fromLine = $change['base']['offset'] + $no + 1;
[81] Fix | Delete
$toLine = $change['changed']['offset'] + $no + 1;
[82] Fix | Delete
$html .= '<tr>';
[83] Fix | Delete
$html .= '<th>'.$fromLine.'</th>';
[84] Fix | Delete
$html .= '<td class="Left"><span>'.$line.'</span>&nbsp;</span></td>';
[85] Fix | Delete
$html .= '<th>'.$toLine.'</th>';
[86] Fix | Delete
$html .= '<td class="Right"><span>'.$line.'</span>&nbsp;</span></td>';
[87] Fix | Delete
$html .= '</tr>';
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
// Added lines only on the right side
[91] Fix | Delete
else if($change['tag'] == 'insert') {
[92] Fix | Delete
foreach($change['changed']['lines'] as $no => $line) {
[93] Fix | Delete
$toLine = $change['changed']['offset'] + $no + 1;
[94] Fix | Delete
$html .= '<tr>';
[95] Fix | Delete
$html .= '<th>&nbsp;</th>';
[96] Fix | Delete
$html .= '<td class="Left">&nbsp;</td>';
[97] Fix | Delete
$html .= '<th>'.$toLine.'</th>';
[98] Fix | Delete
$html .= '<td class="Right"><ins>'.$line.'</ins>&nbsp;</td>';
[99] Fix | Delete
$html .= '</tr>';
[100] Fix | Delete
}
[101] Fix | Delete
}
[102] Fix | Delete
// Show deleted lines only on the left side
[103] Fix | Delete
else if($change['tag'] == 'delete') {
[104] Fix | Delete
foreach($change['base']['lines'] as $no => $line) {
[105] Fix | Delete
$fromLine = $change['base']['offset'] + $no + 1;
[106] Fix | Delete
$html .= '<tr>';
[107] Fix | Delete
$html .= '<th>'.$fromLine.'</th>';
[108] Fix | Delete
$html .= '<td class="Left"><del>'.$line.'</del>&nbsp;</td>';
[109] Fix | Delete
$html .= '<th>&nbsp;</th>';
[110] Fix | Delete
$html .= '<td class="Right">&nbsp;</td>';
[111] Fix | Delete
$html .= '</tr>';
[112] Fix | Delete
}
[113] Fix | Delete
}
[114] Fix | Delete
// Show modified lines on both sides
[115] Fix | Delete
else if($change['tag'] == 'replace') {
[116] Fix | Delete
if(count($change['base']['lines']) >= count($change['changed']['lines'])) {
[117] Fix | Delete
foreach($change['base']['lines'] as $no => $line) {
[118] Fix | Delete
$fromLine = $change['base']['offset'] + $no + 1;
[119] Fix | Delete
$html .= '<tr>';
[120] Fix | Delete
$html .= '<th>'.$fromLine.'</th>';
[121] Fix | Delete
$html .= '<td class="Left"><span>'.$line.'</span>&nbsp;</td>';
[122] Fix | Delete
if(!isset($change['changed']['lines'][$no])) {
[123] Fix | Delete
$toLine = '&nbsp;';
[124] Fix | Delete
$changedLine = '&nbsp;';
[125] Fix | Delete
}
[126] Fix | Delete
else {
[127] Fix | Delete
$toLine = $change['base']['offset'] + $no + 1;
[128] Fix | Delete
$changedLine = '<span>'.$change['changed']['lines'][$no].'</span>';
[129] Fix | Delete
}
[130] Fix | Delete
$html .= '<th>'.$toLine.'</th>';
[131] Fix | Delete
$html .= '<td class="Right">'.$changedLine.'</td>';
[132] Fix | Delete
$html .= '</tr>';
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
else {
[136] Fix | Delete
foreach($change['changed']['lines'] as $no => $changedLine) {
[137] Fix | Delete
if(!isset($change['base']['lines'][$no])) {
[138] Fix | Delete
$fromLine = '&nbsp;';
[139] Fix | Delete
$line = '&nbsp;';
[140] Fix | Delete
}
[141] Fix | Delete
else {
[142] Fix | Delete
$fromLine = $change['base']['offset'] + $no + 1;
[143] Fix | Delete
$line = '<span>'.$change['base']['lines'][$no].'</span>';
[144] Fix | Delete
}
[145] Fix | Delete
$html .= '<tr>';
[146] Fix | Delete
$html .= '<th>'.$fromLine.'</th>';
[147] Fix | Delete
$html .= '<td class="Left"><span>'.$line.'</span>&nbsp;</td>';
[148] Fix | Delete
$toLine = $change['changed']['offset'] + $no + 1;
[149] Fix | Delete
$html .= '<th>'.$toLine.'</th>';
[150] Fix | Delete
$html .= '<td class="Right">'.$changedLine.'</td>';
[151] Fix | Delete
$html .= '</tr>';
[152] Fix | Delete
}
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
$html .= '</tbody>';
[156] Fix | Delete
}
[157] Fix | Delete
}
[158] Fix | Delete
$html .= '</table>';
[159] Fix | Delete
return $html;
[160] Fix | Delete
}
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function