[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/src/compiler/tag_node/ -> WactRuntimeComponentHTMLTag.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  /**
  11   * Server tag component tags are WactRuntimeComponentTags which also correspond to
  12   * an HTML tag.
  13   * @package wact
  14   * @version $Id: WactRuntimeComponentHTMLTag.class.php 5945 2007-06-06 08:31:43Z pachanga $
  15   */
  16  class WactRuntimeComponentHTMLTag extends WactRuntimeComponentTag
  17  {
  18    protected $runtimeComponentName = 'WactRuntimeTagComponent';
  19  
  20    /**

  21    * Returns the XML tag name

  22    * @return string

  23    * @access protected

  24    */
  25    function getRenderedTag()
  26    {
  27      return $this->tag;
  28    }
  29  
  30    function generateExtraAttributes($code_writer)
  31    {
  32      $this->generateDynamicAttributeList($code_writer, $this->tag_info->getSuppressAttributes());
  33    }
  34  
  35    function generateBeforeContent($code_writer)
  36    {
  37      $this->generateBeforeOpenTag($code_writer);
  38  
  39      $this->_renderOpenTag($code_writer);
  40  
  41      $this->generateAfterOpenTag($code_writer);
  42    }
  43  
  44    function generateBeforeOpenTag($code_writer)
  45    {
  46    }
  47  
  48    function generateAfterOpenTag($code_writer)
  49    {
  50    }
  51  
  52    function generateAfterContent($code_writer)
  53    {
  54      $this->generateBeforeCloseTag($code_writer);
  55  
  56      $this->_renderCloseTag($code_writer);
  57  
  58      $this->generateAfterCloseTag($code_writer);
  59    }
  60  
  61    function generateBeforeCloseTag($code_writer)
  62    {
  63    }
  64  
  65    function generateAfterCloseTag($code_writer)
  66    {
  67    }
  68  
  69    protected function _renderOpenTag($code_writer)
  70    {
  71      $code_writer->writeHTML('<' . $this->getRenderedTag());
  72  
  73      $code_writer->writePHP($this->getComponentRefCode() . '->renderAttributes();');
  74  
  75      $this->generateExtraAttributes($code_writer);
  76  
  77      if ($this->emptyClosedTag)
  78        $code_writer->writeHTML(' /');
  79  
  80      $code_writer->writeHTML('>');
  81    }
  82  
  83    protected function _renderCloseTag($code_writer)
  84    {
  85      if ($this->hasClosingTag)
  86        $code_writer->writeHTML('</' . $this->getRenderedTag() .  '>');
  87    }
  88  
  89    /**

  90    * Writes the compiled template constructor from the runtime component,

  91    * assigning the attributes found at compile time to the runtime component

  92    * via a serialized string

  93    */
  94    function generateConstructor($code_writer)
  95    {
  96      parent :: generateConstructor($code_writer);
  97  
  98      // Determine which attributes should not propigate to runtime

  99      $CompileTimeAttributes = $this->tag_info->getSuppressAttributes();
 100  
 101      // Add the runat attribute to the list of attributes to filter out

 102      $CompileTimeAttributes[] = 'runat';
 103      $CompileTimeAttributes[] = 'wact:id';
 104  
 105      $code_writer->writePHP($this->getComponentRefCode() . '->setAttributes(unserialize(');
 106      $code_writer->writePHPLiteral(serialize($this->getAttributesAsArray($CompileTimeAttributes)));
 107      $code_writer->writePHP('));'."\n");
 108    }
 109  }
 110  ?>


Generated: Fri Aug 29 04:49:26 2008 Cross-referenced by PHPXref 0.7