(this page is translated by Google; We're working hard on a human translation)

Class Texy

Note: PHP 4 does not know the constants class. Therefore, instead of Texy::ALL , Texy::NONE use spare constants TEXY_ALL , TEXY_NONE .

variable type default description
$encoding string 'UTF-8' coding input and output text
$allowed mixed authorized "Texy syntax"
$allowedTags mixed valid tags Allowed HTML tags
$allowedClasses mixed Texy: ALL authorized by the CSS classes and IDs
$allowedStyles mixed Texy: ALL allowed CSS
$alignClasses array zeroed CSS classes for aligning text and images
$mergeLines boolean TRUE combine lines?
$tabWidth int 8 width due převední tabs to spaces
$obfuscateEmail boolean TRUE masking email addresses from robots?
$urlSchemeFilters array NULL
$styleSheet string NULL ready for user use

Variables $allowedTags , $allowedClasses and $allowedStyles can take values:

  • Texy::ALL - all are permitted or HTML tags. styles respectively. Class
  • Texy::NONE - but are all banned
  • array - the list of allowed values
    • $allowedTags - allowed the brand is key, as the examples below
    • $allowedClasses - list of classes and IDs, starting with the prefix ID #
    • $allowedStyles - list of CSS properties

Array $alignClasses define CSS classes for aligning text and images. More detail in the forum .

Texy lines connecting the following paragraphs in a row. This behavior can be disabled by setting the $texy->mergeLines = FALSE .

Choice of Output HTML / XHTML

The output format you choose using $texy->setOutputMode(format) . As a formát , type one of these constants:

Texy::HTML4_TRANSITIONAL HTML 4.0 Transitional, in Which deprecated Elements are Allowed
Texy::HTML4_STRICT HTML 4.0 Strict, in Which deprecated Elements are forbidden
Texy::HTML5 not supported yet
Texy::XHTML1_TRANSITIONAL XHTML 1.0 Transitional
Texy::XHTML1_STRICT XHTML 1.0 Strict
Texy::XHTML5 not supported yet

The default mode is Texy::XHTML1_TRANSITIONAL .

Examples

Only allow the HTML elements <strong>, <div>, <a> and some of their attributes:

 $texy ->allowedTags = array ( 
'strong' => Texy::NONE, // <strong> nesmí mít žádné attributy
'div' => Texy::ALL, // <div> může mít jakékoliv atributy
'a' => array ( 'href' , 'lang' , 'target' ), // <a> může mít jen tyto atributy
);

Disable all HTML tags:

 $texy ->allowedTags = Texy::NONE; 

Enable only the CSS class class1, class2 and CSS identifiers id1, id2

 $texy ->allowedClasses = array ( 'class1' , 'class2' , '#id1' , '#id2' ); 

Enable only the CSS property font-size, color, width

 $texy ->allowedStyles = array ( 'font-size' , 'color' , 'width' ); 

It is important to always set the correct encoding of input and output text

 $texy ->encoding = 'windows-1250' ; 

Rather than the direct style style="text-align:left" etc. Use Class class="left" , etc.

 $texy ->alignClasses[ 'left' ] = 'left' ; 
$texy ->alignClasses[ 'right' ] = 'right' ;
... // dále možno definovat: center, justify, top, bottom, middle