Issue #77: Replace the class registry with a more robust alternative.

This PR provides a more robust alternative to the current class registry. Rather than parsing files with regex and then storing the result in a database table, this simply has modules define all their classes via a hook. This alternative prevents the possibility of a corrupted registry, since it is never stored anywhere. It also eliminates database queries when retrieving and updating the registry, though this approach does not have a measurable impact one way or the other on performance.

This also includes a fair amount of code re-arranging, as classes should not be combined with procedural code, otherwise the registry may get triggered upon including these files.