PHP Class Prado\Web\UI\WebControls\TTextHighlighter

TTextHighlighter does syntax highlighting its body content, including static text and rendering results of child controls. You can set {@link setLanguage Language} to specify what kind of syntax the body content is. Currently, TTextHighlighter supports the following languages: ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML and PRADO, where PRADO refers to PRADO template syntax. By setting {@link setShowLineNumbers ShowLineNumbers} to true, the highlighted result may be shown with line numbers. Note, TTextHighlighter requires {@link THead} to be placed on the page template because it needs to insert some CSS styles.
Since: 3.0
Inheritance: extends TTextProcessor
ファイルを表示 Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
getEnableCopyCode ( ) : boolean
getLanguage ( ) : string
getLineNumberStyle ( ) : TTextHighlighterLineNumberStyle
getShowLineNumbers ( ) : boolean
getTabSize ( ) : integer
onPreRender ( $writer ) Registers css style for the highlighted result.
processText ( $text ) : string Processes a text string.
render ( $writer )
setEnableCopyCode ( $value )
setLanguage ( $value )
setLineNumberStyle ( $value )
setShowLineNumbers ( $value )
setTabSize ( $value )

Protected Methods

Method Description
getHeaderTemplate ( ) : string
getTagName ( ) : string
registerStyleSheet ( ) Registers the stylesheet for presentation.

Method Details

getEnableCopyCode() public method

public getEnableCopyCode ( ) : boolean
return boolean true will show "Copy Code" link. Defaults to false.

getHeaderTemplate() protected method

protected getHeaderTemplate ( ) : string
return string header template with "Copy code" link.

getLanguage() public method

public getLanguage ( ) : string
return string language whose syntax is to be used for highlighting. Defaults to 'php'.

getLineNumberStyle() public method

public getLineNumberStyle ( ) : TTextHighlighterLineNumberStyle
return TTextHighlighterLineNumberStyle style of row number, Table by default

getShowLineNumbers() public method

public getShowLineNumbers ( ) : boolean
return boolean whether to show line numbers in the highlighted result.

getTabSize() public method

public getTabSize ( ) : integer
return integer tab size. Defaults to 4.

getTagName() protected method

protected getTagName ( ) : string
return string tag name of the panel

onPreRender() public method

This method overrides parent implementation.
public onPreRender ( $writer )

processText() public method

This method is required by the parent class.
public processText ( $text ) : string
return string the processed text result

registerStyleSheet() protected method

Registers the stylesheet for presentation.
protected registerStyleSheet ( )

render() public method

public render ( $writer )

setEnableCopyCode() public method

public setEnableCopyCode ( $value )

setLanguage() public method

public setLanguage ( $value )

setLineNumberStyle() public method

public setLineNumberStyle ( $value )

setShowLineNumbers() public method

public setShowLineNumbers ( $value )

setTabSize() public method

public setTabSize ( $value )