function messaging_text_clean in Messaging 6.4
Same name and namespace in other branches
- 6.2 messaging.module \messaging_text_clean()
- 6.3 messaging.module \messaging_text_clean()
Clean text of HTML stuff and optionally of line endings
Parameters
$text: Dirty HTML text to be filtered
$newline: Optional string to be used as line ending
4 calls to messaging_text_clean()
- Messaging_Method::text_clean in includes/
messaging_method.class.inc - Clean text of HTML stuff and optionally of line endings
- messaging_sms_render in messaging_sms/
messaging_sms.module - Message Render callback
- messaging_text_check_plain in includes/
text.inc - HTML to text simple filtering.
- messaging_xmpp_render in messaging_xmpp/
messaging_xmpp.module - Message Render callback
File
- includes/
text.inc, line 43 - Drupal Messaging Framework - Text filtering functions
Code
function messaging_text_clean($text, $newline = NULL) {
// HTML entities to plain text conversion.
$text = decode_entities($text);
// Filters out all remaining HTML tags
$text = filter_xss($text, array());
// Optionally, replace new lines
if (!is_null($newline)) {
$text = str_replace("\n", $newline, $text);
}
// Trim out remaining beginning/ending spaces
$text = trim($text);
return $text;
}