Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderText(elem, opts) {
var data = elem.data || '';
// if entities weren't decoded, no need to encode them back
if (
opts.decodeEntities &&
!(elem.parent && elem.parent.name in unencodedElements)
) {
data = entities.encodeXML(data);
}
return data;
}
for (var key in attributes) {
value = attributes[key];
if (output) {
output += ' ';
}
if (opts.xmlMode === 'foreign') {
/* fix up mixed-case attribute names */
key = foreignNames.attributeNames[key] || key;
}
output += key;
if ((value !== null && value !== '') || opts.xmlMode) {
output +=
'="' +
(opts.decodeEntities
? entities.encodeXML(value)
: value.replace(/\"/g, '"')) +
'"';
}
}
return output;
}
function renderText(elem, opts) {
var data = elem.data || '';
// if entities weren't decoded, no need to encode them back
if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) {
data = entities.encodeXML(data);
}
return data;
}
mapObject(channel, item, parentId, channelId) {
return ({
id: `channel:${channel.id}:${item.id}`,
parentId: item.parentId ? `channel:${channel.id}:${item.parentId}` : parentId,
updateId: 0,
type: item.type === 'container' ? 'container' : 'item',
properties: this.toDidl(item),
resources: [
item.playable && {
uri: `${Global.rootUrl}/rest/channel/${channelId}/redirect/${encodeURIComponent(item.id)}`,
protocolInfo: `http-get:*:${item.mimetype}:DLNA.ORG_OP=01;DLNA.ORG_CI=0`
},
item.poster ? {
uri: entities.encodeXML(cache(item.poster)),
protocolInfo: "xbmc.org:*:poster:*"
} : undefined,
item.backdrop ? {
uri: entities.encodeXML(cache(item.backdrop)),
protocolInfo: "xbmc.org:*:fanart:*"
} : undefined
]
});
}
await wrap(cb => {
this._avTransport.SetAVTransportURI({
InstanceID: 0,
CurrentURI: mediaUrl,
CurrentURIMetaData:
entities.encodeXML(
`${entities.encodeXML(item.title)}object.item.${type}Item${mediaUrl}${entities.encodeXML(item.id)}${entities.encodeXML(channel.id)}`)
}, cb)
});
}
function buildItem(object) {
return `<${object.type} id="${entities.encodeXML(object.id.toString())}" parentID="${entities.encodeXML(object.parentId.toString())}" restricted="1" searchable="0">${toXml(object.properties)}${buildResources(object.resources)}`;
}
var renderText = function(elem) {
return entities.encodeXML(elem.data || '');
};
Object.keys(attributes).forEach(key => {
value = attributes[key];
if (output) {
output += ' ';
}
let isBoolAttr = value && typeof value === 'boolean';
if (isBoolAttr) {
output += key;
}
else {
output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
}
});