class Texy extends TexyObject

Texy! - Convert plain text to XHTML format using process().

$texy = new Texy();
$html = $texy->process($text);

Constants

ALL

NONE

VERSION

REVISION

CONTENT_MARKUP

CONTENT_REPLACED

CONTENT_TEXTUAL

CONTENT_BLOCK

FILTER_ANCHOR

FILTER_IMAGE

XML

HTML4_TRANSITIONAL

HTML4_STRICT

HTML5

XHTML1_TRANSITIONAL

XHTML1_STRICT

XHTML5

Properties

string $encoding
array $allowed
true|false|array $allowedTags
true|false|array $allowedClasses
true|false|array $allowedStyles
int $tabWidth
bool $obfuscateEmail
array $urlSchemeFilters
bool $mergeLines
array $summary
string $styleSheet
array $alignClasses
bool $removeSoftHyphens
static deprecated $advertisingNotice
string $nontextParagraph
TexyScriptModule $scriptModule
TexyParagraphModule $paragraphModule
TexyHtmlModule $htmlModule
TexyImageModule $imageModule
TexyLinkModule $linkModule
TexyPhraseModule $phraseModule
TexyEmoticonModule $emoticonModule
TexyBlockModule $blockModule
TexyHeadingModule $headingModule
TexyHorizLineModule $horizLineModule
TexyBlockQuoteModule $blockQuoteModule
TexyListModule $listModule
TexyTableModule $tableModule
TexyFigureModule $figureModule
TexyTypographyModule $typographyModule
TexyLongWordsModule $longWordsModule
TexyHtmlOutputModule $htmlOutputModule
array $_classes
array $_styles
array $dtd

DTD descriptor.

static $strictDTD DEPRECATED
$cleaner
$xhtml

Methods

__construct()

No description

void
setOutputMode($mode)

Set HTML/XHTML output mode (overwrites self::$allowedTags)

int
getOutputMode()

Get HTML/XHTML output mode

loadModules()

Create array of all used modules ($this->modules).

registerLinePattern($handler, $pattern, $name, $againTest = NULL)

No description

registerBlockPattern($handler, $pattern, $name)

No description

registerPostLine($handler, $name)

No description

string
process($text, $singleLine = FALSE)

Converts document in Texy! to (X)HTML code.

string
processLine($text)

Converts single line in Texy! to (X)HTML code.

string
processTypo($text)

Makes only typographic corrections.

string
toText()

Converts DOM structure to pure text.

string
stringToHtml($s)

Converts internal string representation to final HTML code in UTF-8.

string
stringToText($s)

Converts internal string representation to final HTML code in UTF-8.

void
addHandler($event, $callback)

Add new event handler.

mixed
invokeAroundHandlers($event, $parser, $args)

Invoke registered around-handlers.

void
invokeHandlers($event, $args)

Invoke registered after-handlers.

static string
freezeSpaces($s)

Translate all white spaces (\t \n \r space) to meta-spaces \x01-\x04.

static string
unfreezeSpaces($s)

Reverts meta-spaces back to normal spaces.

static string
normalize($s)

Removes special controls characters and normalizes line endings and spaces.

static string
webalize($s, $charlist = NULL)

Converts to web safe characters [a-z0-9-] text.

static string
escapeHtml($s)

Texy! version of htmlSpecialChars (much faster than htmlSpecialChars!).

static string
unescapeHtml($s)

Texy! version of html_entity_decode (always UTF-8, much faster than original!).

static string
outdent($s)

Outdents text block.

string
protect($child, $contentType)

Generate unique mark - useful for freezing (folding) some substrings.

unProtect($html)

No description

bool
checkURL($URL, $type)

Filters bad URLs.

static bool
isRelative($URL)

Is given URL relative?

static string
prependRoot($URL, $root)

Prepends root to URL, if possible.

getLinePatterns()

No description

getBlockPatterns()

No description

getDOM()

No description

tabCb($m)

No description

free()

PHP garbage collector helper.

