You are here

function messaging_check_plain in Messaging 6.2

Same name and namespace in other branches
  1. 5 messaging.module \messaging_check_plain()
  2. 6.4 includes/text.inc \messaging_check_plain()
  3. 6 messaging.module \messaging_check_plain()
  4. 6.3 messaging.module \messaging_check_plain()

HTML to text simple filtering.

  • Replace some tags with line endings: p, br, hr, li, h1, h2, h3, h4

Strip out all HTML tags and decode entities

Parameters

$text: Text to clean up

$break: Optional character to replace tags for line breaks

2 calls to messaging_check_plain()
messaging_check_subject in ./messaging.module
Converts strings to plain utf-8 single line
messaging_filter in ./messaging.module
Implementation of hook_filter(). Contains a basic set of essential filters.

File

./messaging.module, line 818

Code

function messaging_check_plain($text, $break = NULL) {

  // This have to be done before the filtering because tag markers may have been previously parsed with check_plain
  $text = str_replace(array(
    '<',
    '>',
  ), array(
    '<',
    '>',
  ), $text);

  // Clean up the HTML and replace some tags with line endings
  if (isset($break)) {
    $text = _filter_htmlcorrector($text);
    $text = str_replace(array(
      '</p>',
      '<br />',
      '<hr />',
      '</li>',
      '</h1>',
      '</h2>',
      '</h3>',
      '</h4>',
    ), $break, $text);
  }

  // Final text clean up
  return messaging_text_clean($text);
}