diff options
Diffstat (limited to 'demos/quickstart')
-rw-r--r-- | demos/quickstart/protected/controls/TTextHighlighter.php | 19 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/ViewSource.page | 2 |
2 files changed, 8 insertions, 13 deletions
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 @@ <com:TLiteral ID="SourceList" />
</div>
<div id="sourceView">
-<com:TTextHighlighter ID="Highlighter" CssClass="source">
+<com:TTextHighlighter ID="Highlighter" EnableLineNumbers="true" CssClass="source">
<com:TLiteral ID="SourceView" />
</com:TTextHighlighter>
</div>
|