function StupefyEntities in Typogrify 5
Same name and namespace in other branches
- 6 smartypants.php \StupefyEntities()
- 7 smartypants.php \StupefyEntities()
1 call to StupefyEntities()
File
- ./
smartypants.php, line 592
Code
function StupefyEntities($_) {
#
# Parameter: String.
# Returns: The string, with each SmartyPants HTML entity translated to
# its ASCII counterpart.
#
# Example input: “Hello — world.”
# Example output: "Hello -- world."
#
# en-dash em-dash
$_ = str_replace(array(
'–',
'—',
), array(
'-',
'--',
), $_);
# single quote open close
$_ = str_replace(array(
'‘',
'’',
), "'", $_);
# double quote open close
$_ = str_replace(array(
'“',
'”',
), '"', $_);
$_ = str_replace('…', '...', $_);
# ellipsis
return $_;
}