Updated for PHP 5.5 and site changes