function _typogrify_process in Typogrify 5
Same name and namespace in other branches
- 6 typogrify.module \_typogrify_process()
- 7 typogrify.module \_typogrify_process()
1 call to _typogrify_process()
File
- ./
typogrify.module, line 69
Code
function _typogrify_process($text, $format) {
// Load Helpers
require_once dirname(__FILE__) . '/typogrify.class.php';
require_once dirname(__FILE__) . '/unicode-conversion.php';
if (!function_exists('marksmarty_filter')) {
require_once dirname(__FILE__) . '/smartypants.php';
}
// Wrap ampersands
if (variable_get("typogrify_is_amp_on_{$format}", 1) == 1) {
$text = Typogrify::amp($text);
}
// Remove widows
if (variable_get("typogrify_is_widont_on_{$format}", 1) == 1) {
$text = Typogrify::widont($text);
}
// Smartypants formatting
if (variable_get("marksmarty_is_smarty_on_{$format}", 1) == 1) {
global $smartypants_attr;
$smartypants_attr = variable_get("marksmarty_smarty_hyphens_{$format}", 1);
$text = SmartyPants($text);
}
// Wrap caps
if (variable_get("typogrify_is_caps_on_{$format}", 1) == 1) {
$text = Typogrify::caps($text);
}
// Wrap initial quotes
if (variable_get("typogrify_is_initial_quotes_on_{$format}", 1) == 1) {
$text = Typogrify::initial_quotes($text);
}
// Build a list of ligatures to convert
global $ligature_map;
if (is_array($ligature_map) && count($ligature_map) > 0) {
foreach ($ligature_map as $pair => $ligature) {
$setting = 'typogrify_use_' . $pair . '_ligature_' . $format;
if (variable_get($setting, 0) == 1) {
$characters_to_convert[] = $pair;
}
}
}
// Build a list of arrows to convert
global $arrow_map;
if (is_array($arrow_map) && count($arrow_map) > 0) {
foreach ($arrow_map as $ascii => $unicode) {
$setting = 'typogrify_use_unicode_for_' . $ascii . '_' . $format;
if (variable_get($setting, 0) == 1) {
$characters_to_convert[] = $ascii;
}
}
}
// Convert ligatures and arrows
if (count($characters_to_convert) > 0) {
$text = convert_characters($text, $characters_to_convert);
}
return $text;
}