Add cache support, optimisations and cleanup

- Add an event dispatch call when loading a collection of posts.
- Add defaults for post and category priorities in sitemap config.
- Add hard-coded margin to hr tags in blog posts.
- Add composer.json file.
- Change pagination so the count is done by the database.
- Move several functions into a separate block to avoid cache issues.
- Fix to use current store filter when determining pagination.
- Fix mass actions on posts.
- Fix for image uploading when creating and editing posts. Fixes #1.