upd: replace preg_replace with /e modifier by preg_replace_callback