PHP 클래스 Text_Highlighter, yii

This class implements all functions necessary for highlighting, but it does not contain highlighting rules. Actual highlighting is done using a descendent of this class. One is not supposed to manually create descendent classes. Instead, describe highlighting rules in XML format and use {@link Text_Highlighter_Generator} to create descendent class. Alternatively, an instance of a descendent class can be created directly. Use {@link Text_Highlighter::factory()} to create an object for particular language highlighter Usage example require_once 'Text/Highlighter.php'; $hlSQL = Text_Highlighter::factory('SQL',array('numbers'=>true)); echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12');
저자: Andrey Demenev ([email protected])
파일 보기 프로젝트 열기: yiisoft/yii 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_conditions array Conditionds
$_disabled array Disabled keywords
$_language string Language
$_options array Options. Keeped for BC
$_renderer array Renderer object.
$_syntax array Auto-generated classes set this var

공개 메소드들

메소드 설명
_checkDefines ( ) Called by subclssses' constructors to enable/disable optional highlighter rules
_getToken ( )
_matchingBrackets ( $str ) Helper function to find matching brackets
factory ( string $lang, array $options = [] ) : mixed Create a new Highlighter object for specified language
highlight ( string $str ) : string Highlights code
setRenderer ( object $renderer ) Set renderer object

메소드 상세

_checkDefines() 공개 메소드

Called by subclssses' constructors to enable/disable optional highlighter rules
public _checkDefines ( )

_getToken() 공개 메소드

public _getToken ( )

_matchingBrackets() 공개 메소드

Helper function to find matching brackets
public _matchingBrackets ( $str )

factory() 공개 정적인 메소드

Create a new Highlighter object for specified language
public static factory ( string $lang, array $options = [] ) : mixed
$lang string language, for example "SQL"
$options array Rendering options. This parameter is only keeped for BC reasons, use {@link Text_Highlighter::setRenderer()} instead
리턴 mixed a newly created Highlighter object, or a PEAR error object on error

highlight() 공개 메소드

Highlights code
public highlight ( string $str ) : string
$str string Code to highlight
리턴 string Highlighted text

setRenderer() 공개 메소드

Set renderer object
public setRenderer ( object $renderer )
$renderer object Text_Highlighter_Renderer

프로퍼티 상세

$_conditions 공개적으로 프로퍼티

Conditionds
public array $_conditions
리턴 array

$_disabled 공개적으로 프로퍼티

Disabled keywords
public array $_disabled
리턴 array

$_language 공개적으로 프로퍼티

Language
public string $_language
리턴 string

$_options 공개적으로 프로퍼티

Options. Keeped for BC
public array $_options
리턴 array

$_renderer 공개적으로 프로퍼티

Renderer object.
public array $_renderer
리턴 array

$_syntax 공개적으로 프로퍼티

Auto-generated classes set this var
또한 보기: _init
public array $_syntax
리턴 array