TYPO3CMS  4.5
 All Classes Namespaces Files Functions Variables Pages
t3lib_parsehtml_proc Class Reference
Inheritance diagram for t3lib_parsehtml_proc:
t3lib_parsehtml

Public Member Functions

 init ($elRef= '', $recPid=0)
 
 setRelPath ($path)
 
 evalWriteFile ($pArr, $currentRecord)
 
 RTE_transform ($value, $specConf, $direction= 'rte', $thisConfig=array())
 
 TS_images_db ($value)
 
 TS_images_rte ($value)
 
 TS_reglinks ($value, $direction)
 
 TS_links_db ($value)
 
 TS_links_rte ($value)
 
 TS_preserve_db ($value)
 
 TS_preserve_rte ($value)
 
 TS_transform_db ($value, $css=FALSE)
 
 transformStyledATags ($value)
 
 TS_transform_rte ($value, $css=0)
 
 TS_strip_db ($value)
 
 getURL ($url)
 
 HTMLcleaner_db ($content, $tagList= '')
 
 getKeepTags ($direction= 'rte', $tagList= '')
 
 divideIntoLines ($value, $count=5, $returnArray=FALSE)
 
 setDivTags ($value, $dT= 'p')
 
 internalizeFontTags ($value)
 
 siteUrl ()
 
 rteImageStorageDir ()
 
 removeTables ($value, $breakChar= '< br/>')
 
 defaultTStagMapping ($code, $direction= 'rte')
 
 getWHFromAttribs ($attribArray)
 
 urlInfoForLinkTags ($url)
 
 TS_AtagToAbs ($value, $dontSetRTEKEEP=FALSE)
 
- Public Member Functions inherited from t3lib_parsehtml
 splitIntoBlock ($tag, $content, $eliminateExtraEndTags=0)
 
 splitIntoBlockRecursiveProc ($tag, $content, &$procObj, $callBackContent, $callBackTags, $level=0)
 
 splitTags ($tag, $content)
 
 getAllParts ($parts, $tag_parts=1, $include_tag=1)
 
 removeFirstAndLastTag ($str)
 
 getFirstTag ($str)
 
 getFirstTagName ($str, $preserveCase=FALSE)
 
 get_tag_attributes ($tag, $deHSC=0)
 
 split_tag_attributes ($tag)
 
 checkTagTypeCounts ($content, $blockTags= 'a, b, blockquote, body, div, em, font, form, h1, h2, h3, h4, h5, h6, i, li, map, ol, option, p, pre, select, span, strong, table, td, textarea, tr, u, ul', $soloTags= 'br, hr, img, input, area')
 
 HTMLcleaner ($content, $tags=array(), $keepAll=0, $hSC=0, $addConfig=array())
 
 bidir_htmlspecialchars ($value, $dir)
 
 prefixResourcePath ($main_prefix, $content, $alternatives=array(), $suffix= '')
 
 prefixRelPath ($prefix, $srcVal, $suffix= '')
 
 cleanFontTags ($value, $keepFace=0, $keepSize=0, $keepColor=0)
 
 mapTags ($value, $tags=array(), $ltChar= '<', $ltChar2= '<')
 
 unprotectTags ($content, $tagList= '')
 
 stripTagsExcept ($value, $tagList)
 
 caseShift ($str, $flag, $cacheKey= '')
 
 compileTagAttribs ($tagAttrib, $meta=array(), $xhtmlClean=0)
 
 get_tag_attributes_classic ($tag, $deHSC=0)
 
 indentLines ($content, $number=1, $indentChar=TAB)
 
 HTMLparserConfig ($TSconfig, $keepTags=array())
 
 XHTML_clean ($content)
 
 processTag ($value, $conf, $endTag, $protected=0)
 
 processContent ($value, $dir, $conf)
 

Public Attributes

 $blockElementList = 'PRE,UL,OL,H1,H2,H3,H4,H5,H6,ADDRESS,DL,DD'
 
 $recPid = 0
 
 $elRef = ''
 
 $relPath = ''
 
 $relBackPath = ''
 
 $tsConfig = array()
 
 $procOptions = array()
 
 $TS_transform_db_safecounter = 100
 
 $rte_p = ''
 
 $getKeepTags_cache = array()
 
 $allowedClasses = array()
 
 $preserveTags = ''
 
- Public Attributes inherited from t3lib_parsehtml
const VOID_ELEMENTS = 'area|base|br|col|command|embed|hr|img|input|keygen|meta|param|source|track|wbr'
 

Additional Inherited Members

