mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
elofgren: VAR FIXES: Add some needed issets() and variable initializations to fix a lot of warnings when comparing 2 versions of a page.
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41844 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9b29b09a24
commit
d497fbf671
@ -667,14 +667,14 @@ class Diff
|
||||
if($chunks) {
|
||||
foreach($chunks as $item) {
|
||||
// $tagStack > 0 indicates that we should be tag-building
|
||||
if($tagStack[$listName]) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item;
|
||||
if(isset($tagStack[$listName])) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item;
|
||||
else $rechunked[$listName][] = $item;
|
||||
|
||||
if($lookForTag && $item[0] == "<" && substr($item,0,2) != "</") {
|
||||
if($lookForTag && isset($item[0]) && $item[0] == "<" && substr($item,0,2) != "</") {
|
||||
$tagStack[$listName] = 1;
|
||||
} else if($tagStack[$listName]) {
|
||||
} else if(isset($tagStack[$listName])) {
|
||||
if(substr($item,0,2) == "</") $tagStack[$listName]--;
|
||||
else if($item[0] == "<") $tagStack[$listName]++;
|
||||
else if(isset($item[0]) && $item[0] == "<") $tagStack[$listName]++;
|
||||
}
|
||||
|
||||
// echo "<li>" . htmlentities($item) . " -> " .$tagStack[$listName];
|
||||
@ -686,6 +686,7 @@ class Diff
|
||||
|
||||
// Diff the re-chunked data, turning it into maked up HTML
|
||||
$diff = new Diff($rechunked[1], $rechunked[2]);
|
||||
$content = '';
|
||||
foreach($diff->edits as $edit) {
|
||||
// echo "<li>$edit->type: " . htmlentities(implode(" " ,$edit->orig));
|
||||
// if($edit->final) echo ' / ' . htmlentities(implode(" " ,$edit->final));
|
||||
@ -716,7 +717,7 @@ class Diff
|
||||
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
||||
$candidateChunks = split("[\t\r\n ]+", $content);
|
||||
while(list($i,$item) = each($candidateChunks)) {
|
||||
if($item[0] == "<") {
|
||||
if(isset($item[0]) && $item[0] == "<") {
|
||||
$newChunk = $item;
|
||||
while($item[strlen($item)-1] != ">") {
|
||||
list($i,$item) = each($candidateChunks);
|
||||
|
Loading…
Reference in New Issue
Block a user