From c38c1e6f271f73e5d9474e63bca227e2b7a30db8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 29 Dec 2005 13:01:04 +0000 Subject: Added line numbers to source view. --- .../protected/controls/TTextHighlighter.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'demos/quickstart/protected/controls/TTextHighlighter.php') diff --git a/demos/quickstart/protected/controls/TTextHighlighter.php b/demos/quickstart/protected/controls/TTextHighlighter.php index b89e5274..bc74b5af 100644 --- a/demos/quickstart/protected/controls/TTextHighlighter.php +++ b/demos/quickstart/protected/controls/TTextHighlighter.php @@ -43,22 +43,19 @@ class TTextHighlighter extends TWebControl return $this->getViewState('LineNumbers', false); } - public function getEnableEntities() - { - return $this->getViewState('Entities', false); - } - - public function setEnableEntities($value) - { - $this->setViewState('Entities', TPropertyValue::ensureBoolean($value), false); - } - protected function onPreRender($writer) { parent::onPreRender($writer); $this->registerTextHighlightStyleSheet(); } + public function addParsedObject($object) + { + if(is_string($object)) + $object=html_entity_decode($object); + parent::addParsedObject($object); + } + protected function renderContents($writer) { $textWriter=new TTextWriter; @@ -86,8 +83,6 @@ class TTextHighlighter extends TWebControl */ protected function highlightText($text) { - if(!$this->getEnableEntities()) - $text = html_entity_decode($text); $geshi = new GeSHi(trim($text), $this->getLanguage()); if($this->getEnableLineNumbers()) $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS); -- cgit v1.2.3