You are here

protected function SearchApiAttachmentsAlterSettings::extractSimple in Search API attachments 7

Extracts file content for text files.

Parameters

object $file: The file.

Return value

string The text.

1 call to SearchApiAttachmentsAlterSettings::extractSimple()
SearchApiAttachmentsAlterSettings::getFileContent in includes/callback_attachments_settings.inc
Extracts th file content.

File

includes/callback_attachments_settings.inc, line 348
Search API data alteration callback.

Class

SearchApiAttachmentsAlterSettings
Indexes files content.

Code

protected function extractSimple($file) {
  $text = file_get_contents($this
    ->getRealpath($file));
  $text = iconv("UTF-8", "UTF-8//IGNORE", $text);
  $text = filter_xss(str_replace(array(
    '<',
    '>',
  ), array(
    ' <',
    '> ',
  ), $text), array());
  $text = htmlspecialchars(html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'), ENT_NOQUOTES, 'UTF-8');
  $text = trim($text);
  return $text;
}