The original code was taken from Joomla 2.5.