diff options
author | ctrlaltca@gmail.com <> | 2011-05-25 09:34:54 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-05-25 09:34:54 +0000 |
commit | 15be96d7736550fbf097bb4dd3d4c971ef1f5cc1 (patch) | |
tree | 0ae9feb919e2303d2d034c08bce057540fe6b689 /framework/Web/UI/WebControls | |
parent | 8aa27c48cd1b620e3a7dee1e2de2cdc67f4e9874 (diff) |
backported build script fixes to branch/3.1
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/TTextHighlighter.php | 142 |
1 files changed, 74 insertions, 68 deletions
diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php index 890deb05..8218587c 100644 --- a/framework/Web/UI/WebControls/TTextHighlighter.php +++ b/framework/Web/UI/WebControls/TTextHighlighter.php @@ -4,16 +4,16 @@ *
* @author Wei Zhuo<weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
*/
Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter',false);
-Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter.Renderer.Html',false); -Prado::using('System.Web.UI.WebControls.TTextProcessor'); - +Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter.Renderer.Html',false);
+Prado::using('System.Web.UI.WebControls.TTextProcessor');
+
/**
* TTextHighlighter class.
@@ -37,8 +37,8 @@ Prado::using('System.Web.UI.WebControls.TTextProcessor'); */
class TTextHighlighter extends TTextProcessor
{
- private static $_lineNumberStyle=array(TTextHighlighterLineNumberStyle::Li => HL_NUMBERS_LI, TTextHighlighterLineNumberStyle::Table => HL_NUMBERS_TABLE); - + private static $_lineNumberStyle=array(TTextHighlighterLineNumberStyle::Li => HL_NUMBERS_LI, TTextHighlighterLineNumberStyle::Table => HL_NUMBERS_TABLE);
+
/**
* @return string tag name of the panel
*/
@@ -99,39 +99,39 @@ class TTextHighlighter extends TTextProcessor {
$this->setViewState('CopyCode', TPropertyValue::ensureBoolean($value), false);
}
- - /** - * @return TTextHighlighterLineNumberStyle style of row number, Table by default - */ - public function getLineNumberStyle() - { - return $this->getViewState('LineNumberStyle', TTextHighlighterLineNumberStyle::Table); +
+ /**
+ * @return TTextHighlighterLineNumberStyle style of row number, Table by default
+ */
+ public function getLineNumberStyle()
+ {
+ return $this->getViewState('LineNumberStyle', TTextHighlighterLineNumberStyle::Table);
+ }
+
+ /**
+ * @param TTextHighlighterLineNumberStyle style of row number
+ */
+ public function setLineNumberStyle($value)
+ {
+ $this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value,'TTextHighlighterLineNumberStyle'));
+ }
+
+ /**
+ * @return integer tab size. Defaults to 4.
+ */
+ public function getTabSize()
+ {
+ return $this->getViewState('TabSize', 4);
+ }
+
+ /**
+ * @param integer tab size
+ */
+ public function setTabSize($value)
+ {
+ $this->setViewState('TabSize', TPropertyValue::ensureInteger($value));
}
- - /** - * @param TTextHighlighterLineNumberStyle style of row number - */ - public function setLineNumberStyle($value) - { - $this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value,'TTextHighlighterLineNumberStyle')); - } - - /** - * @return integer tab size. Defaults to 4. - */ - public function getTabSize() - { - return $this->getViewState('TabSize', 4); - } - - /** - * @param integer tab size - */ - public function setTabSize($value) - { - $this->setViewState('TabSize', TPropertyValue::ensureInteger($value)); - } - +
/**
* Registers css style for the highlighted result.
* This method overrides parent implementation.
@@ -143,18 +143,18 @@ class TTextHighlighter extends TTextProcessor $this->registerStyleSheet();
$this->getPage()->getClientScript()->registerPradoScript('prado');
}
- - /** - * Registers the stylesheet for presentation. - */ - protected function registerStyleSheet() - { - $cs=$this->getPage()->getClientScript(); - $cssFile=Prado::getPathOfNamespace('System.3rdParty.TextHighlighter.highlight','.css'); - $cssKey='prado:TTextHighlighter:'.$cssFile; - if(!$cs->isStyleSheetFileRegistered($cssKey)) - $cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile)); - } +
+ /**
+ * Registers the stylesheet for presentation.
+ */
+ protected function registerStyleSheet()
+ {
+ $cs=$this->getPage()->getClientScript();
+ $cssFile=Prado::getPathOfNamespace('System.3rdParty.TextHighlighter.highlight','.css');
+ $cssKey='prado:TTextHighlighter:'.$cssFile;
+ if(!$cs->isStyleSheetFileRegistered($cssKey))
+ $cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile));
+ }
/**
* Processes a text string.
@@ -163,18 +163,18 @@ class TTextHighlighter extends TTextProcessor * @return string the processed text result
*/
public function processText($text)
- { - try - { - $highlighter=Text_Highlighter::factory($this->getLanguage()); - } - catch(Exception $e) - { - $highlighter=false; - } - if($highlighter===false) - return ('<pre>'.htmlentities(trim($text)).'</pre>'); - + {
+ try
+ {
+ $highlighter=Text_Highlighter::factory($this->getLanguage());
+ }
+ catch(Exception $e)
+ {
+ $highlighter=false;
+ }
+ if($highlighter===false)
+ return ('<pre>'.htmlentities(trim($text)).'</pre>');
+
$options["use_language"]=true;
$options["tabsize"] = $this->getTabSize();
if ($this->getShowLineNumbers())
@@ -191,10 +191,16 @@ class TTextHighlighter extends TTextProcessor $id = $this->getClientID();
return TJavaScript::renderScriptBlock("new Prado.WebUI.TTextHighlighter('{$id}');");
}
-} - -class TTextHighlighterLineNumberStyle extends TEnumerable -{ - const Li='Li'; - const Table='Table'; +}
+
+/**
+ * @author Wei Zhuo<weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
+class TTextHighlighterLineNumberStyle extends TEnumerable
+{
+ const Li='Li';
+ const Table='Table';
}
|