-function addTextArea($name, $text = '', $cols = 40, $rows = 10, $attr = '') {
- return '<textarea name="'.htmlspecialchars($name).'" '.
- 'rows="'.(int)$rows .'" cols="'.(int)$cols.'"'.
- $attr . '">'.htmlspecialchars($text) ."</textarea>\n";
+function addTextArea($sName, $sText = '', $iCols = 40, $iRows = 10, $aAttribs = array()) {
+
+ // no longer accept string arguments for attribs; print
+ // backtrace to help people fix their code
+ if (!is_array($aAttribs)) {
+ echo '$aAttribs argument to addTextArea() must be an array<br /><pre>';
+ debug_print_backtrace();
+ echo '</pre><br />';
+ exit;
+ }
+
+ // FIXME: should the template do this instead????
+ else if (!isset($aAttribs['class'])) $aAttribs['class'] = 'sqmtextarea';
+
+ global $oTemplate;
+
+//FIXME: all the values in the $aAttribs list as well as $sName and $sText used to go thru htmlspecialchars()... I would propose that most everything that is assigned to the template should go thru that *in the template class* on its way between here and the actual template file. Otherwise we have to do something like: foreach ($aAttribs as $key => $value) $aAttribs[$key] = htmlspecialchars($value); $sName = htmlspecialchars($sName); $sText = htmlspecialchars($sText);
+ $oTemplate->assign('aAttribs', $aAttribs);
+ $oTemplate->assign('name', $sName);
+ $oTemplate->assign('text', $sText);
+ $oTemplate->assign('cols', (int)$iCols);
+ $oTemplate->assign('rows', (int)$iRows);
+
+ return $oTemplate->fetch('textarea.tpl');