Replaced 3 unneeded preg_() calls with the more efficient strpos() and substr_replace()