CRM-11966 : CiviCRM gives whitescreen on all pages if HTML_PURIFIER module is enabled

CRM-11966 : rework on patch provided in here :- https://github.com/civicrm/civicrm-core/pull/2652

There were quit a few changes after #2652 PR was submitted and hence it got stale. 
Reworked on this patch and sending this PR.