removing static saving of recent post, and added in dynamic pulling on Topics.get

This commit is contained in:
Julian Lam
2013-05-17 12:25:06 -04:00
parent 12ff6bf1e1
commit 4b6ad9607e
5 changed files with 72 additions and 26 deletions

View File

@@ -47,8 +47,18 @@ var utils = {
.replace(/-+/g, '-'); // collapse dashes
return str;
}
},
// Willingly stolen from: http://phpjs.org/functions/strip_tags/
'strip_tags': function(input, allowed) {
allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
});
}
}
module.exports = utils;