Updated code compatible with CiviCRM 4.5.0+

Updated code compatible with CiviCRM 4.5.0+ Tested with WordPress 4.0.1
and CiviCRM 4.5.4