Skip to content

Commit

Permalink
Partialy revert 7cbbe6b
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme MACIAS authored and j0k3r committed May 3, 2013
1 parent 8f2c396 commit 967b668
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/config/sfCompileConfigHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,32 @@ public function execute($configFiles)
throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
}

if (sfConfig::get('sf_debug'))
{
$contents = file_get_contents($file);
$contents = file_get_contents($file);

// replace windows and mac format with unix format
$contents = str_replace("\r", PHP_EOL, $contents);
}
else
// strip comments (not in debug mode)
if (!sfConfig::get('sf_debug'))
{
// strip whitespaces and comments
$contents = php_strip_whitespace($file);
$contents = sfToolkit::stripComments($contents);
}

// strip php tags
$contents = sfToolkit::pregtr($contents, array('/^\s*<\?(php\s*)?/m' => '', '/^\s*\?>/m' => ''));

// replace windows and mac format with unix format
$contents = str_replace("\r", "\n", $contents);

// replace multiple new lines with a single newline
$contents = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $contents);

// append file data
$data .= PHP_EOL.$contents;
$data .= "\n".$contents;
}

// compile data
return sprintf('<?php'.PHP_EOL.
'// auto-generated by sfCompileConfigHandler'.PHP_EOL.
'// date: %s'.PHP_EOL.
'%s'.PHP_EOL,
return sprintf("<?php\n".
"// auto-generated by sfCompileConfigHandler\n".
"// date: %s\n".
"%s\n",
date('Y/m/d H:i:s'), $data);
}

Expand Down

0 comments on commit 967b668

Please sign in to comment.