[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_parsehtml_proc.php (sommaire)

Functions for parsing HTML, specially for TYPO3 processing in relation to TCEmain and Rich Text Editor (RTE) $Id: class.t3lib_parsehtml_proc.php 1984 2007-02-04 21:13:28Z mundaun $ Revised for TYPO3 3.6 December/2003 by Kasper Skaarhoj XHTML compatible.

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 1581 lignes (62 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_parsehtml_proc:: (28 méthodes):
  init()
  setRelPath()
  evalWriteFile()
  RTE_transform()
  TS_images_db()
  TS_images_rte()
  TS_reglinks()
  TS_links_db()
  TS_links_rte()
  TS_preserve_db()
  TS_preserve_rte()
  TS_transform_db()
  transformStyledATags()
  TS_transform_rte()
  TS_strip_db()
  getURL()
  HTMLcleaner_db()
  getKeepTags()
  divideIntoLines()
  setDivTags()
  internalizeFontTags()
  siteUrl()
  rteImageStorageDir()
  removeTables()
  defaultTStagMapping()
  getWHFromAttribs()
  urlInfoForLinkTags()
  TS_AtagToAbs()


Classe: t3lib_parsehtml_proc  - X-Ref

Class for parsing HTML for the Rich Text Editor. (also called transformations)

init($elRef='',$recPid=0)   X-Ref
Initialize, setting element reference and record PID

param: string        Element reference, eg "tt_content:bodytext"
param: integer        PID of the record (page id)
return: void

setRelPath($path)   X-Ref
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

param: string        The relative path from PATH_site to the place where the file being edited is. Eg. "fileadmin/static".
return: 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 "../../"

evalWriteFile($pArr,$currentRecord)   X-Ref
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()

param: array        Parameters for the current field as found in types-config
param: array        Current record we are editing.
return: mixed        On success an array with various information is returned, otherwise a string with an error message

RTE_transform($value,$specConf,$direction='rte',$thisConfig=array()   X-Ref
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

param: string        Input value
param: array        Special 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!
param: string        Direction 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.
param: array        Parsed TypoScript content configuring the RTE, probably coming from Page TSconfig.
return: string        Output value

TS_images_db($value)   X-Ref
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.

param: string        The content from RTE going to Database
return: string        Processed content

TS_images_rte($value)   X-Ref
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.

param: string        Content input
return: string        Content output

TS_reglinks($value,$direction)   X-Ref
Transformation handler: 'ts_reglinks' / direction: "db"+"rte" depending on $direction variable.
Converting <A>-tags to/from abs/rel

param: string        Content input
param: string        Direction of conversion; "rte" (from database to RTE) or "db" (from RTE to database)
return: string        Content output

TS_links_db($value)   X-Ref
Transformation handler: 'ts_links' / direction: "db"
Converting <A>-tags to <link tags>

param: string        Content input
return: string        Content output

TS_links_rte($value)   X-Ref
Transformation handler: 'ts_links' / direction: "rte"
Converting <link tags> to <A>-tags

param: string        Content input
return: string        Content output

TS_preserve_db($value)   X-Ref
Preserve special tags

param: string        Content input
return: string        Content output

TS_preserve_rte($value)   X-Ref
Preserve special tags

param: string        Content input
return: string        Content output

TS_transform_db($value,$css=FALSE)   X-Ref
Transformation handler: 'ts_transform' + 'css_transform' / direction: "db"
Cleaning (->db) for standard content elements (ts)

param: string        Content input
param: boolean        If true, the transformation was "css_transform", otherwise "ts_transform"
return: string        Content output

transformStyledATags($value)   X-Ref
Wraps a-tags that contain a style attribute with a span-tag

param: string        Content input
return: string        Content output

TS_transform_rte($value,$css=0)   X-Ref
Transformation handler: 'ts_transform' + 'css_transform' / direction: "rte"
Set (->rte) for standard content elements (ts)

param: string        Content input
param: boolean        If true, the transformation was "css_transform", otherwise "ts_transform"
return: string        Content output

TS_strip_db($value)   X-Ref
Transformation handler: 'ts_strip' / direction: "db"
Removing all non-allowed tags

param: string        Content input
return: string        Content output

getURL($url)   X-Ref
Reads the file or url $url and returns the content

param: string        Filepath/URL to read
return: string        The content from the resource given as input.

HTMLcleaner_db($content,$tagList='')   X-Ref
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

param: string        Content to clean up
param: string        Comma list of tags to specifically allow. Default comes from getKeepTags and is ""
return: string        Clean content

getKeepTags($direction='rte',$tagList='')   X-Ref
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)

param: string        The 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)
param: string        Comma list of tags to keep (overriding default which is to keep all + take notice of internal configuration)
return: array        Configuration array

divideIntoLines($value,$count=5,$returnArray=FALSE)   X-Ref
This resolves the $value into parts based on <div></div>-sections and <p>-sections and <br />-tags. These are returned as lines separated by chr(10).
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.

param: string        Value to process.
param: integer        Recursion brake. Decremented on each recursion down to zero. Default is 5 (which equals the allowed nesting levels of p/div tags).
param: boolean        If true, an array with the lines is returned, otherwise a string of the processed input value.
return: string        Processed input value.

setDivTags($value,$dT='p')   X-Ref
Converts all lines into <div></div>/<p></p>-sections (unless the line is a div-section already)
For processing of content going FROM database TO RTE.

param: string        Value to convert
param: string        Tag to wrap with. Either "p" or "div" should it be. Lowercase preferably.
return: string        Processed value.

internalizeFontTags($value)   X-Ref
This splits the $value in font-tag chunks.
If there are any <P>/<DIV> 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.

param: string        Input content
return: string        Output content

siteUrl()   X-Ref
Returns SiteURL based on thisScript.

return: string        Value of t3lib_div::getIndpEnv('TYPO3_SITE_URL');

rteImageStorageDir()   X-Ref
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.

return: string

removeTables($value,$breakChar='<br />')   X-Ref
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 <br /> chars. Thus at least the content is preserved in some way.

param: string        Input value
param: string        Break character to use for linebreaks.
return: string        Output value

defaultTStagMapping($code,$direction='rte')   X-Ref
Default tag mapping for TS

param: string        Input code to process
param: string        Direction To databsae (db) or from database to RTE (rte)
return: string        Processed value

getWHFromAttribs($attribArray)   X-Ref
Finds width and height from attrib-array
If the width and height is found in the style-attribute, use that!

param: array        Array 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
return: array        Integer w/h in key 0/1. Zero is returned if not found.

urlInfoForLinkTags($url)   X-Ref
Parse <A>-tag href and return status of email,external,file or page

param: string        URL to analyse.
return: array        Information in an array about the URL

TS_AtagToAbs($value,$dontSetRTEKEEP=FALSE)   X-Ref
Converting <A>-tags to absolute URLs (+ setting rtekeep attribute)

param: string        Content input
param: boolean        If true, then the "rtekeep" attribute will not be set.
return: string        Content output



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics