You are here

function StupefyEntities in Typogrify 7

Same name and namespace in other branches
  1. 5 smartypants.php \StupefyEntities()
  2. 6 smartypants.php \StupefyEntities()

StupefyEntities. Example input: “Hello — world.” Example output: "Hello -- world."

Parameters

string $_: Input text.

Return value

string The string, with each SmartyPants HTML entity translated to it's ASCII counterpart.

1 call to StupefyEntities()
SmartyPants in ./smartypants.php
SmartyPants.

File

./smartypants.php, line 1048
SmartyPants - Smart punctuation for web sites

Code

function StupefyEntities($_) {

  // Dashes               en-dash    em-dash.
  $_ = str_replace(array(
    '–',
    '—',
  ), array(
    '-',
    '--',
  ), $_);

  // Single quote         open       close.
  $_ = str_replace(array(
    '‘',
    '’',
    '‚',
  ), "'", $_);

  // Double quote         open       close.
  $_ = str_replace(array(
    '“',
    '”',
    '„',
  ), '"', $_);

  // Ellipsis.
  $_ = str_replace('…', '...', $_);
  return $_;
}