class Texy

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

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

Constants

VERSION

ALL

NONE

CONTENT_MARKUP

CONTENT_REPLACED

CONTENT_TEXTUAL

CONTENT_BLOCK

FILTER_ANCHOR

FILTER_IMAGE

deprecated HTML4_TRANSITIONAL

deprecated HTML4_STRICT

deprecated HTML5

deprecated XHTML1_TRANSITIONAL

deprecated XHTML1_STRICT

deprecated XHTML5

deprecated XML

Properties

array<string,bool> $allowed
bool|array<string,bool|array<int,string>> $allowedTags
bool|array<int,string> $allowedClasses
bool|array<int,string> $allowedStyles
$tabWidth

TAB width (for converting tabs to spaces)

$obfuscateEmail

Do obfuscate e-mail addresses?

(string)[] $urlSchemeFilters
$mergeLines

Paragraph merging mode

array<string,string[]> $summary
array<string,?string> $alignClasses
$removeSoftHyphens

remove soft hyphens (SHY)?

$nontextParagraph
$scriptModule
$paragraphModule
$htmlModule
$imageModule
$linkModule
$phraseModule
$emoticonModule
$blockModule
$headingModule
$horizLineModule
$blockQuoteModule
$listModule
$tableModule
$figureModule
$typographyModule
$longWordsModule
$htmlOutputModule

Methods

__construct()

No description

void
setOutputMode(int $mode) deprecated

No description

int
getOutputMode() deprecated

No description

void
loadModules()

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

void
registerLinePattern(callable $handler, string $pattern, string $name, string|null $againTest = null)

No description

void
registerBlockPattern(callable $handler, string $pattern, string $name)

No description

void
registerPostLine(callable $handler, string $name)

No description

string
process(string $text, bool $singleLine = false)

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

string
processLine(string $text)

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

string
processTypo(string $text)

Makes only typographic corrections.

string
toText()

Converts DOM structure to pure text.

string
stringToHtml(string $s)

Converts internal string representation to final HTML code.

string
stringToText(string $s)

Converts internal string representation to final HTML code.

void
addHandler(string $event, callable $callback)

Add new event handler.

mixed
invokeAroundHandlers(string $event, Parser $parser, array $args)

Invoke registered around-handlers.

void
invokeHandlers(string $event, array $args)

Invoke registered after-handlers.

string
protect(string $child, string $contentType)

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

bool
checkURL(string $URL, string $type)

Filters bad URLs.

string
unProtect(string $html)

No description

array
getLinePatterns()

No description

array
getBlockPatterns()

No description

getDOM()

No description

static array
getDTD()

No description

array
getAllowedProps()

No description

__clone()

No description

static string
freezeSpaces(string $s) deprecated

No description

static string
unfreezeSpaces(string $s) deprecated

No description

static string
normalize(string $s) deprecated

No description

static string
webalize(string $s, string $charlist = '') deprecated

No description

static string
escapeHtml(string $s) deprecated

No description

static string
unescapeHtml(string $s) deprecated

No description

static string
outdent(string $s) deprecated

No description

static bool
isRelative(string $URL) deprecated

No description

static string
prependRoot(string $URL, string $root) deprecated

No description

Details

at line 185
__construct()

No description

at line 229
void setOutputMode(int $mode) deprecated

deprecated

No description

Parameters

int $mode

Return Value

void

at line 236
int getOutputMode() deprecated

deprecated

No description

Return Value

int

at line 247
protected void loadModules()

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

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

Return Value

void

at line 274
final void registerLinePattern(callable $handler, string $pattern, string $name, string|null $againTest = null)

No description

Parameters

callable $handler
string $pattern
string $name
string|null $againTest

Return Value

void

at line 292
final void registerBlockPattern(callable $handler, string $pattern, string $name)

No description

Parameters

callable $handler
string $pattern
string $name

Return Value

void

at line 306
final void registerPostLine(callable $handler, string $name)

No description

Parameters

callable $handler
string $name

Return Value

void

at line 319
string process(string $text, bool $singleLine = false)

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

Parameters

string $text
bool $singleLine

Return Value

string

at line 398
string processLine(string $text)

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

Parameters

string $text

Return Value

string

at line 407
string processTypo(string $text)

Makes only typographic corrections.

Parameters

string $text

Return Value

string

at line 426
string toText()

Converts DOM structure to pure text.

Return Value

string

at line 439
final string stringToHtml(string $s)

Converts internal string representation to final HTML code.

Parameters

string $s

Return Value

string

at line 480
final string stringToText(string $s)

Converts internal string representation to final HTML code.

Parameters

string $s

Return Value

string

at line 505
final void addHandler(string $event, callable $callback)

Add new event handler.

Parameters

string $event
callable $callback

Return Value

void

at line 514
final mixed invokeAroundHandlers(string $event, Parser $parser, array $args)

Invoke registered around-handlers.

Parameters

string $event
Parser $parser
array $args

Return Value

mixed

at line 528
final void invokeHandlers(string $event, array $args)

Invoke registered after-handlers.

Parameters

string $event
array $args

Return Value

void

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

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

Parameters

string $child
string $contentType

Return Value

string

at line 563
final bool checkURL(string $URL, string $type)

Filters bad URLs.

Parameters

string $URL
string $type

Texy::FILTER_ANCHOR | Texy::FILTER_IMAGE

Return Value

bool

at line 572
final string unProtect(string $html)

No description

Parameters

string $html

Return Value

string

at line 579
final array getLinePatterns()

No description

Return Value

array

at line 586
final array getBlockPatterns()

No description

Return Value

array

at line 592
final HtmlElement getDOM()

No description

Return Value

HtmlElement

at line 602
static array getDTD()

internal  
 

No description

Return Value

array

at line 609
final array getAllowedProps()

internal  
 

No description

Return Value

array

at line 615
final __clone()

No description

at line 622
final static string freezeSpaces(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 630
final static string unfreezeSpaces(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 638
final static string normalize(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 646
final static string webalize(string $s, string $charlist = '') deprecated

deprecated

No description

Parameters

string $s
string $charlist

Return Value

string

at line 654
final static string escapeHtml(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 662
final static string unescapeHtml(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 670
final static string outdent(string $s) deprecated

deprecated

No description

Parameters

string $s

Return Value

string

at line 678
final static bool isRelative(string $URL) deprecated

deprecated

No description

Parameters

string $URL

Return Value

bool

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

deprecated

No description

Parameters

string $URL
string $root

Return Value

string

Traits

Better OOP experience.