fix php errors and replace deprecated ereg_replace

See Wordpress forum:
http://wordpress.org/support/topic/errors-fix?replies=1
http://wordpress.org/support/topic/ereg_replace-deprecated?replies=2