mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 23:25:50 +01:00
583ac68a44
Fixes #15124. git-svn-id: http://svn.automattic.com/wordpress/trunk@16282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
23 lines
471 B
JavaScript
23 lines
471 B
JavaScript
//Used to ensure that Entities used in L10N strings are correct
|
|
function convertEntities(o) {
|
|
var c, v;
|
|
c = function(s) {
|
|
if (/&[^;]+;/.test(s)) {
|
|
var e = document.createElement("div");
|
|
e.innerHTML = s;
|
|
return !e.firstChild ? s : e.firstChild.nodeValue;
|
|
}
|
|
return s;
|
|
}
|
|
|
|
if ( typeof o === 'string' ) {
|
|
return c(o);
|
|
} else if ( typeof o === 'object' ) {
|
|
for (v in o) {
|
|
if ( typeof o[v] === 'string' ) {
|
|
o[v] = c(o[v]);
|
|
}
|
|
}
|
|
}
|
|
return o;
|
|
} |