Encode html entities in log

This commit is contained in:
Ruud
2012-06-30 19:58:53 +02:00
parent 0fc5c42aba
commit 3b441d2942
+10 -9
View File
@@ -78,15 +78,16 @@ Page.Log = new Class({
addColors: function(text){
var self = this;
var text = new Element('div', {
'html': text
}).get('text')
text = text.replace(/\u001b\[31m/gi, '</span><span class="error">')
text = text.replace(/\u001b\[36m/gi, '</span><span class="debug">')
text = text.replace(/\u001b\[33m/gi, '</span><span class="debug">')
text = text.replace(/\u001b\[0m\n/gi, '</span><span class="time">')
text = text.replace(/\u001b\[0m/gi, '</span><span>')
text = text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/\u001b\[31m/gi, '</span><span class="error">')
.replace(/\u001b\[36m/gi, '</span><span class="debug">')
.replace(/\u001b\[33m/gi, '</span><span class="debug">')
.replace(/\u001b\[0m\n/gi, '</span><span class="time">')
.replace(/\u001b\[0m/gi, '</span><span>')
return '<span class="time">' + text + '</span>';
}