Enhancement: Refactor common.php to be a class

ref. to https://github.com/Codiad/Codiad/issues/292

Currenlty i don't find anything in my tests, but it needs some deeper tests by someone else. thats why i have opened a pullreq.

Notes: To keep the changes very small, I still have included the "old" method names, so mainly only common.php is changed.