- Static Public Member Functions inherited from t3lib_parsehtml
static getSubpart ($content, $marker)
 
static substituteSubpart ($content, $marker, $subpartContent, $recursive=1, $keepMarker=0)
 
static substituteSubpartArray ($content, array $subpartsContent)
 
static substituteMarker ($content, $marker, $markContent)
 
static substituteMarkerArray ($content, $markContentArray, $wrap= '', $uppercase=0, $deleteUnused=0)
 
- Protected Attributes inherited from t3lib_parsehtml
 $caseShift_cache = array()
 

Detailed Description

Definition at line 91 of file class.t3lib_parsehtml_proc.php.

Member Function Documentation

defaultTStagMapping (   $code,
  $direction = 'rte' 
)

Default tag mapping for TS

Parameters
stringInput code to process
stringDirection To databsae (db) or from database to RTE (rte)
Returns
string Processed value

Definition at line 1511 of file class.t3lib_parsehtml_proc.php.

References t3lib_parsehtml\mapTags().

Referenced by TS_transform_db().

divideIntoLines (   $value,
  $count = 5,
  $returnArray = FALSE 
)

This resolves the $value into parts based on

-sections and

-sections and
-tags. These are returned as lines separated by LF. This point is to resolve the HTML-code returned from RTE into ordinary lines so it's 'human-readable' The function ->setDivTags does the opposite. This function processes content to go into the database.

Parameters
stringValue to process.
integerRecursion brake. Decremented on each recursion down to zero. Default is 5 (which equals the allowed nesting levels of p/div tags).
booleanIf true, an array with the lines is returned, otherwise a string of the processed input value.
Returns
string Processed input value.
See also
setDivTags()

Definition at line 1236 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\compileTagAttribs(), CR, t3lib_parsehtml\get_tag_attributes(), t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\getFirstTagName(), HTMLcleaner_db(), internalizeFontTags(), LF, t3lib_parsehtml\removeFirstAndLastTag(), t3lib_parsehtml\splitIntoBlock(), and t3lib_div\trimExplode().

Referenced by TS_transform_db().

evalWriteFile (   $pArr,
  $currentRecord 
)

Evaluate the environment for editing a staticFileEdit file. Called for almost all fields being saved in the database. Is called without an instance of the object: t3lib_parsehtml_proc::evalWriteFile()

Parameters
arrayParameters for the current field as found in types-config
arrayCurrent record we are editing.
Returns
mixed On success an array with various information is returned, otherwise a string with an error message
See also
t3lib_TCEmain, t3lib_transferData

Definition at line 155 of file class.t3lib_parsehtml_proc.php.

References $GLOBALS, PATH_site, and t3lib_div\validPathStr().

Referenced by t3lib_TCEmain\fillInFieldArray(), and t3lib_transferData\renderRecord_typesProc().

getKeepTags (   $direction = 'rte',
  $tagList = '' 
)

Creates an array of configuration for the HTMLcleaner function based on whether content go TO or FROM the Rich Text Editor ($direction) Unless "tagList" is given, the function will cache the configuration for next time processing goes on. (In this class that is the case only if we are processing a bulletlist)

Parameters
stringThe direction of the content being processed by the output configuration; "db" (content going into the database FROM the rte) or "rte" (content going into the form)
stringComma list of tags to keep (overriding default which is to keep all + take notice of internal configuration)
Returns
array Configuration array
See also
HTMLcleaner_db()

Definition at line 1105 of file class.t3lib_parsehtml_proc.php.

References t3lib_parsehtml\HTMLparserConfig(), and t3lib_div\trimExplode().

Referenced by HTMLcleaner_db(), and setDivTags().

getURL (   $url)

Reads the file or url $url and returns the content

Parameters
stringFilepath/URL to read
Returns
string The content from the resource given as input.
See also
t3lib_div::getURL()

Definition at line 1064 of file class.t3lib_parsehtml_proc.php.

References t3lib_div\getURL().

getWHFromAttribs (   $attribArray)

Finds width and height from attrib-array If the width and height is found in the style-attribute, use that!

Parameters
arrayArray of attributes from tag in which to search. More specifically the content of the key "style" is used to extract "width:xxx / height:xxx" information
Returns
array Integer w/h in key 0/1. Zero is returned if not found.

Definition at line 1534 of file class.t3lib_parsehtml_proc.php.

Referenced by TS_images_db().

HTMLcleaner_db (   $content,
  $tagList = '' 
)

Function for cleaning content going into the database. Content is cleaned eg. by removing unallowed HTML and ds-HSC content It is basically calling HTMLcleaner from the parent class with some preset configuration specifically set up for cleaning content going from the RTE into the db

