[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/UI/WebControls/ -> TTextProcessor.php (source)

   1  <?php
   2  /**
   3   * TTextProcessor class file
   4   *
   5   * @author Qiang Xue <qiang.xue@gmail.com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2005 Wei Zhuo
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: TTextProcessor.php 1397 2006-09-07 07:55:53Z wei $
  10   * @package System.Web.UI.WebControls
  11   */
  12  
  13  /**
  14   * TTextProcessor class.
  15   *
  16   * TTextProcessor is the base class for classes that process or transform
  17   * text content into different forms. The text content to be processed
  18   * is specified by {@link setText Text} property. If it is not set, the body
  19   * content enclosed within the processor control will be processed and rendered.
  20   * The body content includes static text strings and the rendering result
  21   * of child controls.
  22   *
  23   * Note, all child classes must implement {@link processText} method.
  24   *
  25   * @author Qiang Xue <qiang.xue@gmail.com>
  26   * @version $Id: TTextProcessor.php 1397 2006-09-07 07:55:53Z wei $
  27   * @package System.Web.UI
  28   * @since 3.0.1
  29   */
  30  abstract class TTextProcessor extends TWebControl
  31  {
  32      /**
  33       * Processes a text string.
  34       * This method must be implemented by child classes.
  35       * @param string text string to be processed
  36       * @return string the processed text result
  37       */
  38      abstract public function processText($text);
  39  
  40      /**
  41       * HTML-decodes static text.
  42       * This method overrides parent implementation.
  43       * @param mixed object to be added as body content
  44       */
  45  	public function addParsedObject($object)
  46      {
  47          if(is_string($object))
  48              $object=html_entity_decode($object,ENT_QUOTES,'UTF-8');
  49          parent::addParsedObject($object);
  50      }
  51  
  52      /**
  53       * @return string text to be processed
  54       */
  55  	public function getText()
  56      {
  57          return $this->getViewState('Text','');
  58      }
  59  
  60      /**
  61       * @param string text to be processed
  62       */
  63  	public function setText($value)
  64      {
  65          $this->setViewState('Text',$value);
  66      }
  67  
  68      /**
  69       * Renders body content.
  70       * This method overrides the parent implementation by replacing
  71       * the body content with the processed text content.
  72       * @param THtmlWriter writer
  73       */
  74  	public function renderContents($writer)
  75      {
  76          if(($text=$this->getText())==='' && $this->getHasControls())
  77          {
  78              $textWriter=new TTextWriter;
  79              parent::renderContents(new THtmlWriter($textWriter));
  80              $text=$textWriter->flush();
  81          }
  82          if($text!=='')
  83              $writer->write($this->processText($text));
  84      }
  85  
  86  }
  87  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7