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 213
__construct()

No description

at line 256
void setOutputMode($mode)

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

Parameters

$mode

Return Value

void

at line 285
int getOutputMode()

Get HTML/XHTML output mode

Return Value

int

at line 295
protected loadModules()

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

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

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

No description

Parameters

$handler
$pattern
$name
$againTest

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

No description

Parameters

$handler
$pattern
$name

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

No description

Parameters

$handler
$name

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

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

Parameters

$text
$singleLine

Return Value

string

output HTML code

at line 466
string processLine($text)

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

Parameters

$text

Return Value

string

output HTML code

at line 477
string processTypo($text)

Makes only typographic corrections.

Parameters

$text

Return Value

string

output text (in UTF-8)

at line 500
string toText()

Converts DOM structure to pure text.

Return Value

string

at line 514
final string stringToHtml($s)

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

Parameters

$s

Return Value

string

at line 554
final string stringToText($s)

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

Parameters

$s

Return Value

string

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

Add new event handler.

Parameters

$event
$callback

Return Value

void

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

Invoke registered around-handlers.

Parameters

$event
$parser
$args

Return Value

mixed

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

Invoke registered after-handlers.

Parameters

$event
$args

Return Value

void

at line 643
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 654
final static string unfreezeSpaces($s)

Reverts meta-spaces back to normal spaces.

Parameters

$s

Return Value

string

at line 665
final static string normalize($s)

Removes special controls characters and normalizes line endings and spaces.

Parameters

$s

Return Value

string

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

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

Parameters

$s
$charlist

Return Value

string

at line 706
final static string escapeHtml($s)

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

note: " is not encoded!

Parameters

$s

Return Value

string

at line 717
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 731
final static string outdent($s)

Outdents text block.

Parameters

$s

Return Value

string

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

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

Parameters

$child
$contentType

Return Value

string

internal mark

at line 767
final unProtect($html)

No description

Parameters

$html

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

Filters bad URLs.

Parameters

$URL
$type

Return Value

bool

at line 793
final static bool isRelative($URL)

Is given URL relative?

Parameters

$URL

Return Value

bool

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

Prepends root to URL, if possible.

Parameters

$URL
$root

Return Value

string

at line 815
final getLinePatterns()

No description

at line 821
final getBlockPatterns()

No description

at line 827
final getDOM()

No description

at line 834
tabCb($m)

internal  
 

No description

Parameters

$m

at line 843
final free()

PHP garbage collector helper.

at line 853
final __clone()

No description