You are here

function messaging_text_clean in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 includes/text.inc \messaging_text_clean()
  2. 6.2 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

3 calls to messaging_text_clean()
messaging_check_plain in ./messaging.module
HTML to text simple filtering.
messaging_sms_render in messaging_sms/messaging_sms.module
Message Render callback
messaging_xmpp_render in messaging_xmpp/messaging_xmpp.module
Message Render callback

File

./messaging.module, line 676

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;
}