Use preg_replace_callback instead of /e in preg_replace to fix E_DEPRECATED warnings