function typography($html, $lang, $math) { $html = Markdown($html); switch ($lang) { case '0': $typo = new phpTypography(); $typo->set_smart_quotes_primary("doubleGuillemetsFrench"); $typo->set_smart_quotes_secondary("doubleCurled"); $typo->set_wrap_hard_hyphens(false); $typo->set_hyphenation(false); $typo->set_dewidow(false); //ne pas ajouter de style CSS supplémentaire $typo->set_style_caps(false); $typo->set_style_numbers(false); $typo->set_style_initial_quotes(false); $typo->set_url_wrap(false); $typo->set_email_wrap(false); $typo->set_smart_diacritics(false); if ($math == 'on') { $typo->set_smart_math(true); } else { $typo->set_smart_math(false); } $html = $typo->process($html); break; case '1': $typo = new phpTypography(); $typo->set_hyphenation(false); $typo->set_dewidow(false); $typo->set_wrap_hard_hyphens(false); //ne pas ajouter de style CSS supplémentaire $typo->set_style_caps(false); $typo->set_style_numbers(false); $typo->set_style_initial_quotes(false); $typo->set_url_wrap(false); $typo->set_email_wrap(false); $typo->set_punctuation_spacing(false); if ($math == 'on') { $typo->set_smart_math(true); } else { $typo->set_smart_math(false); } $typo->set_dewidow(false); $html = $typo->process($html); break; } return $html; }
public function action_init() { include 'vendor/php-typography/php-typography.php'; include 'vendor/TypographyFormat.php'; $opts = Options::get_group('typography'); $typo = new phpTypography(); // general attributes $typo->set_tags_to_ignore($opts['tags_to_ignore']); $typo->set_classes_to_ignore($opts['classes_to_ignore']); $typo->set_ids_to_ignore($opts['ids_to_ignore']); // smart characters $typo->set_smart_quotes($opts['smart_quotes']); $typo->set_smart_quotes_primary($opts['smart_quotes_primary']); $typo->set_smart_quotes_secondary($opts['smart_quotes_secondary']); $typo->set_smart_dashes($opts['smart_dashes']); $typo->set_smart_ellipses($opts['smart_ellipses']); $typo->set_smart_diacritics($opts['smart_diacritics']); $typo->set_diacritic_language($opts['diacritic_language']); $typo->set_diacritic_custom_replacements($opts['diacritic_custom_replacements']); $typo->set_smart_marks($opts['smart_marks']); $typo->set_smart_ordinal_suffix($opts['smart_ordinal_suffix']); $typo->set_smart_math($opts['smart_math']); $typo->set_smart_fractions($opts['smart_fractions']); $typo->set_smart_exponents($opts['smart_exponents']); // smart spacing $typo->set_single_character_word_spacing($opts['single_character_word_spacing']); $typo->set_fraction_spacing($opts['fraction_spacing']); $typo->set_unit_spacing($opts['unit_spacing']); $typo->set_units($opts['units']); $typo->set_dash_spacing($opts['dash_spacing']); $typo->set_dewidow($opts['dewidow']); $typo->set_max_dewidow_length($opts['max_dewidow_length']); $typo->set_max_dewidow_pull($opts['max_dewidow_pull']); $typo->set_wrap_hard_hyphens($opts['wrap_hard_hyphens']); $typo->set_url_wrap($opts['url_wrap']); $typo->set_email_wrap($opts['email_wrap']); $typo->set_min_after_url_wrap($opts['min_after_url_wrap']); $typo->set_space_collapse($opts['space_collapse']); // character styling $typo->set_style_ampersands($opts['style_ampersands']); $typo->set_style_caps($opts['style_caps']); $typo->set_style_initial_quotes($opts['style_initial_quotes']); $typo->set_style_numbers($opts['style_numbers']); $typo->set_initial_quote_tags($opts['initial_quote_tags']); // hyphenation $typo->set_hyphenation($opts['hyphenation']); $typo->set_hyphenation_language($opts['hyphenation_language']); $typo->set_min_length_hyphenation($opts['min_length_hyphenation']); $typo->set_min_before_hyphenation($opts['min_before_hyphenation']); $typo->set_min_after_hyphenation($opts['min_after_hyphenation']); $typo->set_hyphenate_headings($opts['hyphenate_headings']); $typo->set_hyphenate_all_caps($opts['hyphenate_all_caps']); $typo->set_hyphenate_title_case($opts['hyphenate_title_case']); $typo->set_hyphenation_exceptions($opts['hyphenation_exceptions']); $this->typo = $typo; }