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 Action Methods
process()
Description
string process ( string $html [ , bool $isTitle = FALSE ] )
A method of class phpTypography. This method typographically processes the provided html according to the attributes set in the settings methods and returns the results.
Parameters
- html
- REQUIRED. A string of HTML code which should be subject to typographic processing.
- isTitle
- OPTIONAL. When working with Content Management System output, one commonly acquires page (or article) titles that lack HTML tags that would communicate to phpTypography its context. This option allows the function to know it is dealing with a heading, even though it lacks the ordinary HTML heading elements. Defaults to
FALSE.
Return Values
Returns the typographically processed html.
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$html = $typo->process($html);
echo $html;
?>
process_feed()
Description
string process_feed ( string $html [ , bool $isTitle = FALSE ] )
A method of class phpTypography. Feed readers are often less than sophisticated in their handling of non-ASCII characters. To avoid complications, this method does the bare minimum in processing html according to the attributes set in the settings methods and returns the results. The only modification of html that occurs is: intelligent character replacement of quotemarks, dashes, ellipses and trademarks.
Parameters
- html
- REQUIRED. A string of HTML code which should be subject to typographic processing.
- isTitle
- OPTIONAL. When working with Content Management System output, one commonly acquires page (or article) titles that lack HTML tags that would communicate to phpTypography its context. This option allows the function to know it is dealing with a heading, even though it lacks the ordinary HTML heading elements. Defaults to
FALSE.
Return Values
Returns the typographically processed html.
Examples
<?php
$html = "raw HTML here... ";
include('path/to/php-typography.php');
$typo = new phpTypography();
$html = $typo->process_feed($html);
echo $html;
?>
get_languages()
Description
array get_languages ( )
A method of class phpTypography. This method returns a complete list of language hyphenation patterns that are available for use.
Return Values
Returns an array of language codes and language names in the form of array( language code => language name ) for language files saved to the ‘/php-typography/lang/’ directory.
Examples
<?php
include('path/to/php-typography.php');
$typo = new phpTypography();
$langCodes = $typo->get_languages();
?>
<form action="/" method="get">
<label for="languageCode">Hyphenation Language Pattern:</label>
<select name="languageCode" id="languageCode">
<?php foreach($langCodes as $langCode => $langName): ?>
<option value='<?php echo $langCode ?>'><?php echo $langName ?></option>
<?php endforeach; ?>
</select>
<input type="submit" name="langSubmit" value="Submit" id="langSubmit">
</form>
get_diacritic_languages()
Description
array get_diacritic_languages ( )
A method of class phpTypography. This method returns a complete list of language specific diacritic replacement patterns that are available for use.
Return Values
Returns an array of all language codes and language names in the form of array( language code => language name ) for language files saved to the ‘/php-typography/diacritics/’ directory.
Examples
<?php
include('path/to/php-typography.php');
$typo = new phpTypography();
$langCodes = $typo->get_diacritic_languages();
?>
<form action="/" method="get">
<label for="languageCode">Language specific diacritic replacement pattern:</label>
<select name="languageCode" id="languageCode">
<?php foreach($langCodes as $langCode => $langName): ?>
<option value='<?php echo $langCode ?>'><?php echo $langName ?></option>
<?php endforeach; ?>
</select>
<input type="submit" name="langSubmit" value="Submit" id="langSubmit">
</form>

