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 +++++++------------ demos/quickstart/protected/pages/ViewSource.page | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'demos') 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); diff --git a/demos/quickstart/protected/pages/ViewSource.page b/demos/quickstart/protected/pages/ViewSource.page index 21ddafa8..c17d35af 100644 --- a/demos/quickstart/protected/pages/ViewSource.page +++ b/demos/quickstart/protected/pages/ViewSource.page @@ -10,7 +10,7 @@
- +
-- cgit v1.2.3