fix deleting a share removed all plugin settings

Fix the mentioned thing, also do a code rewrite to psr2 and
remove unused code.
update changelog