Standards and foreach avoiding

Rewriting of the setReferer method to avoid foreach and comply with cake
standards