Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function secondLine(content) {
// Remove first line
let res = striptags(content.replace(/>\n<')).replace(/ /gi, ' ').trim().split('\n');
content = res.slice(1, 10).join(' ').trim();
if (!content) return '';
return content.substr(0, 250).replace(/&/g, '&');
}
function toPlainText(str) {
// coerce all text into a string. Undefined stuff is just an empty string
if (!_.isString(str)) {
return '';
}
return decode(striptags(str.replace(' ', ' ')));
}
function testStriptags() {
var html =
'<a href="https://example.com">' +
'lorem ipsum <strong>dolor</strong> <em>sit</em> amet' +
'</a>';
striptags(html);
striptags(html, '<a><strong>');
striptags(html, ['a']);
}</strong></a>
const textRenderer = (tree?: ItemType) => {
if (typeof tree === "undefined") {
console.error(
"@phenomic/plugin-renderer-react: textRenderer expects at least a child",
);
return "";
}
if (typeof tree === "string") {
return striptags(tree);
}
return render(tree);
};
articles: articles.map(item => {
return {
guid: item.guid,
author: item.author,
source: item.source,
title: he.decode(item.title),
read: false,
favourite: false,
summary: _.truncate.prune(he.decode(striptags(item.summary)), 120),
tags: [],
link: item.origlink ? item.origlink : item.link,
pubDate: moment(item.pubDate).format('X')
}
})
}
function cleanValue(value) {
return decode(striptags(value));
}
function countContent(content: any): [number, number] {
if (typeof content !== 'string') {
throw new Error('[word-counter] content must be string type')
}
let cn = 0
let en = 0
if (content.length > 0) {
content = striptags(content)
cn = (content.match(CN_PATTERN) || []).length
en = (content.replace(CN_PATTERN, '').match(EN_PATTERN) || []).length
}
return [cn, en]
}
}, design, i, props ) )
const itemStyles = applyFilters( 'stackable.feature-grid.itemstyles_1_17_2', {
image: {
width: imageUrl ? `${ imageSize }%` : undefined,
},
}, design, i, props )
return (
<div style="{">
{ imageUrl &&
<div>
<img title="" alt="{" style="{" src="{">
</div>
}
<div>
{ ! RichText.isEmpty( title ) && (
) }
{ ! RichText.isEmpty( description ) && (
</div></div>
{ range( 1, columns + 1 ).map( i => {
const subtitle = attributes[ `subtitle${ i }` ]
const title = attributes[ `title${ i }` ]
const description = attributes[ `description${ i }` ]
const ariaLabel = striptags(
( showTitle && ! RichText.isEmpty( title ) ) ? title :
( showSubtitle && ! RichText.isEmpty( subtitle ) ) ? subtitle :
( showDescription && ! RichText.isEmpty( description ) ) ? description :
''
)
const itemClasses = classnames( [
'ugb-image-box__item',
`ugb-image-box__item${ i }`,
'ugb-image-box__box',
], applyFilters( 'stackable.image-box.itemclasses', {
[ `ugb--shadow-${ shadow }` ]: show.columnBackground && shadow !== '',
}, props, i ) )
const rel = []
if ( attributes[ `link${ i }NewTab` ] ) {