Theme engine as a component

See #78 .

Finally managed to bring this branch up to date with latest changes.

This is a huge pull request.

A lot of re-organizing has been done. Functions have been moved from original files into a single folder for the old theme engine.

All the changes made in 3.8.10 and 3.8.11 has been included in the new location of the modified functions.

As this is a giant pull request, it could be easier to test if you run this pull request branch on your local server rather than the official master branch. That way any bugs can be caught easily.

This pull request should be merged as soon as possible to prevent diverging changes made on the official master branch. However care should be taken as it needs further testing.