Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getButtonText = () => {
if ( Number.isFinite( cartQuantity ) && addedToCart ) {
return sprintf(
// translators: %s number of products in cart.
_n(
'%d in cart',
'%d in cart',
cartQuantity,
'woocommerce'
),
cartQuantity
);
}
return decodeEntities( productCartDetails.text );
};
const filteredTerm = getFilteredTerm( term.id );
// If there is no match this term doesn't match the current product collection - only render if checked.
if (
! filteredTerm &&
! checked.includes( term.slug ) &&
! isTermInQueryState( term.slug )
) {
return null;
}
const count = filteredTerm ? filteredTerm.count : 0;
return {
value: term.slug,
name: decodeEntities( term.name ),
label: (
<label name="{">
),
};
} )
.filter( Boolean );</label>
const filteredTerm = getFilteredTerm( term.id );
// If there is no match this term doesn't match the current product collection - only render if checked.
if (
! filteredTerm &&
! checked.includes( term.slug ) &&
! isTermInQueryState( term.slug )
) {
return null;
}
const count = filteredTerm ? filteredTerm.count : 0;
return {
value: term.slug,
name: decodeEntities( term.name ),
label: (
<label name="{">
),
};
} )
.filter( Boolean );</label>
.then( result =>
setSiteOptions( {
...siteOptions,
option: decodeEntities( result[ siteOption ] ),
previousOption: decodeEntities( result[ siteOption ] ),
loaded: true,
error: false,
} )
)
{ Object.keys( SEPARATORS ).map( key => {
const value = decodeEntities( SEPARATORS[ key ] );
return (
<button> onChange( { titleSeparator: key } ) }
isPressed={ key === titleSeparator }
isSecondary={ key !== titleSeparator }
>
{ value }
</button>
);
} ) }
{ authors.map( ( author ) => (
<option value="{">{ decodeEntities( author.name ) }</option>
) ) }
export function DefaultBlockAppender( {
isLocked,
isVisible,
onAppend,
placeholder,
containerStyle,
} ) {
if ( isLocked || ! isVisible ) {
return null;
}
const value = decodeEntities( placeholder ) || __( 'Start writing…' );
return (
);
}
if (
! filteredTerm &&
! checked.includes( term.slug ) &&
! isTermInQueryState( term.slug )
) {
return null;
}
const count = filteredTerm ? filteredTerm.count : 0;
return {
value: term.slug,
name: decodeEntities( term.name ),
label: (
<label name="{">
),
};
} )
.filter( Boolean );</label>
return null;
}
let prefix = '';
if ( index > 0 && operator === 'and' ) {
prefix = (
<span>
{ __( 'and', 'woocommerce' ) }
</span>
);
}
return renderRemovableListItem( {
type: attributeLabel,
name: decodeEntities( termObject.name || slug ),
prefix,
removeCallback: () => {
removeAttributeFilterBySlug(
productAttributes,
setProductAttributes,
attributeObject,
slug
);
},
showLabel: false,
displayStyle,
} );
} ) }
titleForPost = post => {
if ( ! post.title ) {
return '';
}
if ( typeof post.title === 'string' ) {
return decodeEntities( post.title.trim() );
}
if ( typeof post.title === 'object' && post.title.rendered ) {
return decodeEntities( post.title.rendered.trim() );
}
};