[1.7.x] Refactored and commented strip_tags utility

Backport of c28beb4291 from master.