You are here

function spam_get_text in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_get_text()

Extract text from content array.

2 calls to spam_get_text()
spam_filter_bayesian_tokenize in filters/spam_filter_bayesian/spam_filter_bayesian.module
Split content into an array of tokens.
spam_filter_custom_spam_filter in filters/spam_filter_custom/spam_filter_custom.module
Apply enabled custom filter rules against content.

File

./spam.module, line 1862
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_get_text($content, $type, $fields, $extra = array(), $full = TRUE) {
  if (is_object($content)) {
    $content = (array) $content;
  }
  $text = '';
  if (isset($fields['main']) && is_array($fields['main'])) {
    foreach ($fields['main'] as $field) {
      $text .= $content[$field] . ' ';
    }
  }
  if ($full && isset($fields['other']) && is_array($fields['other'])) {
    foreach ($fields['other'] as $field) {
      $text .= $content[$field] . ' ';
    }
  }
  return $text;
}