## Class TTextHighlighter

Description

TTextHighlighter class.

TTextHighlighter does syntax highlighting its body content, including static text and rendering results of child controls. You can set Language to specify what kind of syntax the body content is. Currently, TTextHighlighter supports the following languages: 'php','prado','css','html','javascript' and 'xml', where 'prado' refers to PRADO template syntax. By setting ShowLineNumbers to true, the highlighted result may be shown with line numbers.

- since: 3.0
- version: $Revision: $ $Date: $
- author: Wei Zhuo<weizhuo[at]gmail[dot]com>

Located in /Web/UI/WebControls/TTextHighlighter.php (line 34)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TTextHighlighter

Method Summary
void addParsedObject (mixed $object)
boolean getEnableCopyCode ()
string getHeaderTemplate ()
string getLanguage ()
boolean getShowLineNumbers ()
string getTagName ()
string highlightText (string $text)
void onPreRender (THtmlWriter $writer)
void registerHighlightScripts ()
void renderContents (THtmlWriter $writer)
void setEnableCopyCode (boolean $value)
void setLanguage (string $value)
void setShowLineNumbers (boolean $value)
Methods
addParsedObject (line 95)

HTML-decodes static text.

This method overrides parent implementation.

- access: public

void addParsedObject (mixed $object)

- mixed $object: object to be added as body content

Redefinition of:

TControl::addParsedObject()
  Processes an object that is created during parsing template.

getEnableCopyCode (line 136)

- return: true will show "Copy Code" link. Defaults to false.
- access: public

boolean getEnableCopyCode ()
getHeaderTemplate (line 169)

- return: header template with "Copy code" link.
- access: protected

string getHeaderTemplate ()
getLanguage (line 47)

- return: language whose syntax is to be used for highlighting. Defaults to 'php'.
- access: public

string getLanguage ()
getShowLineNumbers (line 66)

- return: whether to show line numbers in the highlighted result.
- access: public

boolean getShowLineNumbers ()
getTagName (line 39)

- return: tag name of the panel
- access: protected

string getTagName ()

Redefinition of:

TWebControl::getTagName()
  Returns the tag name used for this control.

highlightText (line 154)

Returns the highlighted text.

- return: highlighted text.
- access: protected

string highlightText (string $text)

- string $text: text to highlight.

onPreRender (line 84)

Registers css style for the highlighted result.

This method overrides parent implementation.

- access: public

void onPreRender (THtmlWriter $writer)

- THtmlWriter $writer: writer

Redefinition of:

TControl::onPreRender()
  This method is invoked when the control enters 'OnPreRender' stage.

registerHighlightScripts (line 119)

Register CSS stylesheet file and javascript file.

- access: protected
- throws: TConfigurationException if highlight.css file cannot be found

void registerHighlightScripts ()
renderContents (line 108)

Renders body content.

This method overrides parent implementation by replacing the body content with syntax highlighted result.

- access: public

void renderContents (THtmlWriter $writer)

- THtmlWriter $writer: writer

Redefinition of:

TWebControl::renderContents()
  Renders the body content enclosed between the control tag.

setEnableCopyCode (line 144)

- access: public

void setEnableCopyCode (boolean $value)

- boolean $value: true to show the "Copy Code" link.

setLanguage (line 58)

- access: public

void setLanguage (string $value)

- string $value: language whose syntax is to be used for highlighting. Valid values are those file names (without suffix) that are contained in '3rdParty/geshi/geshi' (e.g. 'php','prado','css','html','javascript', 'xml'.)

setShowLineNumbers (line 74)

- access: public

void setShowLineNumbers (boolean $value)

- boolean $value: whether to show line numbers in the highlighted result.

#### Inherited Methods

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> TWebControl::getFont()
> TWebControl::getForeColor()
> TWebControl::getHasStyle()
> TWebControl::getHeight()
> TWebControl::getStyle()
> TWebControl::getTabIndex()
> TWebControl::getTagName()
> TWebControl::getToolTip()
> TWebControl::getWidth()
> TWebControl::render()
> TWebControl::renderBeginTag()
> TWebControl::renderContents()
> TWebControl::renderEndTag()
> TWebControl::setAccessKey()
> TWebControl::setBackColor()
> TWebControl::setBorderColor()
> TWebControl::setBorderStyle()
> TWebControl::setBorderWidth()
> TWebControl::setCssClass()
> TWebControl::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onBubbleEvent()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants

#### Inherited Constants

Inherited from TControl

Documentation generated on Mon, 01 May 2006 23:04:55 -0400 by phpDocumentor 1.3.0RC4