Parameters
stringContent to clean up
stringComma list of tags to specifically allow. Default comes from getKeepTags and is ""
Returns
string Clean content
See also
getKeepTags()

Definition at line 1078 of file class.t3lib_parsehtml_proc.php.

References $content, getKeepTags(), and t3lib_parsehtml\HTMLcleaner().

Referenced by divideIntoLines(), and TS_transform_db().

init (   $elRef = '',
  $recPid = 0 
)

Initialize, setting element reference and record PID

Parameters
stringElement reference, eg "tt_content:bodytext"
integerPID of the record (page id)
Returns
void

Definition at line 119 of file class.t3lib_parsehtml_proc.php.

References $elRef, and $recPid.

internalizeFontTags (   $value)

This splits the $value in font-tag chunks. If there are any

/

sections inside of them, the font-tag is wrapped AROUND the content INSIDE of the P/DIV sections and the outer font-tag is removed. This functions seems to be a good choice for pre-processing content if it has been pasted into the RTE from eg. star-office. In that case the font-tags are normally on the OUTSIDE of the sections. This function is used by eg. divideIntoLines() if the procesing option 'internalizeFontTags' is set.
Parameters
stringInput content
Returns
string Output content
See also
divideIntoLines()

Definition at line 1421 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\getFirstTagName(), t3lib_parsehtml\removeFirstAndLastTag(), and t3lib_parsehtml\splitIntoBlock().

Referenced by divideIntoLines().

removeTables (   $value,
  $breakChar = '<br />' 
)

Remove all tables from incoming code The function is trying to to this is some more or less respectfull way. The approach is to resolve each table cells content and implode it all by
chars. Thus at least the content is preserved in some way.

Parameters
stringInput value
stringBreak character to use for linebreaks.
Returns
string Output value

Definition at line 1479 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\getAllParts(), and t3lib_parsehtml\splitIntoBlock().

Referenced by TS_transform_db().

RTE_transform (   $value,
  $specConf,
  $direction = 'rte',
  $thisConfig = array() 
)

Transform value for RTE based on specConf in the direction specified by $direction (rte/db) This is the main function called from tcemain and transfer data classes

Parameters
stringInput value
arraySpecial configuration for a field; This is coming from the types-configuration of the field in the TCA. In the types-configuration you can setup features for the field rendering and in particular the RTE takes al its major configuration options from there!
stringDirection of the transformation. Two keywords are allowed; "db" or "rte". If "db" it means the transformation will clean up content coming from the Rich Text Editor and goes into the database. The other direction, "rte", is of course when content is coming from database and must be transformed to fit the RTE.
arrayParsed TypoScript content configuring the RTE, probably coming from Page TSconfig.
Returns
string Output value
See also
t3lib_TCEmain::fillInFieldArray(), t3lib_transferData::renderRecord_typesProc()

Definition at line 208 of file class.t3lib_parsehtml_proc.php.

References $GLOBALS, $value, CR, CRLF, t3lib_BEfunc\getSpecConfParametersFromArray(), t3lib_div\getUserObj(), t3lib_parsehtml\HTMLcleaner(), t3lib_parsehtml\HTMLparserConfig(), LF, t3lib_div\trimExplode(), TS_images_db(), TS_images_rte(), TS_links_db(), TS_links_rte(), TS_preserve_db(), TS_preserve_rte(), TS_reglinks(), TS_strip_db(), TS_transform_db(), and TS_transform_rte().

rteImageStorageDir ( )

Return the storage folder of RTE image files. Default is $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] unless something else is configured in the types configuration for the RTE.

Returns
string

Definition at line 1467 of file class.t3lib_parsehtml_proc.php.

References $GLOBALS.

Referenced by TS_images_db().

setDivTags (   $value,
  $dT = 'p' 
)

Converts all lines into

/

-sections (unless the line is a div-section already) For processing of content going FROM database TO RTE.

Parameters
stringValue to convert
stringTag to wrap with. Either "p" or "div" should it be. Lowercase preferably.
Returns
string Processed value.
See also
divideIntoLines()

Definition at line 1372 of file class.t3lib_parsehtml_proc.php.

References $value, getKeepTags(), t3lib_parsehtml\HTMLcleaner(), and LF.

Referenced by TS_transform_rte().

setRelPath (   $path)

Setting the ->relPath and ->relBackPath to proper values so absolute references to links and images can be converted to relative dittos. This is used when editing files with the RTE

