/siU";
$replace = "";
$stage1 = preg_replace($pattern, $replace, $fileContent);
// php function stripos only exists in cvs for the moment,
// so we have to 'normalize' all div tags --> all upper- or all lowercase
// let's make them all lowercase ...
$stage2a = str_replace("
0 ) // loop as long as there are still
in $out
$out .= substr($tmp, 0, $cdiv) . "";
}
else if ( $owepcnt > 1 ) // div group within a WEP region
{
$owepcnt--;
$odivcnt--;
// lookup first occurrence of > in $tmp starting at offset $cdiv
$newpos = strpos($tmp, ">", $cdiv) + 1;
$out .= substr($tmp, 0, $newpos);
}
}
else if (( $odiv < $cdiv ) AND ( $odiv < $owep )) // open DIV
{
$odivcnt++;
// lookup first occurrence of > in $tmp starting at offset $odiv
$newpos = strpos($tmp, ">", $odiv) + 1;
$out .= substr($tmp, 0, $newpos);
if ( $owepcnt > 0 ) // div group within a WEP region
{
$owepcnt++;
}
}
else if (( $owep < $odiv ) AND ( $owep < $cdiv )) // open WEP
{
// WEP regions cannot be nested, so putting the count at 1 is safe
$owepcnt = 1;
$odivcnt++;
// lookup first occurrence of --> in $tmp starting at offset $owep
$newpos = strpos($tmp, "-->", $owep) + 3;
$out .= substr($tmp, 0, $newpos);
}
// make new $tmp
$tmp = substr ($tmp, $newpos);
} // loop
// ok, no more div tags to convert --> remainder of $tmp
$out .= $tmp;
// result
$fileContent = $out;
?>