You are here

public function Drupal_RichSnippets_Node_NodeSchemaPreprocessor::normalize in Rich Snippets 7

Strips tags and reduces duplicate spaces.

Parameters

string $html: The raw HTML markup.

Return value

string The text with HTML tags stripped.

1 call to Drupal_RichSnippets_Node_NodeSchemaPreprocessor::normalize()
Drupal_RichSnippets_Node_NodeSchemaPreprocessor::addTextToInfo in lib/Drupal/RichSnippets/Node/NodeSchemaPreprocessor.php
Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::addTextToInfo().

File

lib/Drupal/RichSnippets/Node/NodeSchemaPreprocessor.php, line 65
Contains Drupal_RichSnippets_Node_NodeSchemaPreprocessor.

Class

Drupal_RichSnippets_Node_NodeSchemaPreprocessor
Rich Snippets preprocessor for the Node module.

Code

public function normalize($html) {
  $text = str_replace(array(
    '<',
    '>',
  ), array(
    ' <',
    '> ',
  ), $html);
  $text = html_entity_decode(strip_tags($text), ENT_QUOTES, 'UTF-8');
  return preg_replace('/\\s{2,}/', ' ', trim($text));
}