Parameters
stringThe relative path from PATH_site to the place where the file being edited is. Eg. "fileadmin/static".
Returns
void There is no output, it is set in internal variables. With the above example of "fileadmin/static" as input this will yield ->relPath to be "fileadmin/static/" and ->relBackPath to be "../../"

Definition at line 131 of file class.t3lib_parsehtml_proc.php.

siteUrl ( )

Returns SiteURL based on thisScript.

Returns
string Value of t3lib_div::getIndpEnv('TYPO3_SITE_URL');
See also
t3lib_div::getIndpEnv()

Definition at line 1457 of file class.t3lib_parsehtml_proc.php.

References t3lib_div\getIndpEnv().

Referenced by TS_AtagToAbs(), TS_images_db(), TS_images_rte(), TS_links_db(), TS_links_rte(), TS_reglinks(), and urlInfoForLinkTags().

transformStyledATags (   $value)

Wraps a-tags that contain a style attribute with a span-tag

Parameters
stringContent input
Returns
string Content output

Definition at line 937 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_div\implodeAttributes(), t3lib_parsehtml\removeFirstAndLastTag(), and t3lib_parsehtml\splitIntoBlock().

Referenced by TS_transform_db().

TS_AtagToAbs (   $value,
  $dontSetRTEKEEP = FALSE 
)

Converting -tags to absolute URLs (+ setting rtekeep attribute)

Parameters
stringContent input
booleanIf true, then the "rtekeep" attribute will not be set.
Returns
string Content output

Definition at line 1624 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_div\implodeAttributes(), t3lib_parsehtml\removeFirstAndLastTag(), siteUrl(), and t3lib_parsehtml\splitIntoBlock().

Referenced by TS_links_rte(), and TS_reglinks().

TS_images_db (   $value)

Transformation handler: 'ts_images' / direction: "db" Processing images inserted in the RTE. This is used when content goes from the RTE to the database. Images inserted in the RTE has an absolute URL applied to the src attribute. This URL is converted to a relative URL If it turns out that the URL is from another website than the current the image is read from that external URL and moved to the local server. Also "magic" images are processed here.

Parameters
stringThe content from RTE going to Database
Returns
string Processed content

Definition at line 371 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_div\getFileAbsFileName(), t3lib_div\getIndpEnv(), getWHFromAttribs(), t3lib_div\implodeAttributes(), t3lib_div\inList(), t3lib_div\isFirstPartOfStr(), t3lib_div\makeInstance(), PATH_site, rteImageStorageDir(), t3lib_div\shortMD5(), siteUrl(), t3lib_parsehtml\splitTags(), and t3lib_div\writeFile().

Referenced by RTE_transform().

TS_images_rte (   $value)

Transformation handler: 'ts_images' / direction: "rte" Processing images from database content going into the RTE. Processing includes converting the src attribute to an absolute URL.

Parameters
stringContent input
Returns
string Content output

Definition at line 530 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_div\getIndpEnv(), t3lib_div\implodeAttributes(), siteUrl(), and t3lib_parsehtml\splitTags().

Referenced by RTE_transform().

TS_links_db (   $value)

Transformation handler: 'ts_links' / direction: "db" Converting -tags to <link tags>="">

Parameters
stringContent input
Returns
string Content output
See also
TS_links_rte()

Definition at line 607 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_div\implodeAttributes(), t3lib_parsehtml\removeFirstAndLastTag(), siteUrl(), t3lib_parsehtml\splitIntoBlock(), and urlInfoForLinkTags().

Referenced by RTE_transform().

TS_links_rte (   $value)

Transformation handler: 'ts_links' / direction: "rte" Converting <link tags>=""> to -tags

Parameters
stringContent input
Returns
string Content output
See also
TS_links_rte()

Definition at line 665 of file class.t3lib_parsehtml_proc.php.

References $GLOBALS, $recPid, $value, t3lib_parsehtml\getFirstTag(), t3lib_BEfunc\getRecord(), t3lib_BEfunc\getRecordsByField(), t3lib_div\inList(), PATH_site, t3lib_parsehtml\removeFirstAndLastTag(), siteUrl(), t3lib_parsehtml\splitIntoBlock(), t3lib_div\testInt(), t3lib_div\trimExplode(), TS_AtagToAbs(), and t3lib_div\unQuoteFilenames().

Referenced by RTE_transform().

TS_preserve_db (   $value)

Preserve special tags

Parameters
stringContent input
Returns
string Content output

Definition at line 754 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\getFirstTagName(), t3lib_parsehtml\removeFirstAndLastTag(), and t3lib_parsehtml\splitIntoBlock().

