public static function Typogrify::amp in Typogrify 5
Same name and namespace in other branches
- 6 typogrify.class.php \Typogrify::amp()
- 7 typogrify.class.php \Typogrify::amp()
Enable custom styling of ampersands.
Wraps apersands in html with '<span class="amp">', so they can be styled with CSS. Ampersands are also normalized to '&. Requires ampersands to have whitespace or an ' ' on both sides.
It won't mess up & that are already wrapped, in entities or URLs
Parameters
string:
Return value
string
2 calls to Typogrify::amp()
- Typogrify::filter in ./
typogrify.class.php - typogrify
- _typogrify_process in ./
typogrify.module
File
- ./
typogrify.class.php, line 18 - typogrify.class.php Defines a class for providing different typographical tweaks to HTML
Class
- Typogrify
- @file typogrify.class.php Defines a class for providing different typographical tweaks to HTML
Code
public static function amp($text) {
$amp_finder = "/(\\s| )(&|&|&\\#38;|&)(\\s| )/";
return preg_replace($amp_finder, '\\1<span class="amp">&</span>\\3', $text);
}