Using strpos and strtr instead of stristr and str_replace

see: https://github.com/joomla/joomla-platform/issues/673#issuecomment-27667678