Referenced by RTE_transform().

TS_preserve_rte (   $value)

Preserve special tags

Parameters
stringContent input
Returns
string Content output

Definition at line 780 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\removeFirstAndLastTag(), and t3lib_parsehtml\splitIntoBlock().

Referenced by RTE_transform().

TS_reglinks (   $value,
  $direction 
)

Transformation handler: 'ts_reglinks' / direction: "db"+"rte" depending on $direction variable. Converting -tags to/from abs/rel

Parameters
stringContent input
stringDirection of conversion; "rte" (from database to RTE) or "db" (from RTE to database)
Returns
string Content output

Definition at line 571 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_div\implodeAttributes(), t3lib_parsehtml\removeFirstAndLastTag(), siteUrl(), t3lib_parsehtml\splitIntoBlock(), and TS_AtagToAbs().

Referenced by RTE_transform().

TS_strip_db (   $value)

Transformation handler: 'ts_strip' / direction: "db" Removing all non-allowed tags

Parameters
stringContent input
Returns
string Content output

Definition at line 1045 of file class.t3lib_parsehtml_proc.php.

References $value.

Referenced by RTE_transform().

TS_transform_db (   $value,
  $css = FALSE 
)

Transformation handler: 'ts_transform' + 'css_transform' / direction: "db" Cleaning (->db) for standard content elements (ts)

Parameters
stringContent input
booleanIf true, the transformation was "css_transform", otherwise "ts_transform"
Returns
string Content output
See also
TS_transform_rte()

Definition at line 803 of file class.t3lib_parsehtml_proc.php.

References $value, t3lib_parsehtml\cleanFontTags(), CR, defaultTStagMapping(), divideIntoLines(), t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getAllParts(), t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\getFirstTagName(), HTMLcleaner_db(), LF, t3lib_parsehtml\removeFirstAndLastTag(), removeTables(), t3lib_parsehtml\splitIntoBlock(), and transformStyledATags().

Referenced by RTE_transform().

TS_transform_rte (   $value,
  $css = 0 
)

Transformation handler: 'ts_transform' + 'css_transform' / direction: "rte" Set (->rte) for standard content elements (ts)

Parameters
stringContent input
booleanIf true, the transformation was "css_transform", otherwise "ts_transform"
Returns
string Content output
See also
TS_transform_db()

Definition at line 964 of file class.t3lib_parsehtml_proc.php.

References $blockElementList, $value, t3lib_parsehtml\get_tag_attributes_classic(), t3lib_parsehtml\getFirstTag(), t3lib_parsehtml\getFirstTagName(), t3lib_div\inList(), t3lib_div\intInRange(), LF, t3lib_parsehtml\removeFirstAndLastTag(), setDivTags(), and t3lib_parsehtml\splitIntoBlock().

Referenced by RTE_transform().

urlInfoForLinkTags (   $url)

Parse -tag href and return status of email,external,file or page

Parameters
stringURL to analyse.
Returns
array Information in an array about the URL

Definition at line 1561 of file class.t3lib_parsehtml_proc.php.

References siteUrl(), and TYPO3_mainDir.

Referenced by TS_links_db().

Member Data Documentation

$allowedClasses = array()

Definition at line 108 of file class.t3lib_parsehtml_proc.php.

$blockElementList = 'PRE,UL,OL,H1,H2,H3,H4,H5,H6,ADDRESS,DL,DD'

Definition at line 94 of file class.t3lib_parsehtml_proc.php.

Referenced by TS_transform_rte().

$elRef = ''

Definition at line 98 of file class.t3lib_parsehtml_proc.php.

Referenced by init().

$getKeepTags_cache = array()

Definition at line 107 of file class.t3lib_parsehtml_proc.php.

$preserveTags = ''

Definition at line 109 of file class.t3lib_parsehtml_proc.php.

$procOptions = array()

Definition at line 102 of file class.t3lib_parsehtml_proc.php.

$recPid = 0

Definition at line 97 of file class.t3lib_parsehtml_proc.php.

Referenced by init(), and TS_links_rte().

$relBackPath = ''

Definition at line 100 of file class.t3lib_parsehtml_proc.php.

$relPath = ''

Definition at line 99 of file class.t3lib_parsehtml_proc.php.

$rte_p = ''

Definition at line 106 of file class.t3lib_parsehtml_proc.php.

$TS_transform_db_safecounter = 100

Definition at line 105 of file class.t3lib_parsehtml_proc.php.

$tsConfig = array()

Definition at line 101 of file class.t3lib_parsehtml_proc.php.