function xReplaceStringInFiles($rootDirectory, $replacementPairs) { if (!is_dir($rootDirectory)) { return 0; } else { $handle = @dir($rootDirectory); while (@($entry = $handle->read()) !== false) { if ($entry != "." && $entry != ".." && $entry != "cvs" && $entry != "CVS") { if (is_dir("{$source}/{$entry}") && $dest !== $source . FILE_SEPARATOR . $entry) { fileSystemUtils::xReplaceStringInFiles($source . FILE_SEPARATOR . $entry, $replacementPairs); } else { stringUtils::replaceStringInFileAndSaveFile($rootDirectory . FILE_SEPARATOR . $entry, $replacementPairs); } } } $handle->close(); return 1; } }
function replaceApplicationRootForSimpleGen($rootDirectory, $rootURL) { $commonPath = $rootDirectory . FILE_SEPARATOR . "common"; $filesToChange = ""; $filesToChange[] = $commonPath . FILE_SEPARATOR . "footer.php"; $filesToChange[] = $commonPath . FILE_SEPARATOR . "header.php"; $replacementPairs = ""; $replacementPairs[] = new pair("{APPLICATION_ROOT}", $rootURL); for ($a = 0; $a < count($filesToChange); $a++) { stringUtils::replaceStringInFileAndSaveFile($filesToChange[$a], $replacementPairs); } }