class Texy

Texy! - Convert plain text to HTML format using {@link process()}.

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

Traits

Better OOP experience.

Constants

VERSION

ALL

NONE

CONTENT_MARKUP

CONTENT_REPLACED

CONTENT_TEXTUAL

CONTENT_BLOCK

FILTER_ANCHOR

FILTER_IMAGE

HTML4_TRANSITIONAL

HTML4_STRICT

HTML5

XHTML1_TRANSITIONAL

XHTML1_STRICT

XHTML5

XML

Properties

array $allowed
bool|array $allowedTags
bool|array $allowedClasses
bool|array $allowedStyles
int $tabWidth
bool $obfuscateEmail
array|string> $urlSchemeFilters
bool $mergeLines
array $summary
array $alignClasses
bool $removeSoftHyphens
string|HtmlElement $nontextParagraph
ScriptModule $scriptModule
ParagraphModule $paragraphModule
HtmlModule $htmlModule
ImageModule $imageModule
LinkModule $linkModule
PhraseModule $phraseModule
EmoticonModule $emoticonModule
BlockModule $blockModule
HeadingModule $headingModule
HorizLineModule $horizLineModule
BlockQuoteModule $blockQuoteModule
ListModule $listModule
TableModule $tableModule
FigureModule $figureModule
TypographyModule $typographyModule
LongWordsModule $longWordsModule
HtmlOutputModule $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 $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 205
__construct()

at line 245
void setOutputMode(int $mode) deprecated

deprecated

Parameters

int $mode

Return Value

void

at line 252
int getOutputMode() deprecated

deprecated

Return Value

int

at line 263
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 290
final void registerLinePattern(callable $handler, string $pattern, string $name, string $againTest = null)

Parameters

callable $handler
string $pattern
string $name
string $againTest

Return Value

void

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

Parameters

callable $handler
string $pattern
string $name

Return Value

void

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

Parameters

callable $handler
string $name

Return Value

void

at line 331
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 411
string processLine(string $text)

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

Parameters

string $text

Return Value

string

at line 420
string processTypo(string $text)

Makes only typographic corrections.

Parameters

string $text

Return Value

string

at line 439
string toText()

Converts DOM structure to pure text.

Return Value

string

at line 452
final string stringToHtml(string $s)

Converts internal string representation to final HTML code.

Parameters

string $s

Return Value

string

at line 491
final string stringToText(string $s)

Converts internal string representation to final HTML code.

Parameters

string $s

Return Value

string

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

Add new event handler.

Parameters

string $event
callable $callback

Return Value

void

at line 526
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 540
final void invokeHandlers(string $event, array $args)

Invoke registered after-handlers.

Parameters

string $event
array $args

Return Value

void

at line 555
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 575
final bool checkURL(string $URL, string $type)

Filters bad URLs.

Parameters

string $URL
string $type

Return Value

bool

at line 584
final string unProtect(string $html)

Parameters

string $html

Return Value

string

at line 591
final array getLinePatterns()

Return Value

array array{handler: callable, pattern: string, again: ?string}>

at line 598
final array getBlockPatterns()

Return Value

array array{handler: callable, pattern: string}>

at line 604
final HtmlElement getDOM()

Return Value

HtmlElement

at line 614
static array getDTD()

Return Value

array array{array<string, int>, array<string, int>}>

at line 621
final array getAllowedProps()

Return Value

array

at line 627
final __clone()

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $s
string $charlist

Return Value

string

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $s

Return Value

string

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

deprecated

Parameters

string $URL

Return Value

bool

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

deprecated

Parameters

string $URL
string $root

Return Value

string