From 0b2666fec491cea14488bce61ea6555b942d870b Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 30 Jun 2003 14:15:36 +0000 Subject: [PATCH] Fixed a bug. --- BIFE/Translate.php | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 BIFE/Translate.php diff --git a/BIFE/Translate.php b/BIFE/Translate.php new file mode 100644 index 0000000..83cd535 --- /dev/null +++ b/BIFE/Translate.php @@ -0,0 +1,76 @@ + | +// +--------------------------------------------------------------------+ +// +// $Id$ +// + +// +X2C includes +require_once 'BIFE/Fallback.php'; +// ~X2C + +// +X2C Class 7 :Translate +/** + * This is a generic and simple (but very usefull) BIFE_Fallback implementation. Translate widgets using a template with it's name, prepended with 'bife_'. If not template is found, it copy the XML to the output. + * + * @access public + */ +class BIFE_Translate extends BIFE_Fallback { + // ~X2C + + // +X2C Operation 12 + /** + * Renders the widget. + * + * @param HTML_Template_HIT &$template Template to use to render the widget. + * + * @return string + * @access public + */ + function render(&$template) // ~X2C + { + $name = "bife_{$this->name}"; + if ($template->exists($name, '')) { + $this->attrs['CONTENTS'] = $this->renderContents($template); + $out = $template->parse($name, $this->attrs, '', ''); + } else { + $name = $this->name; + $out = "<$name"; + foreach ($this->attrs as $attr => $val) { + $out .= sprintf(' %s="%s"', $attr, $val); + } + $contents = $this->renderContents($template); + if ($contents !== '') { + $out .= ">$contents"; + } else { + $out .= "/>"; + } + } + return $out; + } + // -X2C + +} // -X2C Class :Translate + +?> -- 2.43.0