Edit File by line
/home/barbar84/public_h.../wp-inclu.../js
File: wp-sanitize.js
/**
[0] Fix | Delete
* @output wp-includes/js/wp-sanitize.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
( function () {
[4] Fix | Delete
[5] Fix | Delete
window.wp = window.wp || {};
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* wp.sanitize
[9] Fix | Delete
*
[10] Fix | Delete
* Helper functions to sanitize strings.
[11] Fix | Delete
*/
[12] Fix | Delete
wp.sanitize = {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Strip HTML tags.
[16] Fix | Delete
*
[17] Fix | Delete
* @param {string} text Text to have the HTML tags striped out of.
[18] Fix | Delete
*
[19] Fix | Delete
* @return Stripped text.
[20] Fix | Delete
*/
[21] Fix | Delete
stripTags: function( text ) {
[22] Fix | Delete
text = text || '';
[23] Fix | Delete
[24] Fix | Delete
// Do the replacement.
[25] Fix | Delete
var _text = text
[26] Fix | Delete
.replace( /<!--[\s\S]*?(-->|$)/g, '' )
[27] Fix | Delete
.replace( /<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/ig, '' )
[28] Fix | Delete
.replace( /<\/?[a-z][\s\S]*?(>|$)/ig, '' );
[29] Fix | Delete
[30] Fix | Delete
// If the initial text is not equal to the modified text,
[31] Fix | Delete
// do the search-replace again, until there is nothing to be replaced.
[32] Fix | Delete
if ( _text !== text ) {
[33] Fix | Delete
return wp.sanitize.stripTags( _text );
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
// Return the text with stripped tags.
[37] Fix | Delete
return _text;
[38] Fix | Delete
},
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Strip HTML tags and convert HTML entities.
[42] Fix | Delete
*
[43] Fix | Delete
* @param {string} text Text to strip tags and convert HTML entities.
[44] Fix | Delete
*
[45] Fix | Delete
* @return Sanitized text. False on failure.
[46] Fix | Delete
*/
[47] Fix | Delete
stripTagsAndEncodeText: function( text ) {
[48] Fix | Delete
var _text = wp.sanitize.stripTags( text ),
[49] Fix | Delete
textarea = document.createElement( 'textarea' );
[50] Fix | Delete
[51] Fix | Delete
try {
[52] Fix | Delete
textarea.textContent = _text;
[53] Fix | Delete
_text = wp.sanitize.stripTags( textarea.value );
[54] Fix | Delete
} catch ( er ) {}
[55] Fix | Delete
[56] Fix | Delete
return _text;
[57] Fix | Delete
}
[58] Fix | Delete
};
[59] Fix | Delete
}() );
[60] Fix | Delete
[61] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function