BaseHtmlPurifier config can now be a closure

`$config` can now be a closure that will have the `$configInstance` passed as the first param.

updated docs.

close #4656