Control those newlines. Props to that Andy guy. fixes #1082

git-svn-id: http://svn.automattic.com/wordpress/trunk@3688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-04-04 00:51:47 +00:00
parent c5fe14aa72
commit 041257657c

View File

@ -1077,11 +1077,15 @@ function insert_with_markers($filename, $marker, $insertion) {
$foundit = false; $foundit = false;
if ($markerdata) { if ($markerdata) {
$state = true; $state = true;
foreach ($markerdata as $markerline) { foreach ($markerdata as $n => $markerline) {
if (strstr($markerline, "# BEGIN {$marker}")) if (strstr($markerline, "# BEGIN {$marker}"))
$state = false; $state = false;
if ($state) if ($state) {
fwrite($f, "{$markerline}\n"); if ( $n + 1 < count($markerdata) )
fwrite($f, "{$markerline}\n");
else
fwrite($f, "{$markerline}");
}
if (strstr($markerline, "# END {$marker}")) { if (strstr($markerline, "# END {$marker}")) {
fwrite($f, "# BEGIN {$marker}\n"); fwrite($f, "# BEGIN {$marker}\n");
if (is_array($insertion)) if (is_array($insertion))