PHP Class CI_Typography, TastyIgniter

Author: ExpressionEngine Dev Team
Show file Open project: tastyigniter/tastyigniter

Public Properties

Property Type Description
$block_elements string Block level elements that should not be wrapped inside

tags

$inline_elements string Tags we want the parser to completely ignore when splitting the string.
$inner_block_required array array of block level elements that require inner content to be within another block level element
$last_block_element string the last block element parsed
$protect_braced_quotes boolean whether or not to protect quotes within { curly braces }
$skip_elements string Elements that should not have

and
tags within them.

Public Methods

Method Description
auto_typography ( $str, $reduce_linebreaks = FALSE ) : string Auto Typography
format_characters ( $str ) : string Format Characters
nl2br_except_pre ( $str ) : string Convert newlines to HTML line breaks except within PRE tags

Protected Methods

Method Description
_format_newlines ( $str ) : string Format Newlines
_protect_characters ( $match ) : string Protect Characters

Method Details

_format_newlines() protected method

Converts newline characters into either

tags or

protected _format_newlines ( $str ) : string
return string

_protect_characters() protected method

Protects special characters from being formatted later We don't want quotes converted within tags so we'll temporarily convert them to {@DQ} and {@SQ} and we don't want double dashes converted to emdash entities, so they are marked with {@DD} likewise double spaces are converted to {@NBS} to prevent entity conversion
protected _protect_characters ( $match ) : string
return string

auto_typography() public method

This function converts text, making it typographically correct: - Converts double spaces into paragraphs. - Converts single line breaks into
tags - Converts single and double quotes into correctly facing curly quote entities. - Converts three dots into ellipsis. - Converts double dashes into em-dashes. - Converts two spaces into entities
public auto_typography ( $str, $reduce_linebreaks = FALSE ) : string
return string

format_characters() public method

This function mainly converts double and single quotes to curly entities, but it also converts em-dashes, double spaces, and ampersands
public format_characters ( $str ) : string
return string

nl2br_except_pre() public method

Convert newlines to HTML line breaks except within PRE tags
public nl2br_except_pre ( $str ) : string
return string

Property Details

$block_elements public property

Block level elements that should not be wrapped inside

tags

public string $block_elements
return string

$inline_elements public property

Tags we want the parser to completely ignore when splitting the string.
public string $inline_elements
return string

$inner_block_required public property

array of block level elements that require inner content to be within another block level element
public array $inner_block_required
return array

$last_block_element public property

the last block element parsed
public string $last_block_element
return string

$protect_braced_quotes public property

whether or not to protect quotes within { curly braces }
public bool $protect_braced_quotes
return boolean

$skip_elements public property

Elements that should not have

and
tags within them.

public string $skip_elements
return string