Removing constants IS_PHP_* removing PHP < 5.2 support see #7113

Formatting code, fixing typos, removing custom replaces to
string functions.