From deeaaa63583018faea3a3b68a8ddd37e90ce022b Mon Sep 17 00:00:00 2001 From: chriskl Date: Sun, 22 Jun 2003 09:51:50 +0000 Subject: [PATCH] convert to LF, fix a call time pass by ref --- classes/class.select.php | 434 +++++++++++++++++++-------------------- 1 file changed, 217 insertions(+), 217 deletions(-) diff --git a/classes/class.select.php b/classes/class.select.php index bcf98890..ab1c67e4 100644 --- a/classes/class.select.php +++ b/classes/class.select.php @@ -1,217 +1,217 @@ -_element = $this->is_element(); - - } - - function set_style($style) { - $this->set_attribute("style", $style); - } - - function set_class($class) { - $this->set_attribute("class", $class); - } - - - function is_element() { - return - str_replace("xhtml_", "", get_class($this)); - } - - /** - * Private function generates xhtml - * @access private - */ - function _html() { - $this->_htmlcode = "<"; - foreach ($this->_attributeCollection as $attribute => $value) { - if (!empty($value)) $this->_htmlcode .= " {$attribute}=\"{$value}\""; - } - $this->_htmlcode .= "/>"; - - return $this->_htmlcode; - } - - /** - * Returns xhtml code - * - */ - function fetch() { - return $this->_html(); - } - /** - * Echoes xhtml - * - */ - function show() { - echo $this->fetch(); - } - - function set_attribute($attr, $value) { - $this->_attributes[$attr] = $value; - } - - -} - -/** -* XHtmlElement -* -* Used to generate Xhtml-Code for xhtml elements -* that can contain child elements -* -* -*/ -class XHtmlElement extends XHtmlSimpleElement { - var $_text = null; - var $_htmlcode = ""; - var $_siblings = array(); - - function XHtmlElement($text = null) { - XHtmlSimpleElement::XHtmlSimpleElement(); - - if ($text) $this->set_text($text); - } - - /* - * Adds an xhtml child to element - * - * @param XHtmlElement The element to become a child of element - */ - function add(&$object) { - array_push($this->_siblings,& $object); - } - - - /* - * The CDATA section of Element - * - * @param string Text - */ - function set_text($text) { - if ($text) $this->_text = htmlspecialchars($text); - } - - function fetch() { - return $this->_html(); - } - - - function _html() { - - $this->_htmlcode = "<{$this->_element}"; - foreach ($this->_attributes as $attribute =>$value) { - if (!empty($value)) $this->_htmlcode .= " {$attribute} =\"{$value}\""; - } - $this->_htmlcode .= ">"; - - - if ($this->_text) { - $this->_htmlcode .= $this->_text; - } - - foreach ($this->_siblings as $obj) { - $this->_htmlcode .= $obj->fetch(); - } - - $this->_htmlcode .= "_element}>"; - - return $this->_htmlcode; - } - - /* - * Returns siblings of Element - * - */ - function get_siblings() { - return $this->_siblings; - } - - function has_siblings() { - return (count($this->_siblings) != 0); - } -} - -class XHTML_Button extends XHtmlElement { - function XHTML_Button ($name, $text = null) { - parent::XHtmlElement(); - - $this->set_attribute("name", $name); - - if ($text) $this->set_text($text); - } -} - - -class XHTML_Option extends XHtmlElement { - function XHTML_Option($text, $value = null) { - XHtmlElement::XHtmlElement(null); - $this->set_text($text); - } -} - - -class XHTML_Select extends XHTMLElement { - var $_data; - - function XHTML_Select ($name, $multiple = false, $size = null) { - XHtmlElement::XHtmlElement(); - - $this->set_attribute("name", $name); - if ($multiple) $this->set_attribute("multiple","multiple"); - if ($size) $this->set_attribute("size",$size); - - - } - - function set_data(&$data, $delim = ",") { - switch (gettype($data)) { - case "string": - $this->_data = explode($delim, $data); - break; - case "array": - $this->_data = $data; - break; - - default: - break; - } - } - - function fetch() { - if (isset($this->_data) && $this->_data) { - foreach ($this->_data as $value) { $this->add(new XHTML_Option($value)); } - } - return parent::fetch(); - } - -} - - -?> \ No newline at end of file +_element = $this->is_element(); + + } + + function set_style($style) { + $this->set_attribute("style", $style); + } + + function set_class($class) { + $this->set_attribute("class", $class); + } + + + function is_element() { + return + str_replace("xhtml_", "", get_class($this)); + } + + /** + * Private function generates xhtml + * @access private + */ + function _html() { + $this->_htmlcode = "<"; + foreach ($this->_attributeCollection as $attribute => $value) { + if (!empty($value)) $this->_htmlcode .= " {$attribute}=\"{$value}\""; + } + $this->_htmlcode .= "/>"; + + return $this->_htmlcode; + } + + /** + * Returns xhtml code + * + */ + function fetch() { + return $this->_html(); + } + /** + * Echoes xhtml + * + */ + function show() { + echo $this->fetch(); + } + + function set_attribute($attr, $value) { + $this->_attributes[$attr] = $value; + } + + +} + +/** +* XHtmlElement +* +* Used to generate Xhtml-Code for xhtml elements +* that can contain child elements +* +* +*/ +class XHtmlElement extends XHtmlSimpleElement { + var $_text = null; + var $_htmlcode = ""; + var $_siblings = array(); + + function XHtmlElement($text = null) { + XHtmlSimpleElement::XHtmlSimpleElement(); + + if ($text) $this->set_text($text); + } + + /* + * Adds an xhtml child to element + * + * @param XHtmlElement The element to become a child of element + */ + function add(&$object) { + array_push($this->_siblings, $object); + } + + + /* + * The CDATA section of Element + * + * @param string Text + */ + function set_text($text) { + if ($text) $this->_text = htmlspecialchars($text); + } + + function fetch() { + return $this->_html(); + } + + + function _html() { + + $this->_htmlcode = "<{$this->_element}"; + foreach ($this->_attributes as $attribute =>$value) { + if (!empty($value)) $this->_htmlcode .= " {$attribute} =\"{$value}\""; + } + $this->_htmlcode .= ">"; + + + if ($this->_text) { + $this->_htmlcode .= $this->_text; + } + + foreach ($this->_siblings as $obj) { + $this->_htmlcode .= $obj->fetch(); + } + + $this->_htmlcode .= "_element}>"; + + return $this->_htmlcode; + } + + /* + * Returns siblings of Element + * + */ + function get_siblings() { + return $this->_siblings; + } + + function has_siblings() { + return (count($this->_siblings) != 0); + } +} + +class XHTML_Button extends XHtmlElement { + function XHTML_Button ($name, $text = null) { + parent::XHtmlElement(); + + $this->set_attribute("name", $name); + + if ($text) $this->set_text($text); + } +} + + +class XHTML_Option extends XHtmlElement { + function XHTML_Option($text, $value = null) { + XHtmlElement::XHtmlElement(null); + $this->set_text($text); + } +} + + +class XHTML_Select extends XHTMLElement { + var $_data; + + function XHTML_Select ($name, $multiple = false, $size = null) { + XHtmlElement::XHtmlElement(); + + $this->set_attribute("name", $name); + if ($multiple) $this->set_attribute("multiple","multiple"); + if ($size) $this->set_attribute("size",$size); + + + } + + function set_data(&$data, $delim = ",") { + switch (gettype($data)) { + case "string": + $this->_data = explode($delim, $data); + break; + case "array": + $this->_data = $data; + break; + + default: + break; + } + } + + function fetch() { + if (isset($this->_data) && $this->_data) { + foreach ($this->_data as $value) { $this->add(new XHTML_Option($value)); } + } + return parent::fetch(); + } + +} + + +?> -- 2.39.5