diff options
author | xue <> | 2005-12-29 12:20:57 +0000 |
---|---|---|
committer | xue <> | 2005-12-29 12:20:57 +0000 |
commit | 3126610fdab66c4e83de00d36a762af30199238d (patch) | |
tree | 96c0e41e404303eb95d0c29c3da728dac8c29336 /demos/quickstart/protected/pages/ViewSource.php | |
parent | 658a7e1c4cf5a53dcd61ee196658090d00f2d64a (diff) |
Modified TTextHighlighter so that it can highlight its body content including output of its child controls.
Modified ViewSource to make use of TTextHighlighter.
Diffstat (limited to 'demos/quickstart/protected/pages/ViewSource.php')
-rw-r--r-- | demos/quickstart/protected/pages/ViewSource.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/demos/quickstart/protected/pages/ViewSource.php b/demos/quickstart/protected/pages/ViewSource.php index 65cefa70..2cb3df08 100644 --- a/demos/quickstart/protected/pages/ViewSource.php +++ b/demos/quickstart/protected/pages/ViewSource.php @@ -24,9 +24,10 @@ class ViewSource extends TPage parent::onLoad($param);
$path=$this->Request->Items['path'];
$fullPath=realpath($this->Service->BasePath.'/'.$path);
+ $fileExt=$this->getFileExtension($fullPath);
if($fullPath!==false && is_file($fullPath) && strpos($fullPath,$this->Service->BasePath)!==false)
{
- if($this->isFileTypeAllowed($this->getFileExtension($fullPath)))
+ if($this->isFileTypeAllowed($fileExt))
{
$this->_fullPath=strtr($fullPath,'\\','/');
$this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
@@ -59,8 +60,24 @@ class ViewSource extends TPage $this->SourceList->Text=$str;
}
- $this->SourceView->Text=highlight_string(file_get_contents($this->_fullPath),true);
- //$this->SourceView->Text=file_get_contents($this->_fullPath);
+ switch($fileExt)
+ {
+ case 'page' :
+ case 'tpl' :
+ $this->Highlighter->Language='prado';
+ break;
+ case 'php' :
+ $this->Highlighter->Language='php';
+ break;
+ case 'xml' :
+ $this->Highlighter->Language='xml';
+ break;
+ default :
+ $this->Highlighter->Language='html';
+ break;
+ }
+
+ $this->SourceView->Text=file_get_contents($this->_fullPath);
}
}
|