PSR-2 and more NS

I have started converting the source code over to PSR-2, I believe the
formatting is correct now although I may have missed some places. Work
still needs to be done on the visibility of methods and properties.

More classes have now been namespaces, most are done now but there are
still some stragglers. I will need to move some of the functions over so
that they are in classes (like filters and actions) so those can be
loaded automatically as well.

I have had a look at the code for testing, it is not something I have
looked a great deal into before so I will need to work on that when I
have time. I was hoping it would be quick to fix but there is a little
more to it than I first thought.