This draft of the documentation remains immature. While we have made attempt to be thorough and accurate, you may encounter errors. If you discover any deficiencies, please let us know at info@kingdesk.com
This page is a subset of the documentation of the functionality provided by the PHP Typography project.phpTypography Settings Methods
- set_defaults()
- set_tags_to_ignore()
- set_classes_to_ignore()
- set_ids_to_ignore()
- set_hyphenation()
- set_hyphenation_language()
- set_min_length_hyphenation()
- set_min_before_hyphenation()
- set_min_after_hyphenation()
- set_hyphenate_headings()
- set_hyphenate_title_case()
- set_hyphenate_all_caps()
- set_hyphenation_exceptions()
- set_fraction_spacing()
- set_unit_spacing()
- set_units()
- set_dash_spacing()
- set_single_character_word_spacing()
- set_space_collapse()
- set_dewidow()
- set_max_dewidow_length()
- set_max_dewidow_pull()
- set_wrap_hard_hyphens()
- set_email_wrap()
- set_url_wrap()
- set_min_after_url_wrap()
- set_smart_quotes()
- set_smart_quotes_primary()
- set_smart_quotes_secondary()
- set_smart_quotes_language()
- set_smart_dashes()
- set_smart_ellipses()
- set_smart_diacritics()
- set_diacritic_language()
- set_diacritic_custom_replacements()
- set_smart_marks()
- set_smart_math()
- set_smart_exponents()
- set_smart_fractions()
- set_smart_multiplication()
- set_smart_ordinal_suffix()
- set_style_ampersands()
- set_style_caps()
- set_style_numbers()
- set_style_initial_quotes()
- set_initial_quote_tags()
set_defaults()
Description
bool set_defaults ( )
A method of class phpTypography. This method calls all other settings methods with their default parameters. This method is called automatically at the creation of a phpTypography instance. It may be called to independently to restore default settings.
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_defaults();
$html = $typo->process($html);
echo $html;
?>
set_classes_to_ignore()
Description
bool set_classes_to_ignore ( [ mixed $classNames = array("vcard") ] )
A method of class phpTypography. This method identifies HTML classes to which typographic processing should not be applied.
Parameter
- classNames
- OPTIONAL. A string or array of HTML class names to which typographic processing should not be applied. Defaults to
array("vcard")
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_classes_to_ignore("foo");
$html = $typo->process($html);
echo $html;
?>
set_ids_to_ignore()
Description
bool set_ids_to_ignore ( [ mixed $idNames = array() ] )
A method of class phpTypography. This method identifies HTML IDs to which typographic processing should not be applied.
Parameter
- idNames
- OPTIONAL. A string or array of HTML IDs to which typographic processing should not be applied. Defaults to
array()
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_ids_to_ignore("foo");
$html = $typo->process($html);
echo $html;
?>
set_hyphenation()
Description
bool set_hyphenation ( [ bool $on = TRUE ] )
A method of class phpTypography. This method turns on and off the hyphenation functionality of the process method.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenation(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_hyphenation_language()
Description
bool set_hyphenation_language ( [ string $languageCode = "en-US" ] )
A method of class phpTypography. This method sets the language specific hyphenation patterns used in the hyphenation functionality of the process method. You may use the get_languages method to automatically generate a list of all installed language patterns.
Parameter
- languageCode
- OPTIONAL. A string equal to the Language Code of a hyphenation pattern. Allowed Language Codes are those for which a dictionary has been loaded into the ‘php-typography/lang’ directory. Defaults to
en-US
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenation_language("en-GB");
$html = $typo->process($html);
echo $html;
?>
set_min_length_hyphenation()
Description
bool set_min_length_hyphenation ( [ int $length = 5 ] )
A method of class phpTypography. This method sets the minimum word length for the hyphenation functionality of the process method.
Parameter
- length
- OPTIONAL. An integer equal to the minimum word length for the hyphenation functionality. Defaults to
5
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_min_length_hyphenation(7);
$html = $typo->process($html);
echo $html;
?>
set_min_before_hyphenation()
Description
bool set_min_before_hyphenation ( [ int $length = 3 ] )
A method of class phpTypography. This method sets the minimum number of characters between the beginning of a word and the first hyphenation point for the hyphenation functionality of the process method.
Parameter
- length
- OPTIONAL. An integer equal to the minimum number of characters between the beginning of a word and the first hyphenation point for the hyphenation functionality. Defaults to
3
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_min_before_hyphenation(5);
$html = $typo->process($html);
echo $html;
?>
set_min_after_hyphenation()
Description
bool set_min_after_hyphenation ( [ int $length = 2 ] )
A method of class phpTypography. This method sets the minimum number of characters between the last hyphenation point and the end of a word for the hyphenation functionality of the process method.
Parameter
- length
- OPTIONAL. An integer equal to the minimum number of characters between the last hyphenation point and the end of a word for the hyphenation functionality. Defaults to
2
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_min_after_hyphenation(3);
$html = $typo->process($html);
echo $html;
?>
set_hyphenate_headings()
Description
bool set_hyphenate_headings ( [ int $on = TRUE ] )
A method of class phpTypography. This method turns on and off the hyphenation functionality for headings of the process method.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenate_headings(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_hyphenate_title_case()
Description
bool set_hyphenate_title_case ( [ int $on = TRUE ] )
A method of class phpTypography. This method turns on and off hyphenation of capitalized (title case) words for the hyphenation functionality of the process method. Set this method to FALSE to protect proper nouns from hyphenation.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenate_title_case(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_hyphenate_all_caps()
Description
bool set_hyphenate_all_caps ( [ int $on = TRUE ] )
A method of class phpTypography. This method turns on and off hyphenation of words consisting of all capital letters for the hyphenation functionality of the process method.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenate_all_caps(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_hyphenation_exceptions()
Description
bool set_hyphenation_exceptions ( [ mixed $exceptions = array() ] )
A method of class phpTypography. This method sets custom hyphenation points for specified words for the hyphenation functionality of the process method.
Parameter
- exceptions
- OPTIONAL. Either a string of a single hyphenation exception or an array of multiple hyphenation exceptions. Each exception should be the correct spelling of the targeted word with a hard-hyphen (minus sign) inserted at each allowable hyphenation point. Defaults to
array()
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_hyphenation_exceptions("king-desk");
$html = $typo->process($html);
echo $html;
?>
set_fraction_spacing()
Description
bool set_fraction_spacing ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will keep integers and trailing fractions together on the same line by inserting a non-breaking space between them.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_fraction_spacing(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_unit_spacing()
Description
bool set_unit_spacing ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will keep numeric values and trailing units on the same line by inserting a non-breaking space between them.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_unit_spacing(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_units()
Description
bool set_units ( [ mixed $units = array() ] )
A method of class phpTypography. This method works in conjunction with the set_unit_spacing method. set_unit_spacing already looks for a vast set of units. This method can be used to fill in any holes.
Parameter
- units
- OPTIONAL. Either a string of a single unit name or an array of multiple unit names. Defaults to
array()
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_units("fortnight");
$html = $typo->process($html);
echo $html;
?>
set_dash_spacing()
Description
bool set_dash_spacing ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will force thin-spaces between em or en dashes and adjoining letters.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_dash_spacing(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_single_character_word_spacing()
Description
bool set_single_character_word_spacing ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will force force single character words to wrap to new line (unless they are widows). Added in version 1.9
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_single_character_word_spacing(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_space_collapse()
Description
bool set_space_collapse ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will collapse adjacent spacing to a single character. Normal HTML processing collapses basic spaces. This option will additionally collapse no-break spaces, zero-width spaces, figure spaces, etc. Added in version 1.13
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_space_collapse(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_dewidow()
Description
bool set_dewidow ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will attempt to protect widows. Widows are the last word in a block level text that falls to it’s own line. Widows get lonely when they are all alone. Widows are kept company by the injection of a non-breaking space between them and the previous word (causing both words to drop to the next line together).
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_dewidow(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_max_dewidow_length()
Description
bool set_max_dewidow_length ( [ int $length = 5 ] )
A method of class phpTypography. This method sets the maximum word length of widows who will be protected. Some widows are long enough, they can keep themselves company.
Parameter
- length
- OPTIONAL. An integer equal to the maximum word length of widows who will be protected. Defaults to
5
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_max_dewidow_length(7);
$html = $typo->process($html);
echo $html;
?>
set_max_dewidow_pull()
Description
bool set_max_dewidow_pull ( [ int $length = 5 ] )
A method of class phpTypography. This method sets the maximum word length that can be pulled from the previous line to keep widows company. Some words are too heavy to move (especially with justified text).
Parameter
- length
- OPTIONAL. An integer equal to the maximum word length of widows who will be protected. Defaults to
5
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_max_dewidow_pull(4);
$html = $typo->process($html);
echo $html;
?>
set_wrap_hard_hyphens()
Description
bool set_wrap_hard_hyphens ( [ bool $on = TRUE ] )
A method of class phpTypography. Some browsers will not allow words such as “mother-in-law” to wrap after a hard hyphen at line’s end. This method will enable wrapping after hard hyphens by the insertion of a zero-width-space.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_wrap_hard_hyphens(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_email_wrap()
Description
bool set_email_wrap ( [ bool $on = TRUE ] )
A method of class phpTypography. Email addresses can get fairly lengthy, and not all browsers will not allow them to break-apart at line’s end for efficient line-wrapping. This method will enable wrapping of email addresses by the strategic insertion of zero-width-spaces after all non-alphanumeric characters.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_email_wrap(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_url_wrap()
Description
bool set_url_wrap ( [ bool $on = TRUE ] )
A method of class phpTypography. URLs can get very lengthy, and not all browsers will not allow them to break-apart at line’s end for efficient line-wrapping. This method will enable wrapping of URLs by the strategic insertion of zero-width-spaces. Wrapping points are conservatively inserted into the domain portion of the URL and aggressively added to the subsequent path.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_url_wrap(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_min_after_url_wrap()
Description
bool set_min_after_url_wrap ( [ int $length = 5 ] )
A method of class phpTypography. This method sets the minimum number of characters that must remain together at the end of a URL when URL wrapping is enabled.
Parameter
- length
- OPTIONAL. An integer equal to the minimum number of characters that must remain together at the end of a URL. Defaults to
5
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_min_after_url_wrap(4);
$html = $typo->process($html);
echo $html;
?>
set_smart_quotes()
Description
bool set_smart_quotes ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will transform straight quotes and backticks into contextually aware curly quotes, primes, apostrophes, and even double-low-9-quotemarks.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_quotes(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_quotes_primary()
Description
bool set_smart_quotes_primary ( [ string $style = "doubleCurled"] )
A method of class phpTypography. This method sets the replacement characters for the double straight-quote character. Different languages have different quotation styles… this method accommodates these differences. Added in version 1.15.
Parameter
- style
- OPTIONAL. Allowed values are:
- “doubleCurled” [DEFAULT] – “foo”
- “doubleCurledReversed” – ”foo”
- “doubleLow9″ – „foo”
- “doubleLow9Reversed” – „foo“
- “singleCurled” – ‘foo’
- “singleCurledReversed” – ’foo’
- “singleLow9″ – ‚foo’
- “singleLow9Reversed” – ‚foo‘
- “doubleGuillemetsFrench” – « foo »
- “doubleGuillemets” – «foo»
- “doubleGuillemetsReversed” – »foo«
- “singleGuillemets” – ‹foo›
- “singleGuillemetsReversed” – ›foo‹
- “cornerBrackets” – 「foo」
- “whiteCornerBracket” – 『foo』
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_quotes_primary("doubleLow9");
$html = $typo->process($html);
echo $html;
?>
set_smart_quotes_secondary()
Description
bool set_smart_quotes_secondary ( [ string $style = "singleCurled"] )
A method of class phpTypography. This method sets the replacement characters for the single straight-quote character. Different languages have different quotation styles… this method accommodates these differences. Added in version 1.15.
Parameter
- style
- OPTIONAL. Allowed values are:
- “doubleCurled” – “foo”
- “doubleCurledReversed” – ”foo”
- “doubleLow9″ – „foo”
- “doubleLow9Reversed” – „foo“
- “singleCurled” [DEFAULT] – ‘foo’
- “singleCurledReversed” – ’foo’
- “singleLow9″ – ‚foo’
- “singleLow9Reversed” – ‚foo‘
- “doubleGuillemetsFrench” – « foo »
- “doubleGuillemets” – «foo»
- “doubleGuillemetsReversed” – »foo«
- “singleGuillemets” – ‹foo›
- “singleGuillemetsReversed” – ›foo‹
- “cornerBrackets” – 「foo」
- “whiteCornerBracket” – 『foo』
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_quotes_secondary("doubleLow9");
$html = $typo->process($html);
echo $html;
?>
set_smart_quotes_language()
This method has been DEPRECIATED in favor of the set_smart_quotes_primary() and set_smart_quotes_secondary() methods.
set_smart_dashes()
Description
bool set_smart_dashes ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will minus-hyphens (or multiple minus-hyphens) into contextually aware en and em dashes (and even no-break-hyphens for phone numbers).
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_dashes(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_ellipses()
Description
bool set_smart_ellipses ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will replace three consecutive periods with an ellipses character.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_ellipses(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_diacritics()
Description
bool set_smart_diacritics ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will automatically look for words that should utilize diacritics, and ensure they do. When enabled, “creme brulee” becomes “crème brûlée”. Note that this method will not process words that have alternate meaning without diacritics like resume & résumé, divorce & divorcé, and expose & exposé.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_diacritics(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_diacritic_language()
Description
bool set_diacritic_language ( [ string $languageCode = "en-US" ] )
A method of class phpTypography. This method sets the language specific diacritic replacement patterns used in the diacritic functionality of the process method. You may use the get_diacritic_languages method to automatically generate a list of all installed language patterns.
Parameter
- languageCode
- OPTIONAL. A string equal to the Language Code of a hyphenation pattern. Allowed Language Codes are those for which a dictionary has been loaded into the ‘php-typography/diacritics’ directory. Defaults to
en-US
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_diacritic_language("en-GB");
$html = $typo->process($html);
echo $html;
?>
set_diacritic_custom_replacements()
Description
bool set_diacritic_custom_replacements ( [ mixed $replacements = array() ] )
A method of class phpTypography. This method sets custom diacritic replacement patterns for the diacritic functionality of the process method. This method is case-sensitive.
Parameter
- replacements
-
OPTIONAL. Must be in one of two formats:
- A string in the format of "needle 1"=>"replacement 1", "needle 2"=>"replacement 2". Note: double-quotes are required.
- An array in the format of
array( needle_1 => replacement_1, needle_2 => replacement_2 )
TIP: you may want to set this parameter to
array (
"cooperate" => "coöperate",
"Cooperate" => "Coöperate",
"cooperation" => "coöperation",
"Cooperation" => "Coöperation",
"cooperative" => "coöperative",
"Cooperative" => "Coöperative",
"coordinate" => "coördinate",
"Coordinate" => "Coördinate",
"coordinated" => "coördinated",
"Coordinated" => "Coördinated",
"coordinating" => "coördinating",
"Coordinating" => "Coördinating",
"coordination" => "coördination",
"Coordination" => "Coördination",
"coordinator" => "coördinator",
"Coordinator" => "Coördinator",
"coordinators" => "coördinators",
"Coordinators" => "Coördinators",
"continuum" => "continuüm",
"Continuum" => "Continuüm",
"debacle" => "débâcle",
"Debacle" => "Débâcle",
"elite" => "élite",
"Elite" => "Élite"
)
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_diacritic_custom_replacements( array("cooperate"=>"coöperate", "Cooperate"=>"Coöperate") );
$html = $typo->process($html);
echo $html;
?>
set_smart_marks()
Description
bool set_smart_marks ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will intelligently use proper mark symbols. (r), (c), (tm), (sm), and (p) become ®, ©, ™, ℠, and ℗.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_marks(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_math()
Description
bool set_smart_math ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will intelligently inject proper minus, division and multiplication characters into math equations.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_math(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_exponents()
Description
bool set_smart_exponents ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will identify exponents, superscript them. This makes for pretty exponents.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_exponents(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_fractions()
Description
bool set_smart_fractions ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will identify fractions, raise the numerator, lower the denominator and replace the slash with a fraction-slash. This makes for pretty fractions.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_fractions(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_smart_multiplication()
Description
This method has been DEPRECIATED in favor of the set_smart_math() method.
set_smart_ordinal_suffix()
Description
bool set_smart_ordinal_suffix ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will identify numbers followed by an ordinal suffix, and superscript the ordinal (i.e. 1st, 2nd and 3rd).
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_smart_ordinal_suffix(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_style_ampersands()
Description
bool set_style_ampersands ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will allow the wrapping of ampersands with <span class="amp">. This provides a hook for special CSS styling. For instance, the font may be changed to use a highly decorative ampersand.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_style_ampersands(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_style_caps()
Description
bool set_style_caps ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will allow the wrapping of acronyms with <span class="caps">. This provides a hook for special CSS styling. For instance, you can use small-caps for your acronyms.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_style_caps(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_style_numbers()
Description
bool set_style_numbers ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will allow the wrapping of numbers with <span class="numbers">. This provides a hook for special CSS styling. For instance, you can change a font from lowercase or uppercase digits.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_style_numbers(FALSE);
$html = $typo->process($html);
echo $html;
?>
set_style_initial_quotes()
Description
bool set_style_initial_quotes ( [ bool $on = TRUE ] )
A method of class phpTypography. This method will allow the wrapping of initial single quotes with <span class="quo"> and initial double quotes or guillemet with <span class="dquo">. This provides a hook for special CSS styling. For instance, you can apply a negative indent for hanging punctuation.
Parameter
- on
- OPTIONAL. Allowed values are
TRUEandFALSE. Defaults toTRUE
Return Values
Returns TRUE upon success;
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$typo->set_style_initial_quotes(FALSE);
$html = $typo->process($html);
echo $html;
?>

