framework/web/widgets/CTextHighlighter.php
public function highlight($content)
	{
		$this->registerClientScript();

		$options['use_language']=true;
		$options['tabsize']=$this->tabSize;
		if($this->showLineNumbers)
			$options['numbers']=($this->lineNumberStyle==='list')?HL_NUMBERS_LI:HL_NUMBERS_TABLE;

		$highlighter=empty($this->language)?false:Text_Highlighter::factory($this->language);
		if($highlighter===false)
			$o='<pre>'.CHtml::encode($content).'</pre>';
		else
		{
			$highlighter->setRenderer(new Text_Highlighter_Renderer_Html($options));
			$o=preg_replace('/<span\s+[^>]*>(\s*)<\/span>/','\1',$highlighter->highlight($content));
		}

		return CHtml::tag('div',$this->containerOptions,$o);
	}
public function highlight($content)
	{
		$this->registerClientScript();

		$options['use_language']=true;
		$options['tabsize']=$this->tabSize;
		if($this->showLineNumbers)
			$options['numbers']=($this->lineNumberStyle==='list')?HL_NUMBERS_LI:HL_NUMBERS_TABLE;

		$highlighter=empty($this->language)?false:Text_Highlighter::factory($this->language);
		if($highlighter===false)
			$o='<pre>'.CHtml::encode($content).'</pre>';
		else
		{
			$highlighter->setRenderer(new Text_Highlighter_Renderer_Html($options));
			$o=preg_replace('/<span\s+[^>]*>(\s*)<\/span>/','\1',$highlighter->highlight($content));
		}

		return CHtml::tag('div',$this->containerOptions,$o);
	}
public function highlight ( $ content ) { $ this -> registerClientScript ( ) ; $ options [ 'use_language' ] = true ; $ options [ 'tabsize' ] = $ this -> tabSize ; if ( $ this -> showLineNumbers ) $ options [ 'numbers' ] = ( $ this -> lineNumberStyle === 'list' ) ? HL_NUMBERS_LI : HL_NUMBERS_TABLE ; $ highlighter = empty ( $ this -> language ) ? false : Text_Highlighter :: factory ( $ this -> language ) ; if ( $ highlighter === false ) $ o = '<pre>' . CHtml :: encode ( $ content ) . '</pre>' ; else { $ highlighter -> setRenderer ( new Text_Highlighter_Renderer_Html ( $ options ) ) ; $ o = preg_replace ( '/<span\s+[^>]*>(\s*)<\/span>/' , '\1' , $ highlighter -> highlight ( $ content ) ) ; } return CHtml :: tag ( 'div' , $ this -> containerOptions , $ o ) ; }
Highlights the content by the syntax of the specified language.
@param string $content the content to be highlighted.
@return string the highlighted content
Highlights the content by the syntax of the specified language .