00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class Mage_Core_Block_Text_Tag extends Mage_Core_Block_Text
00034 {
00035
00036 protected function _construct()
00037 {
00038 parent::_construct();
00039 $this->setTagParams(array());
00040 }
00041
00042 function setTagParam($param, $value=null)
00043 {
00044 if (is_array($param) && is_null($value)) {
00045 foreach ($param as $k=>$v) {
00046 $this->setTagParam($k, $v);
00047 }
00048 } else {
00049 $params = $this->getTagParams();
00050 $params[$param] = $value;
00051 $this->setTagParams($params);
00052 }
00053 return $this;
00054 }
00055
00056 function setContents($text)
00057 {
00058 $this->setTagContents($text);
00059 return $this;
00060 }
00061
00062 protected function _toHtml()
00063 {
00064 $this->setText('<'.$this->getTagName().' ');
00065 if ($this->getTagParams()) {
00066 foreach ($this->getTagParams() as $k=>$v) {
00067 $this->addText($k.'="'.$v.'" ');
00068 }
00069 }
00070
00071 $this->addText('>'.$this->getTagContents().'</'.$this->getTagName().'>'."\r\n");
00072 return parent::_toHtml();
00073 }
00074
00075 }