__clone()

No description

Details

at line 215
__construct()

No description

at line 249
void setOutputMode($mode)

Set HTML/XHTML output mode (overwrites self::$allowedTags)

Parameters

$mode

Return Value

void

at line 278
int getOutputMode()

Get HTML/XHTML output mode

Return Value

int

at line 288
protected loadModules()

Create array of all used modules ($this->modules).

This array can be changed by overriding this method (by subclasses)

at line 315
final registerLinePattern($handler, $pattern, $name, $againTest = NULL)

No description

Parameters

$handler
$pattern
$name
$againTest

at line 334
final registerBlockPattern($handler, $pattern, $name)

No description

Parameters

$handler
$pattern
$name

at line 353
final registerPostLine($handler, $name)

No description

Parameters

$handler
$name

at line 375
string process($text, $singleLine = FALSE)

Converts document in Texy! to (X)HTML code.

Parameters

$text
$singleLine

Return Value

string

output HTML code

at line 459
string processLine($text)

Converts single line in Texy! to (X)HTML code.

Parameters

$text

Return Value

string

output HTML code

at line 470
string processTypo($text)

Makes only typographic corrections.

Parameters

$text

Return Value

string

output text (in UTF-8)

at line 493
string toText()

Converts DOM structure to pure text.

Return Value

string

at line 507
final string stringToHtml($s)

Converts internal string representation to final HTML code in UTF-8.

Parameters

$s

Return Value

string

at line 546
final string stringToText($s)

Converts internal string representation to final HTML code in UTF-8.

Parameters

$s

Return Value

string

at line 578
final void addHandler($event, $callback)

Add new event handler.

Parameters

$event
$callback

Return Value

void

at line 597
final mixed invokeAroundHandlers($event, $parser, $args)

Invoke registered around-handlers.

Parameters

$event
$parser
$args

Return Value

mixed

at line 617
final void invokeHandlers($event, $args)

Invoke registered after-handlers.

Parameters

$event
$args

Return Value

void

at line 635
final static string freezeSpaces($s)

Translate all white spaces (\t \n \r space) to meta-spaces \x01-\x04.

which are ignored by TexyHtmlOutputModule routine

Parameters

$s

Return Value

string

at line 646
final static string unfreezeSpaces($s)

Reverts meta-spaces back to normal spaces.

Parameters

$s

Return Value

string

at line 657
final static string normalize($s)

Removes special controls characters and normalizes line endings and spaces.

Parameters

$s

Return Value

string

at line 682
final static string webalize($s, $charlist = NULL)

Converts to web safe characters [a-z0-9-] text.

Parameters

$s
$charlist

Return Value

string

at line 698
final static string escapeHtml($s)

Texy! version of htmlSpecialChars (much faster than htmlSpecialChars!).

note: " is not encoded!

Parameters

$s

Return Value

string

at line 709
final static string unescapeHtml($s)

Texy! version of html_entity_decode (always UTF-8, much faster than original!).

Parameters

$s

Return Value

string

at line 723
final static string outdent($s)

Outdents text block.

Parameters

$s

Return Value

string

at line 743
final string protect($child, $contentType)

Generate unique mark - useful for freezing (folding) some substrings.

Parameters

$child
$contentType

Return Value

string

internal mark

at line 759
final unProtect($html)

No description

Parameters

$html

at line 771
final bool checkURL($URL, $type)

Filters bad URLs.

Parameters

$URL
$type

Return Value

bool

at line 785
final static bool isRelative($URL)

Is given URL relative?

Parameters

$URL

Return Value

bool

at line 798
final static string prependRoot($URL, $root)

Prepends root to URL, if possible.

Parameters

$URL
$root

Return Value

string

at line 807
final getLinePatterns()

No description

at line 813
final getBlockPatterns()

No description

at line 819
final getDOM()

No description

at line 826
tabCb($m)

internal  
 

No description

Parameters

$m

at line 835
final free()

PHP garbage collector helper.

at line 845
final __clone()

No description