summaryrefslogtreecommitdiff
path: root/framework/Web/UI/THtmlWriter.php
diff options
context:
space:
mode:
authorxue <>2005-11-25 03:18:09 +0000
committerxue <>2005-11-25 03:18:09 +0000
commit635ae748a34dadc241bd264e11d3251ffffe3aac (patch)
tree206ce58ecc3348fb43a945d7e927dfadcef35653 /framework/Web/UI/THtmlWriter.php
parent81b7d150b1c815cdd032c2b5795b6c4244e56ace (diff)
Diffstat (limited to 'framework/Web/UI/THtmlWriter.php')
-rw-r--r--framework/Web/UI/THtmlWriter.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php
index 75926d55..7388818f 100644
--- a/framework/Web/UI/THtmlWriter.php
+++ b/framework/Web/UI/THtmlWriter.php
@@ -165,10 +165,15 @@ class THtmlWriter extends TComponent implements ITextWriter
'width'=>false,
'wrap'=>false
);
-
+ private static $_styleEncode=array(
+ 'background-image'=>true,
+ 'font-family'=>false,
+ 'list-style-image'=>true
+ );
private $_attributes=array();
private $_openTags=array();
private $_writer=null;
+ private $_styles=array();
public function __construct($writer)
{
@@ -185,6 +190,14 @@ class THtmlWriter extends TComponent implements ITextWriter
$this->_attributes[$name]=isset(self::$_attrEncode[$name])?THttpUtility::htmlEncode($value):$value;
}
+ public function addStyleAttribute($name,$value)
+ {
+ if(isset(self::$_styleEncode[$name]))
+ $this->_styles[$name]=HttpUtility::htmlEncode($value);
+ else
+ $this->_styles[$name]=$value;
+ }
+
public function flush()
{
$this->_writer->flush();
@@ -211,6 +224,13 @@ class THtmlWriter extends TComponent implements ITextWriter
$str='<'.$tagName;
foreach($this->_attributes as $name=>$value)
$str.=' '.$name.'="'.$value.'"';
+ if(!empty($this->_styles))
+ {
+ $str.=' style="';
+ foreach($this->_styles as $name=>$value)
+ $str.=$name.':'.$value.';';
+ $str.='"';
+ }
if($tagType===self::TAG_NONCLOSING)
{
$str.=' />';
@@ -223,6 +243,7 @@ class THtmlWriter extends TComponent implements ITextWriter
}
$this->_writer->write($str);
$this->_attributes=array();
+ $this->_styles=array();
}
public function renderEndTag()