added PHP 5.4 compatibility for traits (use trait_exists when function exists)