From c7646042315196d1386084580e1c4c88cce9b374 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 8 Feb 2013 16:48:55 +0000 Subject: [PATCH] explicit whitelist for certain attributes and widget-types used to supress rows and cols everywhere but textbox and suppress orient if empty --- etemplate/inc/class.xul_io.inc.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index 606cf17144..2169397a56 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -120,6 +120,14 @@ class xul_io 'menupopup' => 'select', 'description' => 'label' ); + + /** + * explicit whitelist for certain attributes and widget types + */ + var $attr_whitelist = array( + 'rows' => array('textbox'), + 'cols' => array('textbox'), + ); /** * Keys of currently processed template on export, to resolve relative names * @@ -275,7 +283,7 @@ class xul_io } // no sure where the data key gets set, but it gives a warning in xml serialization (empty array) unset($cell['data']); - $cell['orient'] = $orient; + if (!empty($orient)) $cell['orient'] = $orient; $cell['size'] = $options; break; @@ -309,6 +317,11 @@ class xul_io { $attr = $this->attr2xul[$attr]; } + // check if attribute has an explicit whitelist and widget type is in it + if (isset($this->attr_whitelist[$attr]) && !in_array($type, $this->attr_whitelist[$attr])) + { + continue; + } $this->set_attributes($attr_widget,$attr,$val); } if ($child)