sanitizeNames: return list rather than print

This makes it easier to use the results of the sanitizeRecursively
function, without losing the ability to run as a separate script.

refs #7168
sanitizeObjectNames: import sanitizeNames rather than running in shell

refs #7168